Interface LevelRule

All Known Implementing Classes:
LevelRule.Dynamic, LevelRule.Static

public sealed interface LevelRule permits 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 Classes
    Modifier and Type
    Interface
    Description
    static final record 
    Matches levels by an "every modulo levels" pattern, optionally restricted to the inclusive range [start, end] (end == 0 means unbounded).
    static final record 
    Matches an explicit, fixed set of levels.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    check(int level)
    Tests whether this rule matches the given level.
    int
    Returns 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:
      true if 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