Record Class RaidStrategySet

java.lang.Object
java.lang.Record
com.pixelmonmod.pixelmon.battles.raids.strategy.RaidStrategySet
Record Components:
strategies - The ordered raid strategies to dispatch to.
All Implemented Interfaces:
RaidStrategy

public record RaidStrategySet(List<RaidStrategy> strategies) extends Record implements RaidStrategy
Runtime composite for the strategies configured by a raid type.

This class is intentionally separate from RaidType. The raid type remains datapack configuration, while this composite provides the convenient RaidStrategy dispatch surface used by the raid boss participant.

Void lifecycle hooks are forwarded to every strategy in list order. Damage hooks pipe the returned damage value through each strategy in order. Boolean hooks short-circuit on the first strategy that returns true, because those hooks represent handling or blocking a single action.

  • Constructor Details

    • RaidStrategySet

      public RaidStrategySet(List<RaidStrategy> strategies)
      Creates an instance of a RaidStrategySet record class.
      Parameters:
      strategies - the value for the strategies record component
  • Method Details

    • type

      public RaidStrategyType<?> type()
      Strategy sets are runtime composites and are not serialized as standalone strategy entries.
      Specified by:
      type in interface RaidStrategy
      Returns:
      Never returns normally.
      Throws:
      UnsupportedOperationException - Always thrown because this composite has no registered strategy type.
    • onRaidStart

      public void onRaidStart(BattleParticipant boss)
      Description copied from interface: RaidStrategy
      Called when the raid boss participant is initialized for battle.

      Use this hook for battle-local setup such as boss modification, applying gimmicks, initializing context state, or preparing cached values.

      Specified by:
      onRaidStart in interface RaidStrategy
      Parameters:
      boss - The raid boss participant.
    • update

      public void update(BattleParticipant boss)
      Description copied from interface: RaidStrategy
      Called from the raid boss participant tick.

      Use this for real-time behavior that is not tied to turn boundaries, such as Tera Raid timers or delayed revival.

      Specified by:
      update in interface RaidStrategy
      Parameters:
      boss - The raid boss participant.
    • onTurnEnd

      public void onTurnEnd(BattleParticipant boss)
      Description copied from interface: RaidStrategy
      Called when a battle turn ends for the raid boss participant.
      Specified by:
      onTurnEnd in interface RaidStrategy
      Parameters:
      boss - The raid boss participant.
    • onBossDamaged

      public float onBossDamaged(BattleParticipant boss, PixelmonWrapper attacker, float damage, DamageTypeEnum damageType)
      Description copied from interface: RaidStrategy
      Called when the raid boss is about to take damage.

      The returned value is the damage that should continue through the battle damage flow. Composite strategy dispatch passes the returned value from one strategy into the next.

      Specified by:
      onBossDamaged in interface RaidStrategy
      Parameters:
      boss - The raid boss participant.
      attacker - The Pokemon that caused the damage.
      damage - The incoming damage amount.
      damageType - The kind of damage being applied.
      Returns:
      The damage amount to apply after this strategy has handled it.
    • onPokemonFainted

      public void onPokemonFainted(BattleParticipant boss, PixelmonWrapper fainted)
      Description copied from interface: RaidStrategy
      Called when a Pokemon on the opposing side faints during the raid.
      Specified by:
      onPokemonFainted in interface RaidStrategy
      Parameters:
      boss - The raid boss participant.
      fainted - The Pokemon that fainted.
    • shouldKeepFaintedPokemon

      public boolean shouldKeepFaintedPokemon(BattleParticipant boss, BattleParticipant opponent, PixelmonWrapper fainted)
      Description copied from interface: RaidStrategy
      Called when an opponent faints and the battle controller is deciding whether the fainted Pokemon should remain active instead of being removed.
      Specified by:
      shouldKeepFaintedPokemon in interface RaidStrategy
      Parameters:
      boss - The raid boss participant.
      opponent - The participant whose Pokemon fainted.
      fainted - The fainted Pokemon.
      Returns:
      true if the fainted Pokemon should remain active.
    • shouldSkipTurnAgainstOpponent

      public boolean shouldSkipTurnAgainstOpponent(BattleParticipant boss, BattleParticipant opponent, PixelmonWrapper bossPokemon)
      Description copied from interface: RaidStrategy
      Called when the raid boss's lane participant is deciding whether to skip its turn against a specific opponent.
      Specified by:
      shouldSkipTurnAgainstOpponent in interface RaidStrategy
      Parameters:
      boss - The raid boss participant.
      opponent - The opposing lane participant.
      bossPokemon - The boss Pokemon in that lane.
      Returns:
      true if the boss should skip this lane turn.
    • onRaidEnd

      public void onRaidEnd(BattleParticipant boss, BattleEndCause cause)
      Description copied from interface: RaidStrategy
      Called when the raid battle ends.
      Specified by:
      onRaidEnd in interface RaidStrategy
      Parameters:
      boss - The raid boss participant.
      cause - The battle end cause.
    • onPokemonSwitchIn

      public void onPokemonSwitchIn(BattleParticipant boss, PixelmonWrapper entering)
      Description copied from interface: RaidStrategy
      Called when the raid boss switches in or is re-applied as the active Pokemon.
      Specified by:
      onPokemonSwitchIn in interface RaidStrategy
      Parameters:
      boss - The raid boss participant.
      entering - The Pokemon entering battle.
    • onBossAttack

      public void onBossAttack(BattleParticipant boss, PixelmonWrapper bossPokemon)
      Description copied from interface: RaidStrategy
      Called when the raid boss participant is asked to use its attack for the current action.
      Specified by:
      onBossAttack in interface RaidStrategy
      Parameters:
      boss - The raid boss participant.
      bossPokemon - The active boss Pokemon.
    • onUseAttackOther

      public boolean onUseAttackOther(BattleParticipant boss, BattleParticipant user, PixelmonWrapper attacker, Attack attack)
      Description copied from interface: RaidStrategy
      Called when another participant attempts to use an attack while the raid boss is present.

      Return true when the strategy handled or blocked the attack. This prevents later strategies in the composite from also handling the same attack.

      Specified by:
      onUseAttackOther in interface RaidStrategy
      Parameters:
      boss - The raid boss participant.
      user - The participant using the attack.
      attacker - The Pokemon using the attack.
      attack - The attack being used.
      Returns:
      Whether this strategy handled or blocked the attack.
    • onTargeted

      public boolean onTargeted(BattleParticipant boss, PixelmonWrapper user, Attack attack)
      Description copied from interface: RaidStrategy
      Called when the raid boss is targeted by an attack.
      Specified by:
      onTargeted in interface RaidStrategy
      Parameters:
      boss - The raid boss participant.
      user - The Pokemon targeting the raid boss.
      attack - The attack being used.
      Returns:
      true if targeting should be blocked.
    • onAddStatus

      public boolean onAddStatus(BattleParticipant boss, PixelmonWrapper user, PixelmonWrapper target, StatusBase status)
      Description copied from interface: RaidStrategy
      Called when a status is about to be applied while the raid boss is involved.
      Specified by:
      onAddStatus in interface RaidStrategy
      Parameters:
      boss - The raid boss participant.
      user - The Pokemon applying the status.
      target - The Pokemon receiving the status.
      status - The status being applied.
      Returns:
      true if the status should be blocked.
    • onTakeTurn

      public boolean onTakeTurn(BattleParticipant boss)
      Description copied from interface: RaidStrategy
      Called when the raid boss participant is asked whether it wants to take a special turn action.
      Specified by:
      onTakeTurn in interface RaidStrategy
      Parameters:
      boss - The raid boss participant.
      Returns:
      true if this strategy handled the turn action.
    • onBattleAction

      public boolean onBattleAction(BattleParticipant boss, BattleParticipant actor, BattleAction action)
      Description copied from interface: RaidStrategy
      Called when an opposing participant selects a battle action that the raid boss may handle.
      Specified by:
      onBattleAction in interface RaidStrategy
      Parameters:
      boss - The raid boss participant.
      actor - The participant selecting the action.
      action - The selected action.
      Returns:
      true if this strategy handled the action.
    • onUseAttackPost

      public void onUseAttackPost(BattleParticipant boss, Attack attack)
      Description copied from interface: RaidStrategy
      Called after the raid boss uses an attack.
      Specified by:
      onUseAttackPost in interface RaidStrategy
      Parameters:
      boss - The raid boss participant.
      attack - The attack that was used.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • strategies

      public List<RaidStrategy> strategies()
      Returns the value of the strategies record component.
      Returns:
      the value of the strategies record component