/** * Get the range of gifts available to a unit. * * @param unit The <code>Unit</code> to check. * @return A range of gifts, or null if none applicable. */ public final RandomRange getGifts(Unit unit) { if (gifts == null) return null; for (RandomRange range : gifts) { List<Scope> scopes = range.getScopes(); if (scopes.isEmpty()) return range; for (Scope scope : scopes) { if (scope.appliesTo(unit)) return range; } } return null; }
/** * Gets the plunder range available for the supplied unit. * * @param unit The <code>Unit</code> to check. * @return The plunder range, or null if none applicable. */ public final RandomRange getPlunderRange(Unit unit) { if (plunder == null) return null; for (RandomRange range : plunder) { List<Scope> scopes = range.getScopes(); if (scopes.isEmpty()) return range; for (Scope scope : scopes) { if (scope.appliesTo(unit)) return range; } } return null; }