Class PlayerParticipant
java.lang.Object
com.pixelmonmod.pixelmon.battles.controller.participants.BattleParticipant
com.pixelmonmod.pixelmon.battles.controller.participants.PlayerParticipant
A battle participant representing a player.
-
Field Summary
Modifier and TypeFieldDescriptionboolean
Whether an Amulet Coin will double prize money.boolean
Whether Happy Hour will double prize money.float
The max distance this player is from the farthest away opponent's Pokemon.The player's Pokémon.int
The amount of money earned from Pay Day after the battle ends.net.minecraft.server.level.ServerPlayer
The player that this participant is representing.Fields inherited from class com.pixelmonmod.pixelmon.battles.controller.participants.BattleParticipant
allPokemon, ashNinja, bc, controlledPokemon, dynamax, evolution, isDefeated, lastFailedCapture, lastFaintedTurn, lastMoveTime, numControlledPokemon, startedBattle, switchingIn, switchingOut, team, totalFainted, ultraBurst, usedZ, wait
-
Constructor Summary
ConstructorDescriptionPlayerParticipant
(boolean raid, net.minecraft.server.level.ServerPlayer p, Pokemon... startingPixelmon) Initializes the player participant for a raid.PlayerParticipant
(boolean raid, net.minecraft.server.level.ServerPlayer p, PixelmonEntity... startingPixelmon) Deprecated.PlayerParticipant
(net.minecraft.server.level.ServerPlayer p, Pokemon... startingPixelmon) Initializes the player participant.PlayerParticipant
(net.minecraft.server.level.ServerPlayer p, PixelmonEntity... startingPixelmon) Deprecated.PlayerParticipant
(net.minecraft.server.level.ServerPlayer p, List<Pokemon> teamSelection, int numControlledPokemon) Initializes the player participant. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks if the participant is allowed to Dynamax Pokémon.boolean
Checks if the participant's Pokémon can give experience.boolean
Checks if the participant is allowed to Mega Evolve Pokémon.void
Increments orbs in the player's inventory upon defeating a Pokémon.boolean
Checks if the participant's Pokémon are in a valid state.void
endBattle
(BattleEndCause cause) Ends the battle the participant is in.Gets data about the player's allied Pokémon.int
Returns the name of the entity the participant is representing.net.minecraft.world.entity.LivingEntity
Gets the entity that this participant is representing.int
int
Gets the pokemonLevel of the highest-leveled Pokémon in the player's party.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.Gets the UUID of the next Pokémon in the participant's party that can battle;Gets data about the player's opponents.int
Gets the multiplier for end-of-battle prize money awarded.Returns the Pokémon storage of the participant.Finds all Pokémon in the battle allied with the player.getType()
Gets the type of participant that this participant is.void
givePlayerExp
(PixelmonWrapper pixelmon) Awards experience to the player when a Pokémon faints.boolean
For use with switching in new Pokémon.void
openGui()
Opens the battle GUI if it didn't just get opened already.void
void
Chooses an action for the participant's Pokémon.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
sendMessage
(PixelmonPacket message) Sends a packet to this participant, wont do anything if its not a player.void
setAmuletCoinMultiplier
(int multiplier) void
setFreeRoamKey
(net.minecraft.network.chat.Component freeRoamKey) void
setHappyHourMultiplier
(int multiplier) void
Adds the participant to a battle.switchPokemon
(PixelmonWrapper pw, UUID newPixelmonUUID) Switches the participant's Pokémon for another one.void
tick()
Updates the participant every tick.void
Updates the player's opponents client-side.void
Updates the opponent's Pokémon client-side.void
Updates the specified Pokémon client-side.void
Updates the health of Pokémon on the opposing side of the battle.Methods inherited from class com.pixelmonmod.pixelmon.battles.controller.participants.BattleParticipant
addSwitchingOut, canSwitch, clearTurnVariables, countAblePokemon, countHealthPercent, countTeam, faintedLastTurn, getActiveUnfaintedPokemon, getAllies, getBattleAI, getCurrentTime, getFaintedPokemon, getOpponentPokemon, getOpponents, getPartyPokemonFromUUID, getPartyPosition, getPokemonFromParty, getPokemonFromParty, getPokemonFromUUID, getRandomPartyPokemon, getTeamPokemon, getTotalFainted, getTurnTimeSeconds, getWait, getWorld, hasMorePokemon, hasRemainingPokemon, incrementFaintCount, loadParty, loadParty, loadSingle, onAddStatus, onEndTurn, onHit, onOpponentKO, onSwitchIn, onTakeTurn, onTargeted, onUseAttack, onUseAttackOther, onUseAttackPost, resetMoveTimer, retrieveEntityDuringBattleUnlessRiding, setBattleAI, setNumControlledPokemon, switchAllFainted, updateLastFaintedTurn
-
Field Details
-
player
public net.minecraft.server.level.ServerPlayer playerThe player that this participant is representing. -
party
The player's Pokémon. -
hasAmuletCoin
public boolean hasAmuletCoinWhether an Amulet Coin will double prize money. -
hasHappyHour
public boolean hasHappyHourWhether Happy Hour will double prize money. -
payDay
public int payDayThe amount of money earned from Pay Day after the battle ends. -
maxEntityBattleDistance
public float maxEntityBattleDistanceThe max distance this player is from the farthest away opponent's Pokemon.
-
-
Constructor Details
-
PlayerParticipant
@Deprecated public PlayerParticipant(net.minecraft.server.level.ServerPlayer p, PixelmonEntity... startingPixelmon) Deprecated.Initializes the player participant.- Parameters:
p
- The player.startingPixelmon
- The Pokémon to send out at the start of the battle.
-
PlayerParticipant
Initializes the player participant.- Parameters:
p
- The player.startingPixelmon
- The Pokémon to send out at the start of the battle.
-
PlayerParticipant
@Deprecated public PlayerParticipant(boolean raid, net.minecraft.server.level.ServerPlayer p, PixelmonEntity... startingPixelmon) Deprecated.Initializes the player participant for a raid.- Parameters:
raid
- Whether this participant is in a raid.p
- The player.startingPixelmon
- The Pokémon to send out at the start of the battle.
-
PlayerParticipant
public PlayerParticipant(boolean raid, net.minecraft.server.level.ServerPlayer p, Pokemon... startingPixelmon) Initializes the player participant for a raid.- Parameters:
raid
- Whether this participant is in a raid.p
- The player.startingPixelmon
- The Pokémon to send out at the start of the battle.
-
PlayerParticipant
public PlayerParticipant(net.minecraft.server.level.ServerPlayer p, List<Pokemon> teamSelection, int numControlledPokemon) Initializes the player participant.- Parameters:
p
- The player.teamSelection
- The Pokémon that the player has selected for battle.numControlledPokemon
- The number of active Pokémon that the participant has at once.
-
-
Method Details
-
getType
Description copied from class:BattleParticipant
Gets the type of participant that this participant is.- Specified by:
getType
in classBattleParticipant
- Returns:
- The type of participant that this participant is.
-
canGainXP
public boolean canGainXP()Description copied from class:BattleParticipant
Checks if the participant's Pokémon can give experience.- Specified by:
canGainXP
in classBattleParticipant
- Returns:
- Whether the participant's Pokémon can give experience.
-
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. Normally calls countablePokemon.- Specified by:
hasMorePokemonReserve
in classBattleParticipant
- Returns:
- True if the player has a Pokémon in reserve.
-
startBattle
public void startBattle()Description copied from class:BattleParticipant
Adds the participant to a battle.- Overrides:
startBattle
in classBattleParticipant
-
getTeamPokemonList
Finds all Pokémon in the battle allied with the player.- Returns:
- An array of Pokémon allied with the player.
-
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.- Specified by:
getNextPokemon
in classBattleParticipant
- Parameters:
position
- The position to send out the Pokémon at.
-
getPrizeMoneyMultiplier
public int getPrizeMoneyMultiplier()Gets the multiplier for end-of-battle prize money awarded.- Returns:
- The multiplier for end-of-battle prize money awarded.
-
getNextPokemonUUID
Description copied from class:BattleParticipant
Gets the UUID of the next Pokémon in the participant's party that can battle;- Specified by:
getNextPokemonUUID
in classBattleParticipant
- Returns:
- the UUID of the next Pokémon in the participant's party that can battle, or null if there aren't any.
-
getName
public net.minecraft.network.chat.Component getName()Description copied from class:BattleParticipant
Gets the name of the participant.- Specified by:
getName
in classBattleParticipant
- Returns:
- The name of the participant.
-
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.- Specified by:
getMove
in classBattleParticipant
- Parameters:
pokemon
- The Pokémon to get a move for.- Returns:
- The move to be used by the specified Pokémon.
-
switchPokemon
Description copied from class:BattleParticipant
Switches the participant's Pokémon for another one.- Specified by:
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.
-
checkPokemon
public boolean checkPokemon()Description copied from class:BattleParticipant
Checks if the participant's Pokémon are in a valid state.- Specified by:
checkPokemon
in classBattleParticipant
- Returns:
- Whether the participant's Pokémon are in a valid state.
-
updatePokemon
Description copied from class:BattleParticipant
Updates the specified Pokémon client-side.- Specified by:
updatePokemon
in classBattleParticipant
- Parameters:
pw
- The Pokémon to update.
-
getEntity
public net.minecraft.world.entity.LivingEntity getEntity()Description copied from class:BattleParticipant
Gets the entity that this participant is representing.- Specified by:
getEntity
in classBattleParticipant
- Returns:
- The entity that this participant is representing.
-
updateOtherPokemon
public void updateOtherPokemon()Description copied from class:BattleParticipant
Updates the opponent's Pokémon client-side.- Specified by:
updateOtherPokemon
in classBattleParticipant
-
getAllyData
Gets data about the player's allied Pokémon.- Returns:
- Data about the player's allied Pokémon.
-
getOpponentData
Gets data about the player's opponents.- Returns:
- Data about the player's opponents.
-
updateOpponentPokemon
public void updateOpponentPokemon()Updates the player's opponents client-side. -
updatePokemonHealth
public void updatePokemonHealth()Updates the health of Pokémon on the opposing side of the battle. If a Pokémon is fainted, award experience to the player. -
checkPlayerItems
public void checkPlayerItems()Increments orbs in the player's inventory upon defeating a Pokémon. -
getHighestLevel
public int getHighestLevel()Gets the pokemonLevel of the highest-leveled Pokémon in the player's party.- Returns:
- The pokemonLevel of the highest-leveled Pokémon in the player's party
-
tick
public void tick()Description copied from class:BattleParticipant
Updates the participant every tick.- Overrides:
tick
in classBattleParticipant
-
givePlayerExp
Awards experience to the player when a Pokémon faints. Experience is based on the pokemonLevel of the Pokémon that fainted.- Parameters:
pixelmon
- The Pokémon that fainted.
-
openGui
public void openGui()Opens the battle GUI if it didn't just get opened already. -
getBattleMusicType
-
sendDamagePacket
Description copied from class:BattleParticipant
Updates the client when a Pokémon takes damage.- 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.- Overrides:
sendHealPacket
in classBattleParticipant
- Parameters:
target
- The Pokémon who healed.amount
- The amount of hp healed.
-
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.
-
sendMessage
Description copied from class:BattleParticipant
Sends a packet to this participant, wont do anything if its not a player.- Overrides:
sendMessage
in classBattleParticipant
- Parameters:
message
- The packet to send to this player
-
getAmuletCoinMultiplier
public int getAmuletCoinMultiplier() -
setAmuletCoinMultiplier
public void setAmuletCoinMultiplier(int multiplier) -
getHappyHourMultiplier
public int getHappyHourMultiplier() -
setHappyHourMultiplier
public void setHappyHourMultiplier(int multiplier) -
resetPayDay
public void resetPayDay() -
setFreeRoamKey
public void setFreeRoamKey(net.minecraft.network.chat.Component freeRoamKey)
-