Class PlayerParticipant
java.lang.Object
com.pixelmonmod.pixelmon.battles.controller.participants.BattleParticipant
com.pixelmonmod.pixelmon.battles.controller.participants.PlayerParticipant
- All Implemented Interfaces:
BattleViewer,ContextHolder
A battle participant representing a player.
-
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanWhether an Amulet Coin will double prize money.booleanWhether Happy Hour will double prize money.floatThe max distance this player is from the farthest away opponent's Pokemon.The player's Pokémon.intThe amount of money earned from Pay Day after the battle ends.net.minecraft.server.level.ServerPlayerThe player that this participant is representing.Fields inherited from class com.pixelmonmod.pixelmon.battles.controller.participants.BattleParticipant
allPokemon, ashNinja, bc, context, controlledPokemon, dynamax, entity, evolution, isDefeated, lastFailedCapture, lastFaintedTurn, lastMoveTime, numControlledPokemon, originalPokemon, switchingIn, switchingOut, team, terastal, totalFainted, ultraBurst, wait -
Constructor Summary
ConstructorsConstructorDescriptionPlayerParticipant(net.minecraft.server.level.ServerPlayer p) Initializes the player participant, using their current party as their team.PlayerParticipant(net.minecraft.server.level.ServerPlayer p, Pokemon pokemon) Initializes the player participant for a raid.PlayerParticipant(net.minecraft.server.level.ServerPlayer p, Pokemon... pokemon) Initializes the player participant.PlayerParticipant(net.minecraft.server.level.ServerPlayer p, Collection<Pokemon> pokemon) Initializes the player participant. -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if the participant is allowed to Dynamax Pokémon.booleanChecks if the participant is allowed to Mega Evolve Pokémon.booleanChecks if the participant is allowed to Terastallize Pokémon.voidIncrements orbs in the player's inventory upon defeating a Pokémon.voidcompleteRevival(UUID selectedPokemon) copy(BattleController controller) voidendBattle(BattleEndCause cause) Ends the battle the participant is in.voidenforcedSwitch(PixelmonWrapper itemHolder) intnet.minecraft.network.chat.MutableComponentReturns the name of the entity the participant is representing.intgetMove(PixelmonWrapper pokemon) Gets the move to be used by the specified Pokémon.voidgetNextPokemon(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.ServerPlayerGets the player this is representing.doubleGets the multiplier for end-of-battle prize money awarded.Returns the Pokémon storage of the participant.booleangetWait()Checks if the participant is waiting in battle.voidgivePlayerExperience(PixelmonWrapper pixelmon) Awards experience to the player when a Pokémon faints.booleanChecks that the participant is still valid and has not disconnected.booleanbooleanbooleanisPlayer()If the participant is a player.voidopenGui()Opens the battle GUI if it didn't just get opened already.voidAdds the participant to a battle.voidvoidrevivePokemon(float healthPercentage) Called fromRevivalBlessing.voidChooses an action for the participant's Pokémon.voidsendPacket(PixelmonPacket packet) voidsetAmuletCoinMultiplier(int multiplier) voidsetFreeRoamKey(net.minecraft.network.chat.Component freeRoamKey) voidsetHappyHourMultiplier(int multiplier) voidsetupTeam(BattleController controller, int numControlledPokemon, int positionOffset) voidvoidHands this participant over to its battle AI after the player left a multiplayer raid, answering anything the battle was still waiting on them for.voidterastallized(PixelmonWrapper pixelmonWrapper) voidtick()Updates the participant every tick.voidUpdates the opponent's Pokémon client-side.voidUpdates the player's opponents client-side.Methods inherited from class com.pixelmonmod.pixelmon.battles.controller.participants.BattleParticipant
addSwitchingOut, canSwitch, checkAndHandleBossTier, checkPokemon, clearMovement, clearPendingSelection, clearTurnVariables, copyAll, copyTo, countAblePokemon, countFaintedPokemon, countHealthPercent, countPartyPokemon, faintedLastTurn, findTargets, getActiveUnfaintedPokemon, getAllies, getAllyData, getBattleAI, getBattleController, getContext, getEntity, getFaintedPokemon, getHighestLevel, getLevelCap, getName, getOpponentPokemon, getOpponents, getPartyPokemonFromUUID, getPartyPosition, getPokemonFromParty, getPokemonFromUUID, getPossibleSwitchIDs, getRandomPartyPokemon, getTeam, getTeamBenchedPokemon, getTeamPokemon, getTeamPokemon, getTeamPokemonUUIDs, getTotalFainted, getTurnTimeSeconds, getUniqueId, getWorld, hasMorePokemon, hasMorePokemonReserve, hasRemainingPokemon, hasUsedZMove, incrementFaintCount, is, isOnField, isRaid, isTrainer, isValidSwitchTarget, isWild, onAddStatus, onEndTurn, onHit, onOpponentKO, onSwitchIn, onTakeTurn, onTargeted, onUseAttack, onUseAttackOther, onUseAttackPost, releasePokemon, resetMoveTimer, retrieveEntityDuringBattleUnlessRiding, revivePokemon, selectBattleAction, sendBattleMessage, setBattleAI, setBattleAI, setUsedZMove, setWait, shouldKeepFaintedOpponentPokemon, shouldKeepFaintedPokemon, shouldSkipTurnAgainstOpponent, shouldWaitForPokemon, switchAllFainted, switchPokemon, syncContext, updateLastFaintedTurn, waiting, wrapPokemonMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.pixelmonmod.pixelmon.battles.controller.BattleViewer
sendBattleMessage, sendBattleMessageMethods inherited from interface com.pixelmonmod.pixelmon.battles.controller.context.ContextHolder
get, getOrDefault, has, remove, set, update
-
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.
The Pokemon need to be in order of which they are to be sent out in battle. So the first X Pokemon will be the ones that are sent out at the start of the battle (dependent on the type of battle).- Parameters:
p- The player.pokemon- The pokemon that will be used by the player in the battle.
-
PlayerParticipant
Initializes the player participant.
The Pokemon need to be in order of which they are to be sent out in battle. So the first X Pokemon will be the ones that are sent out at the start of the battle (dependent on the type of battle).- Parameters:
p- The player.pokemon- The pokemon that will be used by the player in the battle.
-
PlayerParticipant
public PlayerParticipant(net.minecraft.server.level.ServerPlayer p) Initializes the player participant, using their current party as their team.- Parameters:
p- The player
-
PlayerParticipant
Initializes the player participant for a raid.- Parameters:
p- The player.pokemon- The Pokémon to send out at the start of the battle.
-
-
Method Details
-
setupTeam
- Overrides:
setupTeamin classBattleParticipant
-
getPlayer
@Nullable public @Nullable net.minecraft.server.level.ServerPlayer getPlayer()Description copied from interface:BattleViewerGets 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:
startBattlein classBattleParticipant
-
preBattleChecks
public void preBattleChecks()Description copied from class:BattleParticipantAdds the participant to a battle.- Overrides:
preBattleChecksin classBattleParticipant
-
endBattle
Description copied from class:BattleParticipantEnds the battle the participant is in.- Specified by:
endBattlein classBattleParticipant
-
getNextPokemon
public void getNextPokemon(int position) Description copied from class:BattleParticipantSends out the next unfainted Pokémon in the participant's party.- Overrides:
getNextPokemonin classBattleParticipant- Parameters:
position- The position to send out the Pokémon at.
-
isAiControlled
public boolean isAiControlled() -
takeOverWithAI
public void takeOverWithAI()Hands this participant over to its battle AI after the player left a multiplayer raid, answering anything the battle was still waiting on them for. -
sendPacket
-
getWait
public boolean getWait()Description copied from class:BattleParticipantChecks if the participant is waiting in battle.- Overrides:
getWaitin classBattleParticipant- Returns:
- Whether the participant is waiting in battle.
-
getPrizeMoneyMultiplier
public double getPrizeMoneyMultiplier()Gets the multiplier for end-of-battle prize money awarded.- Overrides:
getPrizeMoneyMultiplierin classBattleParticipant- Returns:
- The multiplier for end-of-battle prize money awarded.
-
selectAction
public void selectAction()Description copied from class:BattleParticipantChooses an action for the participant's Pokémon.- Overrides:
selectActionin classBattleParticipant
-
getMove
Description copied from class:BattleParticipantGets the move to be used by the specified Pokémon.- Overrides:
getMovein classBattleParticipant- Parameters:
pokemon- The Pokémon to get a move for.- Returns:
- The move to be used by the specified Pokémon.
-
hasDisconnected
public boolean hasDisconnected()Description copied from class:BattleParticipantChecks that the participant is still valid and has not disconnected.- Overrides:
hasDisconnectedin classBattleParticipant- Returns:
- Whether the participant is still valid and has not disconnected.
-
updateBattlingPokemon
public void updateBattlingPokemon()Description copied from class:BattleParticipantUpdates the opponent's Pokémon client-side.- Overrides:
updateBattlingPokemonin 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:BattleParticipantUpdates the participant every tick.- Overrides:
tickin classBattleParticipant
-
givePlayerExperience
Awards experience to the player when a Pokémon faints. Experience is based on the pokemonLevel of the Pokémon that fainted.- Overrides:
givePlayerExperiencein classBattleParticipant- Parameters:
pixelmon- The Pokémon that fainted.
-
hasExpAll
public boolean hasExpAll()- Overrides:
hasExpAllin classBattleParticipant
-
openGui
public void openGui()Opens the battle GUI if it didn't just get opened already. -
getBattleMusicType
-
getDisplayName
public net.minecraft.network.chat.MutableComponent getDisplayName()Description copied from class:BattleParticipantReturns the name of the entity the participant is representing.- Overrides:
getDisplayNamein classBattleParticipant- Returns:
- The name of the entity the participant is representing.
-
getStorage
Description copied from class:BattleParticipantReturns the Pokémon storage of the participant.- Overrides:
getStoragein classBattleParticipant- Returns:
- The Pokémon storage of the participant.
-
canMegaEvolve
public boolean canMegaEvolve()Description copied from class:BattleParticipantChecks if the participant is allowed to Mega Evolve Pokémon.- Overrides:
canMegaEvolvein classBattleParticipant- Returns:
- Whether the participant is allowed to Mega Evolve Pokémon.
-
canDynamax
public boolean canDynamax()Description copied from class:BattleParticipantChecks if the participant is allowed to Dynamax Pokémon.- Overrides:
canDynamaxin classBattleParticipant- Returns:
- Whether the participant is allowed to Dynamax Pokémon.
-
canTerastallize
public boolean canTerastallize()Description copied from class:BattleParticipantChecks if the participant is allowed to Terastallize Pokémon.- Overrides:
canTerastallizein classBattleParticipant- Returns:
- Whether the participant is allowed to Terastallize Pokémon.
-
terastallized
- Overrides:
terastallizedin classBattleParticipant
-
revivePokemon
public void revivePokemon(float healthPercentage) Called fromRevivalBlessing. Sends theEnforcedReviveTaskto a player so that they have to choose a Pokémon to revive.- Overrides:
revivePokemonin classBattleParticipant- Parameters:
healthPercentage- The HP % their Pokémon will revive at.
-
completeRevival
-
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:BattleParticipantIf the participant is a player.- Overrides:
isPlayerin classBattleParticipant- Returns:
- Whether the participant is a player.
-
setFreeRoamKey
public void setFreeRoamKey(net.minecraft.network.chat.Component freeRoamKey) -
enforcedSwitch
- Overrides:
enforcedSwitchin classBattleParticipant
-
copy
- Specified by:
copyin classBattleParticipant
-