Interface LevelRule
- All Known Implementing Classes:
LevelRule.Dynamic,LevelRule.Static
A rule that determines whether a particular upgrade or notification should activate at a
given pet level.
Level rules are the gating mechanism in a Skilltree:
each upgrade is paired with a rule, and the upgrade is only applied when
check(int) returns true for the pet's current level.
The closed set of rule kinds is the two nested records: LevelRule.Dynamic (an "every N levels,
optionally bounded" pattern) and LevelRule.Static (an explicit set of levels).
When multiple rules match the same level, they are applied in ascending
getPriority() order to ensure deterministic upgrade sequencing.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordMatches levels by an "everymodulolevels" pattern, optionally restricted to the inclusive range[start, end](end == 0means unbounded).static final recordMatches an explicit, fixed set of levels. -
Method Summary
Modifier and TypeMethodDescriptionbooleancheck(int level) Tests whether this rule matches the given level.intReturns the priority used to order this rule relative to other rules that match the same level.
-
Method Details
-
check
boolean check(int level) Tests whether this rule matches the given level.- Parameters:
level- the pet's current level (1-based)- Returns:
trueif the associated upgrade/notification should activate
-
getPriority
int getPriority()Returns the priority used to order this rule relative to other rules that match the same level. Lower values execute first.- Returns:
- the ordering priority
-