Class LogBattleParticipant
java.lang.Object
com.pixelmonmod.pixelmon.battles.controller.participants.BattleParticipant
com.pixelmonmod.pixelmon.battles.controller.participants.LogBattleParticipant
- All Implemented Interfaces:
BattleViewer
-
Field Summary
FieldsFields inherited from class com.pixelmonmod.pixelmon.battles.controller.participants.BattleParticipant
allPokemon, ashNinja, bc, controlledPokemon, dynamax, entity, evolution, isDefeated, lastFailedCapture, lastFaintedTurn, lastMoveTime, numControlledPokemon, switchingIn, switchingOut, team, totalFainted, ultraBurst, usedZ, wait
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Adds a Pokémon to the list of Pokémon switching out.boolean
Checks if the participant is allowed to Dynamax Pokémon.boolean
Checks if the participant is allowed to Mega Evolve Pokémon.void
checkAndHandleBossTier
(PixelmonWrapper wrapper) Checks if the participant is a boss and then applies the boss tier logic to the provided wrapper.boolean
Checks if the participant's Pokémon are in a valid state.protected void
void
Resets turn-specific variables for the participant's Pokémon.int
Calculated number of unfainted Pokémon in the entire team.int
Counts the number of fainted Pokémon in the participant's party.float
Counts the percentage of health remaining in the participant's party.int
countPartyPokemon
(Predicate<PixelmonWrapper> predicate) Counts the number of Pokémon in the participant's party that match the provided predicate.void
endBattle
(BattleEndCause cause) Ends the battle the participant is in.void
enforcedSwitch
(PixelmonWrapper itemHolder) boolean
Returns whether one of the participant's pokemon fainted last turn.Returns all active, unfainted Pokémon that the participant is controlling.Finds the participants on the allied side of the battle.Gets data about the player's allied Pokémon.net.minecraft.network.chat.MutableComponent
Returns the name of the entity the participant is representing.@Nullable net.minecraft.world.entity.Entity
Gets the entity that this participant is representing.Gets the first fainted Pokémon in the participant's party.int
Gets the highest level of the participant's Pokémon.protected int
Gets the level cap for the participant.getMove
(PixelmonWrapper pokemon) Gets the move to be used by the specified Pokémon.net.minecraft.network.chat.Component
getName()
Gets the name of the participant.void
getNextPokemon
(int position) Sends out the next unfainted Pokémon in the participant's party.Returns all Pokemon on the opposite side of the battle that the participant is on.Finds the participants on the opposing side of the battle.getPartyPokemonFromUUID
(UUID uuid) Gets a Pokémon from its UUID.int
getPartyPosition
(PixelmonWrapper pokemon) Gets the base position of the Pokémon in the participant's party.getPokemonFromParty
(UUID uuid) Gets the Pokémon from the participant's party who matches the given Pokémon UUID.getPokemonFromUUID
(UUID uuid) Gets a controlled Pokémon from its UUID.Gets a random Pokémon from the participant's party that isn't already sent out.Returns the Pokémon storage of the participant.Returns all Pokemon on the side of the battle that the participant is on.Finds all Pokémon in the battle allied with the player.int
Returns the number of Pokémon that have fainted for this participant this battle.long
Gets the time since the participant last made a move.Gets the UUID of the participant.boolean
getWait()
Checks if the participant is waiting in battle.net.minecraft.world.level.Level
getWorld()
Gets the world that the participant is in.boolean
Checks if the participant has Pokémon that can battleboolean
For use with switching in new Pokémon.boolean
Checks if the participant has unfainted Pokémon remaining.void
Increments the number of fainted pokemon.protected boolean
protected void
loadParty
(PartyStorage party) Loads all Pokémon in the participant's party.protected void
Loads all Pokémon in the participant's party.protected void
loadSingle
(Pokemon pokemon) Loads just one Pokémon in the participant's party.boolean
onAddStatus
(BattleController bc, PixelmonWrapper user, PixelmonWrapper target, StatusBase status) void
float
onHit
(PixelmonWrapper source, float damage, DamageTypeEnum damageType) void
void
boolean
boolean
onTargeted
(PixelmonWrapper user, Attack attack) boolean
boolean
onUseAttackOther
(BattleController bc, Attack attack, BattleParticipant bp, PixelmonWrapper user) void
void
Adds the participant to a battle.protected void
releasePokemon
(PixelmonWrapper pixelmonWrapper) Attempts to spawn the entity for the provided wrapper.void
Resets the timer for the participant making a move.void
If a player/trainer is riding their Pokémon and gets in a battle while riding it, they shouldn't be knocked off their Pokémon.void
revivePokemon
(float healthPercentage) protected void
revivePokemon
(PixelmonWrapper pokemon, float healthPercentage) void
Chooses an action for the participant's Pokémon.void
sendBattleMessage
(String message) void
sendBattleMessage
(String message, Object... args) Sends a battle message to this participant.void
sendBattleMessage
(net.minecraft.network.chat.Component component) Sends a battle message to this participant.void
sendDamagePacket
(PixelmonWrapper user, int damage) Updates the client when a Pokémon takes damage.void
sendHealPacket
(PixelmonWrapper target, int amount) Updates the client when a Pokémon heals.void
sendPacket
(PixelmonPacket message) Sends a packet to this participant, wont do anything if its not a player.void
void
setWait
(boolean wait) void
void
Switches out all fainted Pokémon for their replacements.switchPokemon
(PixelmonWrapper pw, UUID newPixelmonUUID) Switches the participant's Pokémon for another one.void
tick()
Updates the participant every tick.void
Updates the opponent's Pokémon client-side.void
boolean
waiting()
Methods inherited from class com.pixelmonmod.pixelmon.battles.controller.participants.BattleParticipant
canSwitch, getPrizeMoneyMultiplier, givePlayerExperience, hasExpAll, isPlayer, isRaid, isTrainer, isWild
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.pixelmonmod.pixelmon.battles.controller.BattleViewer
getPlayer
-
Field Details
-
original
-
-
Constructor Details
-
LogBattleParticipant
-
-
Method Details
-
sendDamagePacket
Description copied from class:BattleParticipant
Updates the client when a Pokémon takes damage.- Specified by:
sendDamagePacket
in interfaceBattleViewer
- Overrides:
sendDamagePacket
in classBattleParticipant
- Parameters:
user
- The Pokémon who took damage.damage
- The amount of damage dealt.
-
sendHealPacket
Description copied from class:BattleParticipant
Updates the client when a Pokémon heals.- Specified by:
sendHealPacket
in interfaceBattleViewer
- Overrides:
sendHealPacket
in classBattleParticipant
- Parameters:
target
- The Pokémon who healed.amount
- The amount of hp healed.
-
startBattle
public void startBattle()- Overrides:
startBattle
in classBattleParticipant
-
preBattleChecks
public void preBattleChecks()Description copied from class:BattleParticipant
Adds the participant to a battle.- Overrides:
preBattleChecks
in classBattleParticipant
-
endBattle
Description copied from class:BattleParticipant
Ends the battle the participant is in.- Specified by:
endBattle
in classBattleParticipant
-
getNextPokemon
public void getNextPokemon(int position) Description copied from class:BattleParticipant
Sends out the next unfainted Pokémon in the participant's party.- Overrides:
getNextPokemon
in classBattleParticipant
- Parameters:
position
- The position to send out the Pokémon at.
-
selectAction
public void selectAction()Description copied from class:BattleParticipant
Chooses an action for the participant's Pokémon.- Overrides:
selectAction
in classBattleParticipant
-
getMove
Description copied from class:BattleParticipant
Gets the move to be used by the specified Pokémon.- Overrides:
getMove
in classBattleParticipant
- Parameters:
pokemon
- The Pokémon to get a move for.- Returns:
- The move to be used by the specified Pokémon.
-
updateBattlingPokemon
public void updateBattlingPokemon()Description copied from class:BattleParticipant
Updates the opponent's Pokémon client-side.- Overrides:
updateBattlingPokemon
in classBattleParticipant
-
tick
public void tick()Description copied from class:BattleParticipant
Updates the participant every tick.- Overrides:
tick
in classBattleParticipant
-
getDisplayName
public net.minecraft.network.chat.MutableComponent getDisplayName()Description copied from class:BattleParticipant
Returns the name of the entity the participant is representing.- Overrides:
getDisplayName
in classBattleParticipant
- Returns:
- The name of the entity the participant is representing.
-
getStorage
Description copied from class:BattleParticipant
Returns the Pokémon storage of the participant.- Overrides:
getStorage
in classBattleParticipant
- Returns:
- The Pokémon storage of the participant.
-
canMegaEvolve
public boolean canMegaEvolve()Description copied from class:BattleParticipant
Checks if the participant is allowed to Mega Evolve Pokémon.- Overrides:
canMegaEvolve
in classBattleParticipant
- Returns:
- Whether the participant is allowed to Mega Evolve Pokémon.
-
canDynamax
public boolean canDynamax()Description copied from class:BattleParticipant
Checks if the participant is allowed to Dynamax Pokémon.- Overrides:
canDynamax
in classBattleParticipant
- Returns:
- Whether the participant is allowed to Dynamax Pokémon.
-
revivePokemon
public void revivePokemon(float healthPercentage) - Overrides:
revivePokemon
in classBattleParticipant
-
sendPacket
Description copied from class:BattleParticipant
Sends a packet to this participant, wont do anything if its not a player.- Specified by:
sendPacket
in interfaceBattleViewer
- Overrides:
sendPacket
in classBattleParticipant
- Parameters:
message
- The packet to send to this player
-
sendBattleMessage
public void sendBattleMessage(net.minecraft.network.chat.Component component) Description copied from class:BattleParticipant
Sends a battle message to this participant.- Specified by:
sendBattleMessage
in interfaceBattleViewer
- Overrides:
sendBattleMessage
in classBattleParticipant
- Parameters:
component
- The message to send.
-
enforcedSwitch
- Overrides:
enforcedSwitch
in classBattleParticipant
-
resetMoveTimer
public void resetMoveTimer()Description copied from class:BattleParticipant
Resets the timer for the participant making a move.- Overrides:
resetMoveTimer
in classBattleParticipant
-
getTurnTimeSeconds
public long getTurnTimeSeconds()Description copied from class:BattleParticipant
Gets the time since the participant last made a move.- Overrides:
getTurnTimeSeconds
in classBattleParticipant
- Returns:
- The time since the participant last made a move.
-
waiting
public boolean waiting()- Overrides:
waiting
in classBattleParticipant
-
setWait
public void setWait(boolean wait) - Overrides:
setWait
in classBattleParticipant
-
clearMovement
- Overrides:
clearMovement
in classBattleParticipant
-
getUniqueId
Description copied from class:BattleParticipant
Gets the UUID of the participant.- Overrides:
getUniqueId
in classBattleParticipant
- Returns:
- The UUID of the participant.
-
hasMorePokemon
public boolean hasMorePokemon()Description copied from class:BattleParticipant
Checks if the participant has Pokémon that can battle- Overrides:
hasMorePokemon
in classBattleParticipant
- Returns:
- True if the player has a Pokémon that can battle.
-
hasMorePokemonReserve
public boolean hasMorePokemonReserve()Description copied from class:BattleParticipant
For use with switching in new Pokémon. Checks if they have Pokémon in reserve.- Overrides:
hasMorePokemonReserve
in classBattleParticipant
- Returns:
- True if the player has a Pokémon in reserve.
-
isOnField
- Overrides:
isOnField
in classBattleParticipant
-
releasePokemon
Description copied from class:BattleParticipant
Attempts to spawn the entity for the provided wrapper.- Overrides:
releasePokemon
in classBattleParticipant
- Parameters:
pixelmonWrapper
- The wrapper to spawn the entity for.
-
getLevelCap
protected int getLevelCap()Description copied from class:BattleParticipant
Gets the level cap for the participant.
This may be different for boss related entities.- Overrides:
getLevelCap
in classBattleParticipant
- Returns:
- The level cap for the participant.
-
getTeamPokemonUUIDs
Description copied from class:BattleParticipant
Finds all Pokémon in the battle allied with the player.- Overrides:
getTeamPokemonUUIDs
in classBattleParticipant
- Returns:
- An array of Pokémon allied with the player.
-
getName
public net.minecraft.network.chat.Component getName()Description copied from class:BattleParticipant
Gets the name of the participant.- Overrides:
getName
in classBattleParticipant
- Returns:
- The name of the participant.
-
switchPokemon
Description copied from class:BattleParticipant
Switches the participant's Pokémon for another one.- Overrides:
switchPokemon
in classBattleParticipant
- Parameters:
pw
- The Pokémon to switch out.newPixelmonUUID
- The UUID of the Pokémon's to switch in.- Returns:
- The Pokémon who switched in.
-
sendBattleMessage
Description copied from class:BattleParticipant
Sends a battle message to this participant.- Specified by:
sendBattleMessage
in interfaceBattleViewer
- Overrides:
sendBattleMessage
in classBattleParticipant
- Parameters:
message
- The message to send.args
- The arguments to format the message with.
-
checkAndHandleBossTier
Description copied from class:BattleParticipant
Checks if the participant is a boss and then applies the boss tier logic to the provided wrapper.- Overrides:
checkAndHandleBossTier
in classBattleParticipant
- Parameters:
wrapper
- The wrapper to apply the boss tier logic to.
-
getHighestLevel
public int getHighestLevel()Description copied from class:BattleParticipant
Gets the highest level of the participant's Pokémon.- Overrides:
getHighestLevel
in classBattleParticipant
- Returns:
- The highest level
-
checkPokemon
public boolean checkPokemon()Description copied from class:BattleParticipant
Checks if the participant's Pokémon are in a valid state.- Overrides:
checkPokemon
in classBattleParticipant
- Returns:
- Whether the participant's Pokémon are in a valid state.
-
getEntity
@Nullable public @Nullable net.minecraft.world.entity.Entity getEntity()Description copied from class:BattleParticipant
Gets the entity that this participant is representing.- Specified by:
getEntity
in interfaceBattleViewer
- Overrides:
getEntity
in classBattleParticipant
- Returns:
- The entity that this participant is representing.
-
countAblePokemon
public int countAblePokemon()Description copied from class:BattleParticipant
Calculated number of unfainted Pokémon in the entire team.- Overrides:
countAblePokemon
in classBattleParticipant
- Returns:
- The number of unfainted Pokémon, sent out or not.
-
countHealthPercent
public float countHealthPercent()Description copied from class:BattleParticipant
Counts the percentage of health remaining in the participant's party.- Overrides:
countHealthPercent
in classBattleParticipant
- Returns:
- The percentage of health remaining in the participant's party.
-
getAllyData
Description copied from class:BattleParticipant
Gets data about the player's allied Pokémon.- Overrides:
getAllyData
in classBattleParticipant
- Returns:
- Data about the player's allied Pokémon.
-
clearTurnVariables
public void clearTurnVariables()Description copied from class:BattleParticipant
Resets turn-specific variables for the participant's Pokémon.- Overrides:
clearTurnVariables
in classBattleParticipant
-
getWait
public boolean getWait()Description copied from class:BattleParticipant
Checks if the participant is waiting in battle.- Overrides:
getWait
in classBattleParticipant
- Returns:
- Whether the participant is waiting in battle.
-
getFaintedPokemon
Description copied from class:BattleParticipant
Gets the first fainted Pokémon in the participant's party.- Overrides:
getFaintedPokemon
in classBattleParticipant
- Returns:
- The first fainted Pokémon in the participant's party.
-
hasRemainingPokemon
public boolean hasRemainingPokemon()Description copied from class:BattleParticipant
Checks if the participant has unfainted Pokémon remaining.- Overrides:
hasRemainingPokemon
in classBattleParticipant
- Returns:
- Whether the participant has unfainted Pokémon remaining.
-
faintedLastTurn
public boolean faintedLastTurn()Description copied from class:BattleParticipant
Returns whether one of the participant's pokemon fainted last turn.- Overrides:
faintedLastTurn
in classBattleParticipant
- Returns:
- Whether one of the participant's pokemon fainted in the previous turn.
-
updateLastFaintedTurn
public void updateLastFaintedTurn()- Overrides:
updateLastFaintedTurn
in classBattleParticipant
-
getTotalFainted
public int getTotalFainted()Description copied from class:BattleParticipant
Returns the number of Pokémon that have fainted for this participant this battle.- Overrides:
getTotalFainted
in classBattleParticipant
- Returns:
- Number of total fainted, including revived pokemon.
-
incrementFaintCount
public void incrementFaintCount()Description copied from class:BattleParticipant
Increments the number of fainted pokemon. To be called when a Pokémon faints.- Overrides:
incrementFaintCount
in classBattleParticipant
-
getOpponents
Description copied from class:BattleParticipant
Finds the participants on the opposing side of the battle.- Overrides:
getOpponents
in classBattleParticipant
- Returns:
- The participant's opponents.
-
getAllies
Description copied from class:BattleParticipant
Finds the participants on the allied side of the battle.- Overrides:
getAllies
in classBattleParticipant
- Returns:
- The participant's allies.
-
getOpponentPokemon
Description copied from class:BattleParticipant
Returns all Pokemon on the opposite side of the battle that the participant is on.- Overrides:
getOpponentPokemon
in classBattleParticipant
- Returns:
- A list of all Pokemon on the opposite of the battle that the participant is on.
-
getTeamPokemon
Description copied from class:BattleParticipant
Returns all Pokemon on the side of the battle that the participant is on.- Overrides:
getTeamPokemon
in classBattleParticipant
- Returns:
- A list of all Pokemon on the side of the battle that the participant is on.
-
getActiveUnfaintedPokemon
Description copied from class:BattleParticipant
Returns all active, unfainted Pokémon that the participant is controlling.- Overrides:
getActiveUnfaintedPokemon
in classBattleParticipant
- Returns:
- A list of all active, unfainted Pokémon that the participant is controlling.
-
getPokemonFromUUID
Description copied from class:BattleParticipant
Gets a controlled Pokémon from its UUID.- Overrides:
getPokemonFromUUID
in classBattleParticipant
- Parameters:
uuid
- The UUID of the Pokémon to get.- Returns:
- The Pokémon with the specified UUID, or null if no Pokémon has the UUID.
-
getPartyPokemonFromUUID
Description copied from class:BattleParticipant
Gets a Pokémon from its UUID.- Overrides:
getPartyPokemonFromUUID
in classBattleParticipant
- Parameters:
uuid
- The UUID of the Pokémon to get.- Returns:
- The Pokémon with the specified UUID, or null if no Pokémon has the UUID.
-
getPartyPosition
Description copied from class:BattleParticipant
Gets the base position of the Pokémon in the participant's party.- Overrides:
getPartyPosition
in classBattleParticipant
- Parameters:
pokemon
- The Pokémon to get the position of.- Returns:
- The base position of the Pokémon in the participant's party.
-
loadParty
Description copied from class:BattleParticipant
Loads all Pokémon in the participant's party.- Overrides:
loadParty
in classBattleParticipant
- Parameters:
party
- The storage to load Pokémon from.
-
loadParty
Description copied from class:BattleParticipant
Loads all Pokémon in the participant's party.- Overrides:
loadParty
in classBattleParticipant
- Parameters:
party
- The Pokémon to use for the participant's party.
-
loadSingle
Description copied from class:BattleParticipant
Loads just one Pokémon in the participant's party.- Overrides:
loadSingle
in classBattleParticipant
- Parameters:
pokemon
- The Pokémon to use for the participant's party.
-
getPokemonFromParty
Description copied from class:BattleParticipant
Gets the Pokémon from the participant's party who matches the given Pokémon UUID.- Overrides:
getPokemonFromParty
in classBattleParticipant
- Parameters:
uuid
- The UUID to get a Pokémon with.- Returns:
- The Pokémon from the participant's party who matches the given Pokémon UUID.
-
getWorld
public net.minecraft.world.level.Level getWorld()Description copied from class:BattleParticipant
Gets the world that the participant is in.- Overrides:
getWorld
in classBattleParticipant
- Returns:
- The world that the participant is in.
-
addSwitchingOut
Description copied from class:BattleParticipant
Adds a Pokémon to the list of Pokémon switching out.- Overrides:
addSwitchingOut
in classBattleParticipant
- Parameters:
pw
- The Pokémon to add to the list.- Returns:
- Whether the participant has Pokémon in reserve to switch out with.
-
switchAllFainted
public void switchAllFainted()Description copied from class:BattleParticipant
Switches out all fainted Pokémon for their replacements.- Overrides:
switchAllFainted
in classBattleParticipant
-
getRandomPartyPokemon
Description copied from class:BattleParticipant
Gets a random Pokémon from the participant's party that isn't already sent out.- Overrides:
getRandomPartyPokemon
in classBattleParticipant
- Returns:
- A random Pokémon from the participant's party that isn't already sent out, or null if there aren't any.
-
getBattleAI
- Overrides:
getBattleAI
in classBattleParticipant
-
setBattleAI
- Overrides:
setBattleAI
in classBattleParticipant
-
revivePokemon
- Overrides:
revivePokemon
in classBattleParticipant
-
countFaintedPokemon
public int countFaintedPokemon()Description copied from class:BattleParticipant
Counts the number of fainted Pokémon in the participant's party.- Overrides:
countFaintedPokemon
in classBattleParticipant
- Returns:
- The number of fainted Pokémon in the participant's party.
-
countPartyPokemon
Description copied from class:BattleParticipant
Counts the number of Pokémon in the participant's party that match the provided predicate.- Overrides:
countPartyPokemon
in classBattleParticipant
- Parameters:
predicate
- The predicate to match Pokémon against.- Returns:
- The number of Pokémon in the participant's party that match the provided predicate.
-
onEndTurn
- Overrides:
onEndTurn
in classBattleParticipant
-
onTakeTurn
- Overrides:
onTakeTurn
in classBattleParticipant
-
onUseAttack
- Overrides:
onUseAttack
in classBattleParticipant
-
onUseAttackPost
- Overrides:
onUseAttackPost
in classBattleParticipant
-
onAddStatus
public boolean onAddStatus(BattleController bc, PixelmonWrapper user, PixelmonWrapper target, StatusBase status) - Overrides:
onAddStatus
in classBattleParticipant
-
onHit
- Overrides:
onHit
in classBattleParticipant
-
onOpponentKO
- Overrides:
onOpponentKO
in classBattleParticipant
-
onTargeted
- Overrides:
onTargeted
in classBattleParticipant
-
onUseAttackOther
public boolean onUseAttackOther(BattleController bc, Attack attack, BattleParticipant bp, PixelmonWrapper user) - Overrides:
onUseAttackOther
in classBattleParticipant
-
onSwitchIn
- Overrides:
onSwitchIn
in classBattleParticipant
-
retrieveEntityDuringBattleUnlessRiding
Description copied from class:BattleParticipant
If a player/trainer is riding their Pokémon and gets in a battle while riding it, they shouldn't be knocked off their Pokémon.- Overrides:
retrieveEntityDuringBattleUnlessRiding
in classBattleParticipant
- Parameters:
pw
- The Pokémon that is currently in battle that the player may or may not be riding upon.
-
sendBattleMessage
-