public class BattleController
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
boolean |
battleEnded
Whether the battle has ended.
|
int |
battleIndex
The battle's index in the battle registry.
|
BattleLog |
battleLog
The battle log for the battle.
|
protected int |
battleTicks
Controls when the battle state is checked.
|
int |
battleTurn
The number of turns the battle has lasted.
|
java.util.Set<Pokemon> |
checkedPokemon
The Pokemon that need to be evolved
|
protected java.util.List<AttackAnimation> |
currentAnimations |
protected boolean |
frozen |
protected java.util.List<FutureBattleTask<?,?>> |
futureTasks |
GlobalStatusController |
globalStatusController
Global conditions (e.g., weather) currently active in the battle.
|
Attack |
lastAttack
The most recent attack used during the battle.
|
Attack |
lastSimulatedAttack
The most recent attack used while simulating the battle.
|
Attack |
lastSimulatedTempAttack
The most recent temp attack while simulating the battle.
|
Attack |
lastTempAttack
The most recent temp attack used during the battle.
|
int |
numFainted
The number of fainted Pokémon ready to be switched out.
|
Quadstate |
oldGen
Whether the battle is old gen or not.
|
java.util.List<BattleParticipant> |
participants
The participants in the battle.
|
int |
playerNumber
The number of players in the battle.
|
BattleRules |
rules
The battle rules that are in effect for the battle.
|
boolean |
sendMessages
Whether to send battle messages to the participants.
|
boolean |
simulateMode
Whether simulate mode is turned on.
|
boolean |
simulateStats
Backup for simulateMode, which sometimes must be disabled while evaluating statuses and stat copying.
|
java.util.List<Spectator> |
spectators
Spectators of the battle
|
int |
turn
Turn counter for individual Pokémon moving within a battle turn.
|
java.util.List<PixelmonWrapper> |
turnList
The order of Pokémon moving during a battle turn.
|
boolean |
wasFishing
Whether the battle was started via fishing.
|
Constructor and Description |
---|
BattleController(BattleParticipant[] team1,
BattleParticipant[] team2,
BattleRules rules)
Sets up a battle with participants.
|
Modifier and Type | Method and Description |
---|---|
void |
addAnimation(AttackAnimation animation)
Stores an attack animation that is currently running for this battle.
|
<E extends BattleEvent,A> |
addFunctionAtEvent(java.lang.Class<E> eventClass,
java.util.function.BiFunction<E,BattleController,A> task)
Adds a task to the battle controller which will execute next time the given event fires and then be removed from
the list of future tasks.
|
<E extends BattleEvent> |
addPersistentTaskAtEvent(java.lang.Class<E> eventClass,
java.util.function.BiConsumer<E,BattleController> task)
Adds a task to the battle controller which will execute every time the given event fires.
|
void |
addSpectator(Spectator spectator)
Adds a spectator to the battle.
|
<E extends BattleEvent> |
addTaskAtEvent(java.lang.Class<E> eventClass,
java.util.function.BiConsumer<E,BattleController> task)
Adds a task to the battle controller which will execute next time the given event fires and then be removed from
the list of future tasks.
|
void |
checkDefeated(BattleParticipant p,
PixelmonWrapper poke)
Checks if a participant has been defeated.
|
void |
checkReviveSendOut(BattleParticipant p)
Checks if a Pokémon can be sent out after being revived.
|
boolean |
checkValid()
Checks whether the battle is in a valid state.
|
void |
clearHurtTimer()
Resets the hurt timers of all Pokémon in battle.
|
boolean |
containsParticipantType(java.lang.Class<? extends BattleParticipant> participantType) |
void |
doLater(java.lang.Runnable runnable,
int ticks) |
void |
enableReturnHeldItems(PixelmonWrapper attacker,
PixelmonWrapper target)
Enables returning held items for participants of the attacker and target of an action.
|
void |
endBattle()
Concludes the battle and determines a victor.
|
java.util.HashMap<BattleParticipant,BattleResults> |
endBattle(BattleEndCause cause)
Ends the battle with the given cause.
|
java.util.HashMap<BattleParticipant,BattleResults> |
endBattle(BattleEndCause cause,
java.util.HashMap<BattleParticipant,BattleResults> results)
Ends the battle with the given cause and any precalculated results.
|
void |
endBattleWithoutXP()
Concludes the battles and determines a victor.
|
void |
endPause()
Unpauses the battle.
|
void |
endTurn()
Handles end-of-turn effects.
|
void |
freeze()
Sets the battle into a frozen state - read
isFrozen() for why you might want to freeze
a battle |
java.util.Optional<Ability> |
getAbilityIfPresent(java.lang.Class<? extends AbstractAbility> abilityClass)
Gets an instance of an ability if it is present in the battle.
|
java.util.ArrayList<PixelmonWrapper> |
getActiveFaintedPokemon()
Returns all fainted Pokémon currently in battle.
|
java.util.ArrayList<PixelmonWrapper> |
getActivePokemon()
Returns all Pokémon currently in battle.
|
java.util.ArrayList<PixelmonWrapper> |
getActiveUnfaintedPokemon()
Returns all unfainted Pokémon currently in battle.
|
java.util.ArrayList<PixelmonWrapper> |
getAdjacentPokemon(PixelmonWrapper pokemon)
Gets all Pokémon in the battle adjacent to a certain Pokémon
|
java.util.ArrayList<PixelmonWrapper> |
getAdjacentPokemonAndSelf(PixelmonWrapper pokemon)
Gets all Pokémon in the battle adjacent to a certain Pokémon, including the target
|
ParticipantType[][] |
getBattleType(BattleParticipant teammate)
Gets the types of participants in the battle.
|
java.util.List<PixelmonWrapper> |
getDefaultTurnOrder()
Gets the turn order of Pokémon in the battle without accounting for priority.
|
PixelmonWrapper |
getFirstMover(java.util.ArrayList<PixelmonWrapper> pokemonList)
Gets the first Pokémon to move in the turn order from the given list.
|
PixelmonWrapper |
getFirstMover(PixelmonWrapper... pokemonList)
Gets the first Pokémon to move in the turn order from the given list.
|
Attack |
getLastAttack() |
PixelmonWrapper |
getLastMover(java.util.ArrayList<PixelmonWrapper> pokemonList)
Gets the last Pokémon to move in the turn order from the given list.
|
PixelmonWrapper |
getLastMover(PixelmonWrapper... pokemonList)
Gets the last Pokémon to move in the turn order from the given list.
|
Attack |
getLastTempAttack() |
java.util.ArrayList<PixelmonWrapper> |
getOpponentPokemon(BattleParticipant participant)
Returns all Pokemon on the opposite side of the battle that the specified participant is on.
|
java.util.ArrayList<PixelmonWrapper> |
getOpponentPokemon(PixelmonWrapper pw)
Returns all Pokemon on the opposite side of the battle that the specified Pokemon is on.
|
java.util.ArrayList<BattleParticipant> |
getOpponents(BattleParticipant participant)
Finds the participants on the opposing side of the battle.
|
PixelmonWrapper |
getOppositePokemon(PixelmonWrapper pw)
Finds the Pokémon directly opposite of the specified Pokémon.
|
BattleParticipant |
getParticipantForEntity(net.minecraft.entity.LivingEntity entity)
Finds the battle participant from the specified entity.
|
PlayerParticipant |
getPlayer(net.minecraft.entity.player.PlayerEntity player)
Gets a player in the battle.
|
PlayerParticipant |
getPlayer(java.lang.String name)
Gets a player in the battle.
|
java.util.List<net.minecraft.entity.player.ServerPlayerEntity> |
getPlayerEntities()
Returns a list of the player entities in the battle
|
java.util.List<PlayerParticipant> |
getPlayers()
Returns a list of player participants in the battle.
|
java.util.ArrayList<Spectator> |
getPlayerSpectators(PlayerParticipant player)
Gets the spectators that are watching a particular player.
|
PixelmonWrapper |
getPokemonAtPosition(int position)
Returns the Pokémon at the specified position in the battle.
|
PixelmonWrapper |
getPokemonFromUUID(java.util.UUID uuid)
Gets a Pokémon in the battle from its UUID.
|
int |
getPositionOfPokemon(PixelmonWrapper poke)
Returns the position of the specified Pokémon in battle.
|
int |
getPositionOfPokemon(PixelmonWrapper poke,
BattleParticipant bp)
Returns the position of a certain Pokémon in a participant's lineup.
|
BattleStage |
getStage()
Returns the current stage of the battle.
|
java.util.ArrayList<BattleParticipant> |
getTeam(BattleParticipant participant)
Finds the participants on the same side of the battle.
|
java.util.ArrayList<PixelmonWrapper> |
getTeamPokemon(BattleParticipant participant)
Returns all Pokemon on the side of the battle that the specified participant is on.
|
java.util.ArrayList<PixelmonWrapper> |
getTeamPokemon(PixelmonEntity pokemon)
Returns all allied Pokemon on the side of the battle that the specified Pokémon is on.
|
java.util.ArrayList<PixelmonWrapper> |
getTeamPokemon(PixelmonWrapper pokemon)
Returns all allied Pokemon on the side of the battle that the specified Pokémon is on.
|
java.util.ArrayList<PixelmonWrapper> |
getTeamPokemonExcludeSelf(PixelmonWrapper pokemon)
Returns all allied Pokémon on the side of the battle that the specified Pokémon is on, except for the specified
Pokémon itself.
|
int |
getTurn(PixelmonWrapper pixelmonWrapper)
Gets the ID of the turn for the pokemon
|
int |
getTurnForPokemon(PixelmonWrapper pokemon)
Gets the position of the specified Pokémon in the turn order.
|
boolean |
hasSpectator(net.minecraft.entity.player.PlayerEntity player)
Checks if the battle has a certain player spectating it.
|
protected void |
initBattle()
Initiates the battle.
|
boolean |
isFrozen()
If the battle is in a frozen state
When the battle is frozen this means that turns will not be taken, and attacks or moves will not be taken.
|
boolean |
isInBattle(PixelmonWrapper pokemon)
Checks if a Pokémon is currently in the battle.
|
boolean |
isLastMover()
Checks whether the current Pokémon is the last Pokémon in turn order.
|
boolean |
isLevelingDisabled()
Checks if any settings disable Pokémon from leveling up in the battle.
|
boolean |
isOneAlive(java.util.List<PixelmonWrapper> teamPokemon)
Checks whether there is a non-fainted Pokémon among the given Pokémon list.
|
boolean |
isPvP()
Determines whether the battle is between players.
|
boolean |
isRaid() |
boolean |
isSimulation() |
boolean |
isTeamDefeated(BattleParticipant participant)
Checks if the participant's team has been defeated.
|
boolean |
isWaiting()
Determines whether a battle participant is waiting.
|
void |
modifyStats()
Modifies Pokémon stats during a turn.
|
void |
modifyStats(PixelmonWrapper pw)
Call every version of the modifyStats function, using the Pokémon's base stats.
|
void |
modifyStats(PixelmonWrapper pw,
int[] stats)
Call every version of the modifyStats function, using the given stats.
|
void |
modifyStatsCancellable(PixelmonWrapper attacker)
Modifies Pokémon stats during a turn after deciding which Pokémon gets to make a move.
|
BattleParticipant |
otherParticipant(BattleParticipant participant)
Get the other participant in the battle.
|
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.
|
void |
pauseBattle()
Pauses the battle.
|
void |
removeFromTurnList(PixelmonWrapper pw)
Removes a Pokémon from the turn list if the Pokémon has not made a move yet.
|
boolean |
removeSpectator(net.minecraft.entity.player.ServerPlayerEntity player)
Removes a spectator from the battle.
|
void |
removeSpectator(Spectator spectator)
Removes a spectator from the battle.
|
void |
reviveAfterDefeat(BattleParticipant p) |
void |
sendDamagePacket(PixelmonWrapper target,
int damage)
Sends a damage packet to the participant clients.
|
void |
sendHealPacket(PixelmonWrapper target,
int amount)
Sends a healing packet to the participant clients.
|
void |
sendSwitchPacket(java.util.UUID oldUUID,
PixelmonWrapper newPokemon)
Updates all clients with a Pokémon switch.
|
void |
sendToAll(java.lang.String string,
java.lang.Object... data)
Sends a battle message to all participants in the battle.
|
void |
sendToAll(net.minecraft.util.text.TranslationTextComponent message)
Sends a battle message to all participants in the battle.
|
void |
sendToOthers(java.lang.String string,
BattleParticipant battleParticipant,
java.lang.Object... data)
Sends a battle message to all participants besides the given participant.
|
void |
sendToPlayer(net.minecraft.entity.player.PlayerEntity player,
java.lang.String string,
java.lang.Object... data)
Sends a battle message to a player.
|
void |
sendToPlayer(net.minecraft.entity.player.PlayerEntity player,
net.minecraft.util.text.TranslationTextComponent message)
Sends a battle message to a player.
|
void |
sendToPlayers(PixelmonPacket message) |
void |
setAllReady()
Sets all players as ready.
|
void |
setFlee(java.util.UUID fleeingUUID)
Sets a Pokémon to flee in the turn.
|
boolean |
setOverworldWeatherAsBattleWeatherDuringBattle()
This function first checks if there is no weather (i.e.
|
void |
setUseItem(java.util.UUID pokemonUUID,
net.minecraft.entity.player.PlayerEntity user,
net.minecraft.item.ItemStack usedStack,
int additionalInfo)
Sets an item that the player will use during the turn.
|
void |
setUseItem(java.util.UUID pokemonUUID,
net.minecraft.entity.player.PlayerEntity player,
net.minecraft.item.ItemStack usedStack,
java.util.UUID targetPokemonUUID)
Sets an item that the player will use during the turn.
|
void |
switchPokemon(java.util.UUID switchingPokemonUUID,
java.util.UUID newPokemonUUID,
boolean switchInstantly)
Switches a Pokémon out for a different one.
|
boolean |
tryFlee(PixelmonWrapper p)
Checks whether the specified Pokémon will try to flee.
|
boolean |
tryFlee(PixelmonWrapper p,
boolean turnEnd)
Checks if the given Pokemon will try to flee.
|
void |
unfreeze()
Un-freezes the battle - read
isFrozen() for why you might want to freeze a battle |
void |
update()
Updates the battle every tick.
|
void |
updateFormChange(PixelmonEntity pokemon)
Updates the battle GUI when a Pokémon changes form.
|
void |
updateFormChange(PixelmonWrapper pokemon)
Updates the battle GUI when a Pokémon changes form.
|
void |
updatePokemonHealth()
Update Pokémon's health.
|
void |
updateRemovedPokemon(PixelmonWrapper poke)
Updates players when a Pokémon is removed from battle and not replaced.
|
void |
updateTurnZero()
Updates the battle every tick.
|
public java.util.List<BattleParticipant> participants
public GlobalStatusController globalStatusController
public java.util.List<Spectator> spectators
protected int battleTicks
public int battleTurn
public int playerNumber
public boolean battleEnded
public int battleIndex
public BattleLog battleLog
public Attack lastAttack
public Attack lastSimulatedAttack
public Attack lastTempAttack
public Attack lastSimulatedTempAttack
public int numFainted
public BattleRules rules
public boolean simulateMode
public boolean simulateStats
public boolean sendMessages
public boolean wasFishing
public Quadstate oldGen
protected java.util.List<AttackAnimation> currentAnimations
public java.util.Set<Pokemon> checkedPokemon
protected boolean frozen
protected final java.util.List<FutureBattleTask<?,?>> futureTasks
public int turn
public java.util.List<PixelmonWrapper> turnList
public BattleController(BattleParticipant[] team1, BattleParticipant[] team2, BattleRules rules)
team1
- One side of the battle.team2
- The other side of the battle.rules
- The rules of the battle.protected void initBattle() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- If any participants have invalid pokemon this will get thro0wnpublic void doLater(java.lang.Runnable runnable, int ticks)
public void update()
public void updateTurnZero()
public void modifyStats()
public void modifyStats(PixelmonWrapper pw)
pw
- The Pokémon whose stats are being modified.public void modifyStats(PixelmonWrapper pw, int[] stats)
pw
- The Pokémon whose stats are being modified.public void modifyStatsCancellable(PixelmonWrapper attacker)
attacker
- The Pokémon using a move.public void participantReady(PlayerParticipant p)
p
- The player.public void setAllReady()
public void endTurn()
public void checkReviveSendOut(BattleParticipant p)
p
- The participant to check for sending out a revived Pokémon.public void reviveAfterDefeat(BattleParticipant p)
public java.util.HashMap<BattleParticipant,BattleResults> endBattle(BattleEndCause cause)
public java.util.HashMap<BattleParticipant,BattleResults> endBattle(BattleEndCause cause, java.util.HashMap<BattleParticipant,BattleResults> results)
public void endBattle()
public void endBattleWithoutXP()
public boolean isPvP()
public void pauseBattle()
public boolean isWaiting()
public void endPause()
public boolean tryFlee(PixelmonWrapper p)
p
- The Pokémon to check.public boolean tryFlee(PixelmonWrapper p, boolean turnEnd)
p
- The pokemon being checkedturnEnd
- If it's turn end (i.e. don't look back to see if they've already had their turn)public void updateRemovedPokemon(PixelmonWrapper poke)
poke
- The Pokémon to remove.public boolean isOneAlive(java.util.List<PixelmonWrapper> teamPokemon)
teamPokemon
- The list of Pokémon to check.public void checkDefeated(BattleParticipant p, PixelmonWrapper poke)
p
- The participant to check.poke
- The Pokémon that just fainted.public void sendToAll(java.lang.String string, java.lang.Object... data)
string
- The lang string to be translated.data
- Any parameters for the lang string.public void sendToAll(net.minecraft.util.text.TranslationTextComponent message)
message
- The message to send.public void sendToOthers(java.lang.String string, BattleParticipant battleParticipant, java.lang.Object... data)
string
- The lang string to be translated.battleParticipant
- The participant to exclude when sending the message.data
- Any parameters for the lang string.public void sendToPlayer(net.minecraft.entity.player.PlayerEntity player, java.lang.String string, java.lang.Object... data)
player
- The player to send the message to.string
- The lang string to be translated.data
- Any parameters for the lang string.public void sendToPlayer(net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.text.TranslationTextComponent message)
player
- The player to send the message to.message
- The message to send.public void sendToPlayers(PixelmonPacket message)
public void clearHurtTimer()
public void setUseItem(java.util.UUID pokemonUUID, net.minecraft.entity.player.PlayerEntity user, net.minecraft.item.ItemStack usedStack, int additionalInfo)
pokemonUUID
- The Pokémon the item is used on.user
- The player using the item.usedStack
- The item being used.additionalInfo
- An additional argument for the item being used.public void setUseItem(java.util.UUID pokemonUUID, net.minecraft.entity.player.PlayerEntity player, net.minecraft.item.ItemStack usedStack, java.util.UUID targetPokemonUUID)
pokemonUUID
- The Pokémon the player currently has in battle.player
- The player using the item.usedStack
- The item being used.targetPokemonUUID
- The Pokémon the item is being used on.public void switchPokemon(java.util.UUID switchingPokemonUUID, java.util.UUID newPokemonUUID, boolean switchInstantly)
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.public void setFlee(java.util.UUID fleeingUUID)
fleeingUUID
- The fleeing Pokémon.public ParticipantType[][] getBattleType(BattleParticipant teammate)
teammate
- The participant whose side will be listed first in the returned 2D array.public void updatePokemonHealth()
public java.util.ArrayList<BattleParticipant> getOpponents(BattleParticipant participant)
participant
- The participant to find opponents for.public java.util.ArrayList<BattleParticipant> getTeam(BattleParticipant participant)
participant
- The participant to find teammates for.public java.util.ArrayList<PixelmonWrapper> getActivePokemon()
public java.util.ArrayList<PixelmonWrapper> getActiveUnfaintedPokemon()
public java.util.ArrayList<PixelmonWrapper> getActiveFaintedPokemon()
public java.util.ArrayList<PixelmonWrapper> getAdjacentPokemon(PixelmonWrapper pokemon)
pokemon
- The Pokémon to get adjacent Pokémon for.public java.util.ArrayList<PixelmonWrapper> getAdjacentPokemonAndSelf(PixelmonWrapper pokemon)
pokemon
- The Pokémon to get adjacent Pokémon for.public java.util.ArrayList<PixelmonWrapper> getTeamPokemon(BattleParticipant participant)
participant
- The participant to find team Pokemon for.public java.util.ArrayList<PixelmonWrapper> getTeamPokemon(PixelmonWrapper pokemon)
pokemon
- The Pokémon to find allied Pokemon for.public java.util.ArrayList<PixelmonWrapper> getTeamPokemon(PixelmonEntity pokemon)
pokemon
- The Pokémon to find allied Pokemon for.public java.util.ArrayList<PixelmonWrapper> getTeamPokemonExcludeSelf(PixelmonWrapper pokemon)
pokemon
- The Pokémon to find allied Pokemon for.public java.util.ArrayList<PixelmonWrapper> getOpponentPokemon(BattleParticipant participant)
participant
- The participant to find opponent Pokemon for.public java.util.ArrayList<PixelmonWrapper> getOpponentPokemon(PixelmonWrapper pw)
pw
- The Pokemon to find opponent Pokemon for.public boolean isInBattle(PixelmonWrapper pokemon)
pokemon
- The Pokémon to find.public BattleParticipant getParticipantForEntity(net.minecraft.entity.LivingEntity entity)
entity
- The entity to find the battle participant for.public void sendDamagePacket(PixelmonWrapper target, int damage)
target
- The Pokémon being damaged.damage
- The amount of damage dealt.public void sendHealPacket(PixelmonWrapper target, int amount)
target
- The Pokémon being healed.amount
- The amount of healing.@Nullable public PixelmonWrapper getOppositePokemon(PixelmonWrapper pw)
pw
- The Pokémon to get the opposite Pokémon for.public PixelmonWrapper getPokemonAtPosition(int position)
position
- The position to get the Pokémon from.public int getPositionOfPokemon(PixelmonWrapper poke)
poke
- The Pokémon to get the position of.public int getPositionOfPokemon(PixelmonWrapper poke, BattleParticipant bp)
poke
- The Pokémon to get the position of.bp
- The participant with the Pokémon.public BattleStage getStage()
public void enableReturnHeldItems(PixelmonWrapper attacker, PixelmonWrapper target)
attacker
- The action's user.target
- The action's target.public boolean checkValid()
public PlayerParticipant getPlayer(java.lang.String name)
name
- The name of the player to look for.public PlayerParticipant getPlayer(net.minecraft.entity.player.PlayerEntity player)
player
- The player to look for.public java.util.List<PlayerParticipant> getPlayers()
public java.util.List<net.minecraft.entity.player.ServerPlayerEntity> getPlayerEntities()
public boolean isTeamDefeated(BattleParticipant participant)
participant
- The participant whose team to check.public int getTurnForPokemon(PixelmonWrapper pokemon)
pokemon
- The Pokémon to find the turn for.public BattleParticipant otherParticipant(BattleParticipant participant)
participant
- Your participant Object to get the other participant from.public PixelmonWrapper getFirstMover(PixelmonWrapper... pokemonList)
pokemonList
- A list of Pokémon to get the first mover from.public PixelmonWrapper getFirstMover(java.util.ArrayList<PixelmonWrapper> pokemonList)
pokemonList
- A list of Pokémon to get the first mover from.public PixelmonWrapper getLastMover(PixelmonWrapper... pokemonList)
pokemonList
- A list of Pokémon to get the first mover from.public PixelmonWrapper getLastMover(java.util.ArrayList<PixelmonWrapper> pokemonList)
pokemonList
- A list of Pokémon to get the first mover from.public java.util.Optional<Ability> getAbilityIfPresent(java.lang.Class<? extends AbstractAbility> abilityClass)
public void sendSwitchPacket(java.util.UUID oldUUID, PixelmonWrapper newPokemon)
oldUUID
- The ID of the Pokémon switching out.newPokemon
- The Pokémon switching in.public void addSpectator(Spectator spectator)
spectator
- The spectator to add to the battle.public void removeSpectator(Spectator spectator)
spectator
- The spectator to remove from the battle.public boolean hasSpectator(net.minecraft.entity.player.PlayerEntity player)
player
- The player to look for.public boolean removeSpectator(net.minecraft.entity.player.ServerPlayerEntity player)
player
- The spectator to remove from the battle.public java.util.ArrayList<Spectator> getPlayerSpectators(PlayerParticipant player)
player
- The player to get spectators for.public PixelmonWrapper getPokemonFromUUID(java.util.UUID uuid)
uuid
- The UUID of the Pokémon to get.public java.util.List<PixelmonWrapper> getDefaultTurnOrder()
public void removeFromTurnList(PixelmonWrapper pw)
pw
- The Pokémon to remove.public int getTurn(PixelmonWrapper pixelmonWrapper)
pixelmonWrapper
- The pokemonpublic boolean isLastMover()
public boolean containsParticipantType(java.lang.Class<? extends BattleParticipant> participantType)
public void updateFormChange(PixelmonEntity pokemon)
pokemon
- The Pokémon who changed form.public void updateFormChange(PixelmonWrapper pokemon)
pokemon
- The Pokémon who changed form.public boolean isLevelingDisabled()
public boolean isRaid()
public boolean isSimulation()
public Attack getLastAttack()
public Attack getLastTempAttack()
public boolean setOverworldWeatherAsBattleWeatherDuringBattle()
public <E extends BattleEvent,A> java.util.concurrent.CompletableFuture<A> addFunctionAtEvent(java.lang.Class<E> eventClass, java.util.function.BiFunction<E,BattleController,A> task)
E
- The battle event typeeventClass
- The class of the event to wait fortask
- The task to execute when the event occurspublic <E extends BattleEvent> java.util.concurrent.CompletableFuture<java.lang.Void> addTaskAtEvent(java.lang.Class<E> eventClass, java.util.function.BiConsumer<E,BattleController> task)
E
- The battle event typeeventClass
- The class of the event to wait fortask
- The task to execute when the event occurspublic <E extends BattleEvent> void addPersistentTaskAtEvent(java.lang.Class<E> eventClass, java.util.function.BiConsumer<E,BattleController> task)
E
- The event typeeventClass
- The class of the event being waited fortask
- The task that will executepublic boolean isFrozen()
public void freeze()
isFrozen()
for why you might want to freeze
a battlepublic void unfreeze()
isFrozen()
for why you might want to freeze a battlepublic void addAnimation(AttackAnimation animation)
animation
- The animation to store