Class PlayerParticipant
java.lang.Object
com.pixelmonmod.pixelmon.battles.controller.participants.BattleParticipant
com.pixelmonmod.pixelmon.battles.controller.participants.PlayerParticipant
- All Implemented Interfaces:
BattleViewer
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, entity, evolution, isDefeated, lastFailedCapture, lastFaintedTurn, lastMoveTime, numControlledPokemon, 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
(net.minecraft.server.level.ServerPlayer p, Pokemon... startingPixelmon) Initializes the player participant.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 is allowed to Mega Evolve Pokémon.void
Increments orbs in the player's inventory upon defeating a Pokémon.void
completeRevival
(UUID selectedPokemon) void
endBattle
(BattleEndCause cause) Ends the battle the participant is in.int
net.minecraft.network.chat.MutableComponent
Returns the name of the entity the participant is representing.int
getMove
(PixelmonWrapper pokemon) Gets the move to be used by the specified Pokémon.void
getNextPokemon
(int position) Sends out the next unfainted Pokémon in the participant's party.Gets data about the player's opponents.@Nullable net.minecraft.server.level.ServerPlayer
Gets the player this is representing.int
Gets the multiplier for end-of-battle prize money awarded.Returns the Pokémon storage of the participant.void
givePlayerExp
(PixelmonWrapper pixelmon) Awards experience to the player when a Pokémon faints.boolean
isPlayer()
If the participant is a player.void
openGui()
Opens the battle GUI if it didn't just get opened already.void
Adds the participant to a battle.void
void
revivePokemon
(float healthPercentage) void
Chooses an action for the participant's Pokémon.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
setAmuletCoinMultiplier
(int multiplier) void
setFreeRoamKey
(net.minecraft.network.chat.Component freeRoamKey) void
setHappyHourMultiplier
(int multiplier) void
void
tick()
Updates the participant every tick.void
Updates the opponent's Pokémon client-side.void
Updates the player's opponents client-side.Methods inherited from class com.pixelmonmod.pixelmon.battles.controller.participants.BattleParticipant
addSwitchingOut, canSwitch, checkAndHandleBossTier, checkPokemon, clearMovement, clearTurnVariables, convertEntitiesToWrapper, convertPokemonToWrapper, countAblePokemon, countFaintedPokemon, countHealthPercent, countPartyPokemon, faintedLastTurn, getActiveUnfaintedPokemon, getAllies, getAllyData, getBattleAI, getEntity, getFaintedPokemon, getHighestLevel, getLevelCap, getName, getOpponentPokemon, getOpponents, getPartyPokemonFromUUID, getPartyPosition, getPokemonFromParty, getPokemonFromUUID, getRandomPartyPokemon, getTeamPokemon, getTeamPokemonUUIDs, getTotalFainted, getTurnTimeSeconds, getUniqueId, getWait, getWorld, hasMorePokemon, hasMorePokemonReserve, hasRemainingPokemon, incrementFaintCount, isOnField, isRaid, isTrainer, isWild, loadParty, loadParty, loadSingle, onAddStatus, onEndTurn, onHit, onOpponentKO, onSwitchIn, onTakeTurn, onTargeted, onUseAttack, onUseAttackOther, onUseAttackPost, releasePokemon, resetMoveTimer, retrieveEntityDuringBattleUnlessRiding, revivePokemon, sendBattleMessage, setBattleAI, setWait, switchAllFainted, switchPokemon, updateLastFaintedTurn, waiting
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
sendBattleMessage
-
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
Initializes the player participant.- Parameters:
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
-
getPlayer
@Nullable public @Nullable net.minecraft.server.level.ServerPlayer getPlayer()Description copied from interface:BattleViewer
Gets the player this is representing.
Note: this method may return null if the entity is not a player.- Returns:
- The player this is representing.
-
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.
-
getPrizeMoneyMultiplier
public int getPrizeMoneyMultiplier()Gets the multiplier for end-of-battle prize money awarded.- Returns:
- The multiplier for end-of-battle prize money awarded.
-
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
-
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. -
checkPlayerItems
public void checkPlayerItems()Increments orbs in the player's inventory upon defeating a Pokémon. -
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.- 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.
-
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
-
completeRevival
-
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
-
getAmuletCoinMultiplier
public int getAmuletCoinMultiplier() -
setAmuletCoinMultiplier
public void setAmuletCoinMultiplier(int multiplier) -
getHappyHourMultiplier
public int getHappyHourMultiplier() -
setHappyHourMultiplier
public void setHappyHourMultiplier(int multiplier) -
resetPayDay
public void resetPayDay() -
isPlayer
public boolean isPlayer()Description copied from class:BattleParticipant
If the participant is a player.- Overrides:
isPlayer
in classBattleParticipant
- Returns:
- Whether the participant is a 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.
-
setFreeRoamKey
public void setFreeRoamKey(net.minecraft.network.chat.Component freeRoamKey)
-