Class StandardBattleController

java.lang.Object
com.pixelmonmod.pixelmon.battles.controller.StandardBattleController
All Implemented Interfaces:
RegistryBacked, BattleController, BattleEvents, BattleMessaging, BattleRandomContext, BattleSimulationContext, BattleSpectating, BattleStateView, ContextHolder, LegacyBattleAISupport

public class StandardBattleController extends Object implements BattleController
Controls flow of battles.
  • Field Details

    • participants

      protected List<BattleParticipant> participants
    • teams

      protected List<List<BattleParticipant>> teams
    • globalStatusController

      public GlobalStatusController globalStatusController
      Global conditions (e.g., weather) currently active in the battle.
    • spectators

      public Map<UUID,Spectator> spectators
      Spectators of the battle
    • battleTicks

      protected int battleTicks
      Controls when the battle state is checked.
    • battleTurn

      public int battleTurn
      The number of turns the battle has lasted.
    • ticks

      protected int ticks
    • battleIndex

      public int battleIndex
      The battle's index in the battle registry.
    • battleLog

      public BattleLog battleLog
      The battle log for the battle.
    • lastAttack

      public Attack lastAttack
      The most recent attack used during the battle.
    • lastSimulatedAttack

      public Attack lastSimulatedAttack
      The most recent attack used while simulating the battle.
    • lastTempAttack

      public Attack lastTempAttack
      The most recent temp attack used during the battle.
    • lastSimulatedTempAttack

      public Attack lastSimulatedTempAttack
      The most recent temp attack while simulating the battle.
    • rules

      public BattleRules rules
      The battle rules that are in effect for the battle.
    • dynamaxController

      protected DynamaxController dynamaxController
      Controller tracking dynamax potential during multi-battles.
    • hasSwitchedDuringThisMove

      public boolean hasSwitchedDuringThisMove
      Whether a Pokémon has switched due to a move. Only one Pokémon may switch per move.
    • currentAnimations

      protected List<ActiveBattleAnimation> currentAnimations
    • checkedPokemon

      public Set<Pokemon> checkedPokemon
      The Pokemon that need to be evolved
    • futureTasks

      protected final List<FutureBattleTask<?,?>> futureTasks
    • randomness

      protected BattleRandomness randomness
    • attackDamageCalculator

      protected AttackDamageCalculator attackDamageCalculator
    • registryAccess

      protected net.minecraft.core.RegistryAccess registryAccess
    • context

      protected final StoredContext context
    • actionIndex

      public int actionIndex
      Turn counter for individual Pokémon moving within a battle turn.
    • currentlyActingPokemon

      public PixelmonWrapper currentlyActingPokemon
      The currently acting pokemon.
    • turnList

      public List<PixelmonWrapper> turnList
  • Constructor Details

  • Method Details

    • battleTicks

      public int battleTicks()
      Description copied from interface: BattleStateView
      Returns the number of times the current battle has been ticked.
      This may be incremented multiple times per-server tick depending on the controller's battle tick rate. So this is not necessarily equal to 20 times a second.
      To get the number of battle ticks per second, use BattleStateView.battleTicksPerSecond().
      Specified by:
      battleTicks in interface BattleStateView
      Returns:
      the current battle tick
    • initBattle

      protected void initBattle() throws IllegalStateException
      Initiates the battle.
      Throws:
      IllegalStateException - If any participants have invalid pokemon this will get thro0wn
    • handleSetupForStartOfBattleHeadOfPartyEffect

      protected void handleSetupForStartOfBattleHeadOfPartyEffect(BattleParticipant p)
      The primary use of this function is to call Ability.applyStartOfBattleHeadOfPartyEffect(Pokemon, PixelmonWrapper), which is primarily used for Synchronize's out-of-battle effect.
      Parameters:
      p - A participant of the battle
    • doLater

      public void doLater(Runnable runnable, int ticks)
    • update

      public void update()
      Description copied from interface: BattleController
      Updates the battle every tick.
      Specified by:
      update in interface BattleController
    • doTurnLogic

      public void doTurnLogic()
      Specified by:
      doTurnLogic in interface BattleController
    • updateTurnZero

      public void updateTurnZero()
      Updates the battle every tick. Called before any Pokémon makes an attack for that turn.
    • modifyStatsCancellable

      public void modifyStatsCancellable(PixelmonWrapper attacker)
      Description copied from interface: BattleController
      Modifies Pokémon stats during a turn after deciding which Pokémon gets to make a move.
      Specified by:
      modifyStatsCancellable in interface BattleController
      Parameters:
      attacker - The Pokémon using a move.
    • participantReady

      public void participantReady(PlayerParticipant p)
      Alerted from a packet received from a participant that they have viewed all the battle messages and the next sub-turn can begin.
      Parameters:
      p - The player.
    • endTurn

      public void endTurn()
      Description copied from interface: BattleController
      Handles end-of-turn effects.
      Specified by:
      endTurn in interface BattleController
    • checkReviveSendOut

      public boolean checkReviveSendOut(BattleParticipant participant)
      Checks if a Pokémon can be sent out after being revived.
      Parameters:
      participant - The participant to check for sending out a revived Pokémon.
      Returns:
      True if a revived Pokémon can be sent out onto the battlefield.
    • reviveAfterDefeat

      public void reviveAfterDefeat(BattleParticipant p)
      Description copied from interface: BattleController
      Finds any statuses affecting the whole team and determines where a Pokémon being sent into battle should be positioned. Then sends out the newly revived Pokémon as an entity if it can, and sets the revived Pokémon's battle position, sets it as on the battlefield and applies the statuses. Finally, triggers some affects that occur when a Pokémon switches in.
      Specified by:
      reviveAfterDefeat in interface BattleController
      Parameters:
      p - the trainer that needs to send out a now revived Pokémon.
    • endBattle

      Description copied from interface: BattleController
      Ends the battle with the given cause and any precalculated results. This method is called by ALL other end of battle methods.
      Specified by:
      endBattle in interface BattleController
    • participantCanDynamax

      public boolean participantCanDynamax(BattleParticipant part)
      Description copied from interface: BattleController
      Checks if a participant is capable of dynamaxing and that it is their turn.
      Specified by:
      participantCanDynamax in interface BattleController
    • timedAbilityStarted

      public void timedAbilityStarted(PixelmonWrapper pw)
      Description copied from interface: BattleController
      Moves pokemon to end of list of pokemon gaining their abilities
      Specified by:
      timedAbilityStarted in interface BattleController
    • getPokemonOrderedByAbilityGain

      public List<PixelmonWrapper> getPokemonOrderedByAbilityGain()
      Specified by:
      getPokemonOrderedByAbilityGain in interface BattleController
    • tryFlee

      public boolean tryFlee(PixelmonWrapper p)
      Checks whether the specified Pokémon will try to flee.
      Parameters:
      p - The Pokémon to check.
      Returns:
      Whether the Pokémon will try to flee.
    • tryFlee

      public boolean tryFlee(PixelmonWrapper p, boolean turnEnd)
      Checks if the given Pokemon will try to flee.
      Parameters:
      p - The pokemon being checked
      turnEnd - If it's turn end (i.e. don't look back to see if they've already had their turn)
      Returns:
      true if the pokemon will try fleeing
    • reserveFaintOrder

      public void reserveFaintOrder(PixelmonWrapper target, PixelmonWrapper source, DamageTypeEnum damageType)
      Description copied from interface: BattleController
      Reserves this position in the faint order for effects whose user faints before their target, such as Self-Destruct and Final Gambit.
      Specified by:
      reserveFaintOrder in interface BattleController
    • reserveFaintOrderBefore

      public void reserveFaintOrderBefore(PixelmonWrapper target, PixelmonWrapper beforeTarget, PixelmonWrapper source, DamageTypeEnum damageType)
      Description copied from interface: BattleController
      Reserves a faint immediately before an existing faint. This is used by effects such as Innards Out whose owner wins if its retaliation knocks out both final Pokémon.
      Specified by:
      reserveFaintOrderBefore in interface BattleController
    • recordFaintOrder

      public void recordFaintOrder(PixelmonWrapper target, PixelmonWrapper source, DamageTypeEnum damageType)
      Description copied from interface: BattleController
      Records a faint after all cancellable faint hooks have completed successfully.
      Specified by:
      recordFaintOrder in interface BattleController
    • checkPokemon

      public void checkPokemon()
      Description copied from interface: BattleController
      Checks the conditions of the active Pokémon.
      Specified by:
      checkPokemon in interface BattleController
    • isOneAlive

      public boolean isOneAlive(List<PixelmonWrapper> teamPokemon)
      Checks whether there is a non-fainted Pokémon among the given Pokémon list.
      Parameters:
      teamPokemon - The list of Pokémon to check.
      Returns:
      Whether there is a non-fainted Pokémon.
    • checkDefeated

      public void checkDefeated(BattleParticipant p)
      Checks if a participant has been defeated, updates the BattleParticipant.isDefeated value, and notifies other participants of the battle that the participant is out of usable Pokémon.
      Parameters:
      p - The participant to check.
    • checkTeamDefeated

      public void checkTeamDefeated(BattleParticipant battleParticipant)
      Checks if the team of the given BattleParticipant has been defeated, and if so, will post the LostToWildPixelmonEvent if a player lost to a Wild Pixelmon, revent a player that lost from receiving money from a battle, and will then end the battle.
      Parameters:
      battleParticipant - The object that represents the owner of a team of Pokémon.
    • switchPokemon

      public void switchPokemon(UUID switchingPokemonUUID, UUID newPokemonUUID, boolean switchInstantly)
      Description copied from interface: BattleController
      Switches a Pokémon out for a different one.
      Specified by:
      switchPokemon in interface BattleController
      Parameters:
      switchingPokemonUUID - The Pokémon switching out.
      newPokemonUUID - The Pokémon to switch into.
      switchInstantly - True if the switch will happen immediately, false if the switch will happen during the turn.
    • storeSwitchInActivation

      public void storeSwitchInActivation(PixelmonWrapper pw, PixelmonWrapper former)
      Specified by:
      storeSwitchInActivation in interface BattleController
    • setFlee

      public void setFlee(UUID fleeingUUID)
      Description copied from interface: BattleController
      Sets a Pokémon to flee in the turn.
      Specified by:
      setFlee in interface BattleController
      Parameters:
      fleeingUUID - The fleeing Pokémon.
    • getOpponentPokemon

      public List<PixelmonWrapper> getOpponentPokemon(BattleParticipant participant)
      Returns all Pokemon on the opposite side of the battle that the specified participant is on.
      Parameters:
      participant - The participant to find opponent Pokemon for.
      Returns:
      A list of all Pokemon on the opposite of the battle that the participant is on.
    • spectators

      public List<Spectator> spectators()
      Description copied from interface: BattleSpectating
      Returns the spectators currently watching this battle.

      The returned list may be backed by the live battle state. Callers should avoid mutating it directly unless they are part of battle-controller internals.

      Specified by:
      spectators in interface BattleSpectating
      Returns:
      the current battle spectators
    • getViewingPlayers

      public List<net.minecraft.server.level.ServerPlayer> getViewingPlayers()
      Gets a list of all players that are viewing the battle
      This includes all players that are in the battle as well as spectators
      Returns:
      A list of all players that are viewing the battle
    • broadcastPacket

      public void broadcastPacket(PixelmonPacket packet)
      Description copied from interface: BattleMessaging
      Broadcasts a battle packet to all relevant battle clients.

      Implementations should avoid sending packets when battle communication is disabled.

      Specified by:
      broadcastPacket in interface BattleMessaging
      Parameters:
      packet - the packet to broadcast
    • getStage

      public BattleStage getStage()
      Description copied from interface: BattleStateView
      Returns the current stage of the battle.
      Specified by:
      getStage in interface BattleStateView
      Returns:
      the current battle stage
    • spectate

      public void spectate(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.entity.Entity target)
      Description copied from interface: BattleSpectating
      Adds a player as a spectator of this battle.

      The target entity is used as the entity the player is spectating from or tracking when they begin watching the battle.

      Specified by:
      spectate in interface BattleSpectating
      Parameters:
      player - the player to add as a spectator
      target - the battle-related entity being spectated or tracked
    • isSpectating

      public boolean isSpectating(net.minecraft.world.entity.player.Player player)
      Description copied from interface: BattleSpectating
      Returns whether the specified player is currently spectating this battle.
      Specified by:
      isSpectating in interface BattleSpectating
      Parameters:
      player - the player to check
      Returns:
      true if the player is spectating this battle; false otherwise
    • removeSpectator

      public boolean removeSpectator(net.minecraft.server.level.ServerPlayer player)
      Description copied from interface: BattleSpectating
      Removes a player from this battle's spectators.
      Specified by:
      removeSpectator in interface BattleSpectating
      Parameters:
      player - the spectator to remove
      Returns:
      true if the player was spectating this battle and was removed; false otherwise
    • duringSwitchAction

      public boolean duringSwitchAction()
      Description copied from interface: BattleController
      Checks whether the battle controller is performing hard swaps causing aligned switch-in effects
      Specified by:
      duringSwitchAction in interface BattleController
      Returns:
      whether the controller is occupied with hard switches
    • getLastAttack

      public Attack getLastAttack()
      Specified by:
      getLastAttack in interface BattleController
    • getLastTempAttack

      public Attack getLastTempAttack()
      Specified by:
      getLastTempAttack in interface BattleController
    • setOverworldWeatherAsBattleWeatherDuringBattle

      public boolean setOverworldWeatherAsBattleWeatherDuringBattle()
      This function first checks if there is no weather (i.e. the weather is Clear) or if the current battle weather represented the Minecraft Overworld. If either of those conditions are true, it rechecks what the current Minecraft weather is and changes the battle weather to that if necessary.
      Returns:
      Whether the weather was changed mid-battle.
    • addFunctionAtEvent

      public <E extends BattleEvent, A> CompletableFuture<A> addFunctionAtEvent(Class<E> eventClass, BiFunction<E,BattleController,A> task)
      Description copied from interface: BattleEvents
      Adds a one-shot function to run the next time the specified event type is published.

      The returned future is completed with the function result after the task has executed. Once executed, the task is removed and will not run for later events of the same type.

      Specified by:
      addFunctionAtEvent in interface BattleEvents
      Type Parameters:
      E - the battle event type
      A - the function result type
      Parameters:
      eventClass - the event type to wait for
      task - the function to execute when the event is published
      Returns:
      a future completed with the function result when the task runs
    • addTaskAtEvent

      public <E extends BattleEvent> CompletableFuture<Void> addTaskAtEvent(Class<E> eventClass, BiConsumer<E,BattleController> task)
      Description copied from interface: BattleEvents
      Adds a one-shot task to run the next time the specified event type is published.

      The returned future is completed after the task has executed. Once executed, the task is removed and will not run for later events of the same type.

      Specified by:
      addTaskAtEvent in interface BattleEvents
      Type Parameters:
      E - the battle event type
      Parameters:
      eventClass - the event type to wait for
      task - the task to execute when the event is published
      Returns:
      a future completed when the task has run
    • addPersistentTaskAtEvent

      public <E extends BattleEvent> void addPersistentTaskAtEvent(Class<E> eventClass, BiConsumer<E,BattleController> task)
      Description copied from interface: BattleEvents
      Adds a persistent task to run every time the specified event type is published.

      Persistent tasks are not removed after execution and do not expose a future, because they may run multiple times over the lifetime of the battle.

      Specified by:
      addPersistentTaskAtEvent in interface BattleEvents
      Type Parameters:
      E - the battle event type
      Parameters:
      eventClass - the event type to listen for
      task - the task to execute each time the event is published
    • registryAccess

      public net.minecraft.core.RegistryAccess registryAccess()
      Description copied from interface: RegistryBacked
      Returns the backing registry access used to resolve registries and entries.
      Specified by:
      registryAccess in interface RegistryBacked
      Returns:
      the registry access for this object
    • getContext

      public StoredContext getContext()
      Specified by:
      getContext in interface ContextHolder
    • publishEvent

      public <T extends BattleEvent> T publishEvent(T event)
      Description copied from interface: BattleEvents
      Publishes a battle event.

      Publishing an event should run any one-shot or persistent tasks waiting for that event type, and should also pass the event through the normal Pixelmon event pipeline where applicable. The returned event may have been modified by listeners.

      Specified by:
      publishEvent in interface BattleEvents
      Type Parameters:
      T - the battle event type
      Parameters:
      event - the event to publish
      Returns:
      the published event, potentially modified by listeners
    • copy

      public BattleController copy()
      Description copied from interface: BattleSimulationContext
      Creates a copy of this battle controller.

      The returned battle is intended for systems that need to evaluate or simulate battle outcomes without directly mutating the original battle. The exact copied state depends on the backing BattleController implementation.

      Specified by:
      copy in interface BattleSimulationContext
      Returns:
      a copied battle controller
    • getAttackDamageCalculator

      public AttackDamageCalculator getAttackDamageCalculator()
      Description copied from interface: BattleRandomContext
      Returns the attack damage calculator used by this battle.

      The damage calculator controls how the attack damage random multiplier is resolved. Different implementations may use normal random damage rolls, average damage, minimum damage, maximum damage, or another deterministic strategy for simulations and tests.

      Specified by:
      getAttackDamageCalculator in interface BattleRandomContext
      Returns:
      the attack damage calculator
    • setAttackDamageCalculator

      public void setAttackDamageCalculator(AttackDamageCalculator attackDamageCalculator)
      Description copied from interface: BattleRandomContext
      Sets the attack damage calculator used by this battle.
      Specified by:
      setAttackDamageCalculator in interface BattleRandomContext
      Parameters:
      attackDamageCalculator - the attack damage calculator to use
    • randomness

      public BattleRandomness randomness()
      Description copied from interface: BattleRandomContext
      Returns the battle randomness provider used by this battle.

      The randomness provider should be used by battle logic for random battle behaviour so live battles, tests, and simulations can control randomness consistently.

      Specified by:
      randomness in interface BattleRandomContext
      Returns:
      the battle randomness provider
    • setRandomness

      public void setRandomness(BattleRandomness randomness)
      Description copied from interface: BattleRandomContext
      Sets the battle randomness provider used by this battle.
      Specified by:
      setRandomness in interface BattleRandomContext
      Parameters:
      randomness - the battle randomness provider to use
    • hasInitialized

      public boolean hasInitialized()
    • waitTicks

      public int waitTicks()
      Description copied from interface: BattleSimulationContext
      Returns the number of battle ticks this battle must wait before normal turn progression can continue.
      Specified by:
      waitTicks in interface BattleSimulationContext
      Returns:
      remaining wait ticks
    • waitTicks

      public void waitTicks(int waitTicks)
      Description copied from interface: BattleSimulationContext
      Sets the number of battle ticks this battle must wait before normal turn progression can continue.
      Specified by:
      waitTicks in interface BattleSimulationContext
      Parameters:
      waitTicks - remaining wait ticks
    • shouldSendBattleStartPackets

      public boolean shouldSendBattleStartPackets()
      Description copied from interface: BattleController
      Determines whether participant initialization should emit battle start packets directly. Multi-lane battles disable this on their lane controllers so the parent controller can send a single packet with the full cross-lane battle view.
      Specified by:
      shouldSendBattleStartPackets in interface BattleController
      Returns:
      Whether this controller should send battle start packets from its participants.
    • shouldSendBattleStartPackets

      public void shouldSendBattleStartPackets(boolean shouldSendBattleStartPackets)
      Description copied from interface: BattleController
      Sets whether participant initialization should emit battle start packets directly.
      Specified by:
      shouldSendBattleStartPackets in interface BattleController
      Parameters:
      shouldSendBattleStartPackets - Whether this controller should send battle start packets.
    • globalStatusController

      public GlobalStatusController globalStatusController()
      Description copied from interface: BattleStateView
      Returns the controller for global battle statuses.
      Specified by:
      globalStatusController in interface BattleStateView
      Returns:
      the global status controller
    • battleLog

      public BattleLog battleLog()
      Description copied from interface: BattleStateView
      Returns the battle log for this battle.
      Specified by:
      battleLog in interface BattleStateView
      Returns:
      the battle log
    • outcome

      public BattleOutcome outcome()
      Description copied from interface: BattleStateView
      Returns whether this battle has ended.
      Specified by:
      outcome in interface BattleStateView
      Returns:
      true if the battle has ended; false otherwise
    • battleTurn

      public int battleTurn()
      Description copied from interface: BattleStateView
      Returns the current battle turn number.
      Specified by:
      battleTurn in interface BattleStateView
      Returns:
      the current battle turn
    • participants

      public List<BattleParticipant> participants()
      Description copied from interface: BattleStateView
      Returns the participants in this battle.

      The returned list may be backed by the live battle state. Callers should avoid mutating it unless they are part of battle-controller internals.

      Specified by:
      participants in interface BattleStateView
      Returns:
      the battle participants
    • teams

      public List<List<BattleParticipant>> teams()
      Description copied from interface: BattleStateView
      Returns the battle participants grouped by team.

      The returned lists may be backed by the live battle state. Callers should avoid mutating them unless they are part of battle-controller internals.

      Specified by:
      teams in interface BattleStateView
      Returns:
      the battle teams
    • simulateMode

      public boolean simulateMode()
      Description copied from interface: LegacyBattleAISupport
      Returns whether this battle is currently running in the legacy AI simulation mode.

      This flag is only used by the legacy BattleAI.ADVANCED, BattleAI.TACTICAL, and BattleAI.AGGRESSIVE implementations. New simulation-aware code should use the battle context instead.

      Specified by:
      simulateMode in interface LegacyBattleAISupport
      Returns:
      true if the battle is being simulated by legacy AI logic; false otherwise
    • simulateMode

      public void simulateMode(boolean simulateMode)
      Description copied from interface: LegacyBattleAISupport
      Sets whether this battle is currently running in the legacy AI simulation mode.
      Specified by:
      simulateMode in interface LegacyBattleAISupport
      Parameters:
      simulateMode - whether the battle should be treated as simulated by legacy AI logic
    • simulateStats

      public boolean simulateStats()
      Description copied from interface: LegacyBattleAISupport
      Returns whether the legacy AI should use simulated stat handling for this battle.

      This is an artifact of the older battle AI system. It is separate from the modern battle context simulation flag and does not represent a general-purpose battle state setting.

      Specified by:
      simulateStats in interface LegacyBattleAISupport
      Returns:
      true if legacy AI stat simulation handling is enabled; false otherwise
    • simulateStats

      public void simulateStats(boolean simulateStats)
      Description copied from interface: LegacyBattleAISupport
      Sets whether the legacy AI should use simulated stat handling for this battle.
      Specified by:
      simulateStats in interface LegacyBattleAISupport
      Parameters:
      simulateStats - whether legacy AI stat simulation handling should be enabled
    • addBattleAnimation

      public void addBattleAnimation(ActiveBattleAnimation animation)
      Description copied from interface: BattleController
      Stores a battle animation that is currently running for this battle.
      Specified by:
      addBattleAnimation in interface BattleController
      Parameters:
      animation - The animation to store
    • isBattleAnimationChannelBusy

      public boolean isBattleAnimationChannelBusy(String channel)
      Specified by:
      isBattleAnimationChannelBusy in interface BattleController
    • cleanUpBattleAnimationChannel

      public void cleanUpBattleAnimationChannel(String channel)
      Specified by:
      cleanUpBattleAnimationChannel in interface BattleController
    • acknowledgeBattleAnimation

      public void acknowledgeBattleAnimation(net.minecraft.server.level.ServerPlayer player, UUID acknowledgementId)
      Description copied from interface: BattleController
      Acknowledges completion of a client-side battle animation wait.
      Specified by:
      acknowledgeBattleAnimation in interface BattleController
      Parameters:
      player - the client that acknowledged the animation
      acknowledgementId - the acknowledgement token sent to the client
    • actionIndex

      public int actionIndex()
      Description copied from interface: BattleStateView
      Returns the current action index within the active turn.

      This is used while resolving turn actions to identify which action or Pokémon is currently being processed.

      Specified by:
      actionIndex in interface BattleStateView
      Returns:
      the current action index
    • battleIndex

      public int battleIndex()
      Description copied from interface: BattleStateView
      Returns this battle's index.
      Specified by:
      battleIndex in interface BattleStateView
      Returns:
      the battle index
    • battleIndex

      public void battleIndex(int battleIndex)
      Description copied from interface: BattleStateView
      Sets this battle's index.
      Specified by:
      battleIndex in interface BattleStateView
      Parameters:
      battleIndex - the battle index
    • battleAnimationChannelId

      public String battleAnimationChannelId()
      Specified by:
      battleAnimationChannelId in interface BattleController
    • battleAnimationChannelId

      public void battleAnimationChannelId(String battleAnimationChannelId)
      Specified by:
      battleAnimationChannelId in interface BattleController
    • turnList

      public List<PixelmonWrapper> turnList()
      Description copied from interface: BattleController
      This method returns the order of Pokémon moving during a battle turn.
      Specified by:
      turnList in interface BattleController
      Returns:
      The order of Pokémon moving during a battle turn.
    • turnList

      public void turnList(List<PixelmonWrapper> turnList)
      Description copied from interface: BattleController
      This method sets the order of Pokémon moving during a battle turn.
      Specified by:
      turnList in interface BattleController
      Parameters:
      turnList - The order of Pokémon moving during a battle turn.
    • hasSwitchedDuringThisMove

      public void hasSwitchedDuringThisMove(boolean hasSwitchedDuringThisMove)
      Description copied from interface: BattleController
      This method sets whether a Pokémon has switched due to a move during this move. This is used to prevent multiple Pokémon from switching out during one move, such as with moves like U-Turn or Volt Switch. Only one Pokémon may switch per move.
      Specified by:
      hasSwitchedDuringThisMove in interface BattleController
      Parameters:
      hasSwitchedDuringThisMove - If a Pokémon has switched due to a move during this move.
    • hasSwitchedDuringThisMove

      public boolean hasSwitchedDuringThisMove()
      Description copied from interface: BattleController
      This method returns if a Pokémon has switched due to a move during this move. This is used to prevent multiple Pokémon from switching out during one move, such as with moves like U-Turn or Volt Switch. Only one Pokémon may switch per move.
      Specified by:
      hasSwitchedDuringThisMove in interface BattleController
      Returns:
      If a Pokémon has switched due to a move during this move.
    • endPause

      public void endPause()
      Description copied from interface: BattleController
      Unpauses the battle.
      Specified by:
      endPause in interface BattleController
    • pauseBattle

      public void pauseBattle()
      Description copied from interface: BattleController
      Pauses the battle.
      Specified by:
      pauseBattle in interface BattleController
    • oldGen

      public Quadstate oldGen()
      Description copied from interface: BattleStateView
      Returns the old-generation rules state for this battle.
      Specified by:
      oldGen in interface BattleStateView
      Returns:
      the old-generation rules state
    • oldGen

      public void oldGen(Quadstate oldGen)
      Description copied from interface: BattleStateView
      Sets the old-generation rules state for this battle.
      Specified by:
      oldGen in interface BattleStateView
      Parameters:
      oldGen - the old-generation rules state
    • lastAttack

      public Attack lastAttack()
      Specified by:
      lastAttack in interface BattleController
    • lastAttack

      public void lastAttack(Attack attack)
      Specified by:
      lastAttack in interface BattleController
    • lastTempAttack

      public Attack lastTempAttack()
      Specified by:
      lastTempAttack in interface BattleController
    • lastTempAttack

      public void lastTempAttack(Attack attack)
      Specified by:
      lastTempAttack in interface BattleController
    • lastSimulatedAttack

      public Attack lastSimulatedAttack()
      Specified by:
      lastSimulatedAttack in interface BattleController
    • lastSimulatedAttack

      public void lastSimulatedAttack(Attack attack)
      Specified by:
      lastSimulatedAttack in interface BattleController
    • lastSimulatedTempAttack

      public Attack lastSimulatedTempAttack()
      Specified by:
      lastSimulatedTempAttack in interface BattleController
    • lastSimulatedTempAttack

      public void lastSimulatedTempAttack(Attack attack)
      Specified by:
      lastSimulatedTempAttack in interface BattleController
    • checkedPokemon

      public Set<Pokemon> checkedPokemon()
      Description copied from interface: BattleController
      This method returns a set of Pokémon that need to be evolved at the end of the turn. This is used to keep track of Pokémon that need to be evolved at the end of the turn after all actions have been resolved, so that they can be evolved before the next turn starts.
      Specified by:
      checkedPokemon in interface BattleController
      Returns:
      A set of Pokémon that need to be evolved at the end of the turn.
    • currentlyActingPokemon

      public PixelmonWrapper currentlyActingPokemon()
      Specified by:
      currentlyActingPokemon in interface BattleController
    • currentlyActingPokemon

      public void currentlyActingPokemon(PixelmonWrapper currentlyActingPokemon)
      Specified by:
      currentlyActingPokemon in interface BattleController