Interface BattleSimulationContext
- All Superinterfaces:
BattleStateView,ContextHolder
- All Known Subinterfaces:
BattleController,BattleMessaging
- All Known Implementing Classes:
MultiLaneBattleController,StandardBattleController
This interface groups together battle settings that affect whether the battle should behave like a live in-world battle or a controlled/simulated battle. Simulation contexts are used by tests, AI evaluation, copied battle states, and other systems that need to inspect or resolve battle behaviour without applying all normal live-battle side effects.
This interface does not guarantee that the battle is immutable. It only describes simulation-related controls and convenience checks exposed by a battle state view.
-
Method Summary
Modifier and TypeMethodDescriptioncopy()Creates a copy of this battle controller.default booleanReturns whether battle communication should be disabled.default voidfreeze()Freezes this battle.default booleanisFrozen()Returns whether this battle is currently frozen.default booleanReturns whether Pokémon leveling should be disabled for this battle.default booleanReturns whether this battle is marked as a simulated battle.default booleanReturns whether Pokémon entities should be spawned for this battle.default voidunfreeze()Unfreezes this battle.intReturns the number of battle ticks this battle must wait before normal turn progression can continue.voidwaitTicks(int waitTicks) Sets the number of battle ticks this battle must wait before normal turn progression can continue.Methods inherited from interface com.pixelmonmod.pixelmon.battles.controller.BattleStateView
actionIndex, battleEnded, battleIndex, battleIndex, battleLog, battleTicks, battleTicksPerSecond, battleTurn, containsParticipantType, getActiveFaintedPokemon, getActivePokemon, getActiveUnfaintedPokemon, getBattleType, getParticipantForEntity, getParticipantFromPokemon, getParticipants, getPartyPokemonFromUUID, getPlayer, getPlayer, getPlayerEntities, getPlayers, getPokemonFromUUID, getStage, globalStatusController, isInverseBattle, isPvE, isPvP, isRaid, isTeamDefeated, isTeamHomogeneous, isWaiting, oldGen, oldGen, onBattlefield, otherParticipant, outcome, participants, playerCount, team, teams, timeElapsedMethods inherited from interface com.pixelmonmod.pixelmon.battles.controller.context.ContextHolder
get, getContext, getOrDefault, has, remove, set, update
-
Method Details
-
copy
BattleController copy()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
BattleControllerimplementation.- Returns:
- a copied battle controller
-
waitTicks
int waitTicks()Returns the number of battle ticks this battle must wait before normal turn progression can continue.- Returns:
- remaining wait ticks
-
waitTicks
void waitTicks(int waitTicks) Sets the number of battle ticks this battle must wait before normal turn progression can continue.- Parameters:
waitTicks- remaining wait ticks
-
isSimulatedBattle
default boolean isSimulatedBattle()Returns whether this battle is marked as a simulated battle.The simulation flag is stored in the battle context using
ContextKeys.SIMULATION. Simulated battles are generally used for tests, AI lookahead, or copied battle states and should avoid live-world side effects such as spawning entities, sending battle communication, or awarding normal battle progression effects where applicable.- Returns:
trueif this battle is simulated;falseotherwise
-
disableCommunication
default boolean disableCommunication()Returns whether battle communication should be disabled.Communication is disabled when explicitly requested through
ContextKeys.DISABLE_COMMUNICATION, or when the battle is simulated. This is used to prevent battle packets and messages from being sent to clients for copied battles, tests, AI simulations, or other silent battle contexts.- Returns:
trueif battle communication should be disabled;falseotherwise
-
shouldSpawnEntities
default boolean shouldSpawnEntities()Returns whether Pokémon entities should be spawned for this battle.Entities are spawned by default, but can be disabled through
ContextKeys.SPAWN_ENTITIES. Entities are also disabled for simulated battles so copied or test battles do not create live world entities.- Returns:
trueif battle entities should be spawned;falseotherwise
-
isLevelingDisabled
default boolean isLevelingDisabled()Returns whether Pokémon leveling should be disabled for this battle.Leveling is disabled when the relevant Pixelmon battle configuration disallows experience for the battle type, when Pokémon have been raised to a temporary cap, when the battle is simulated, or when explicitly disabled through
ContextKeys.DISABLE_LEVELLING.PvP experience is controlled by
PixelmonConfigProxy.getBattle().isAllowPVPExperience(). Trainer battle experience is controlled byPixelmonConfigProxy.getBattle().isAllowTrainerExperience().- Returns:
trueif leveling should be disabled;falseotherwise
-
isFrozen
default boolean isFrozen()Returns whether this battle is currently frozen.A frozen battle does not progress through normal turn handling. Battles with pending wait ticks are also considered frozen until those ticks have elapsed. This is primarily useful for tests or controlled battle scenarios where code needs to inspect or manipulate battle state without the regular update loop advancing the battle.
- Returns:
trueif the battle is frozen;falseotherwise
-
freeze
default void freeze()Freezes this battle.While frozen, the battle should not progress through normal turn handling. This is mainly intended for tests and controlled battle scenarios.
-
unfreeze
default void unfreeze()Unfreezes this battle.After unfreezing, the battle may continue progressing through its normal update and turn handling.
-