public abstract class BattleParticipant
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
PixelmonWrapper[] |
allPokemon
All Pokémon in the participant's party during battle.
|
java.util.UUID |
ashNinja |
BattleController |
bc
The battle the participant is in.
|
java.util.List<PixelmonWrapper> |
controlledPokemon
The active Pokémon of the participant.
|
java.util.UUID |
dynamax |
java.util.UUID |
evolution
Whether the participant can currently Mega Evolve a Pokémon.
|
boolean |
isDefeated
Whether the participant has been defeated in battle.
|
PokeBall |
lastFailedCapture
The last pokeball type that failed to catpure a pokemon, Used by the Ball Fetch ability
|
protected int |
lastFaintedTurn
The last turn the participant's Pokémon fainted in.
|
protected long |
lastMoveTime
The time when the participant last made a move.
|
int |
numControlledPokemon
The number of Pokémon the participant is controlling in battle at once.
|
boolean |
startedBattle
Whether the participant is in a battle.
|
java.util.List<java.util.UUID> |
switchingIn
Keeps track of Pokémon switching.
|
java.util.List<PixelmonWrapper> |
switchingOut
The Pokémon that are switching out after fainting.
|
int |
team
The side of the battle that the participant is on.
|
protected int |
totalFainted
How many of the participant's Pokémon have fainted total in the battle.
|
java.util.UUID |
ultraBurst |
boolean |
usedZ |
boolean |
wait
Whether the participant is waiting for other participants to act.
|
Constructor and Description |
---|
BattleParticipant(int numControlledPokemon)
Initializes a participant.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addSwitchingOut(PixelmonWrapper pw)
Adds a Pokémon to the list of Pokémon switching out.
|
void |
animateDynamax()
Does Dynamax scale changing.
|
boolean |
canDynamax()
Checks if the participant is allowed to Dynamax Pokémon.
|
abstract boolean |
canGainXP()
Checks if the participant's Pokémon can give experience.
|
boolean |
canMegaEvolve()
Checks if the participant is allowed to Mega Evolve Pokémon.
|
static boolean[] |
canSwitch(PixelmonWrapper p)
Checks if Pokémon can switch or flee.
|
abstract boolean |
checkPokemon()
Checks if the participant's Pokémon are in a valid state.
|
void |
clearTurnVariables()
Resets turn-specific variables for the participant's Pokémon.
|
int |
countAblePokemon()
Calculated number of unfainted Pokémon in the entire team.
|
float |
countHealthPercent()
Counts the percentage of health remaining in the participant's party.
|
int |
countTeam()
Counts how many Pokémon are in the participant's party.
|
abstract void |
endBattle(BattleEndCause cause)
Ends the battle the participant is in.
|
boolean |
faintedLastTurn()
Returns whether one of the participant's pokemon fainted last turn.
|
java.util.List<PixelmonWrapper> |
getActiveUnfaintedPokemon()
Returns all active, unfainted Pokémon that the participant is controlling.
|
java.util.List<BattleParticipant> |
getAllies()
Finds the participants on the allied side of the battle.
|
BattleAIBase |
getBattleAI() |
java.lang.Long |
getCurrentTime()
Gets the current system time.
|
java.lang.String |
getDisplayName()
Returns the name of the entity the participant is representing.
|
abstract net.minecraft.entity.LivingEntity |
getEntity()
Gets the entity that this participant is representing.
|
PixelmonWrapper |
getFaintedPokemon()
Gets the first fainted Pokémon in the participant's party.
|
abstract MoveChoice |
getMove(PixelmonWrapper pixelmonWrapper)
Gets the move to be used by the specified Pokémon.
|
abstract net.minecraft.util.text.TextComponent |
getName()
Gets the name of the participant.
|
abstract void |
getNextPokemon(int position)
Sends out the next unfainted Pokémon in the participant's party.
|
abstract java.util.UUID |
getNextPokemonUUID()
Gets the UUID of the next Pokémon in the participant's party that can battle;
|
java.util.List<PixelmonWrapper> |
getOpponentPokemon()
Returns all Pokemon on the opposite side of the battle that the participant is on.
|
java.util.List<BattleParticipant> |
getOpponents()
Finds the participants on the opposing side of the battle.
|
int |
getPartyPosition(PixelmonWrapper pokemon)
Gets the base position of the Pokémon in the participant's party.
|
protected PixelmonWrapper |
getPokemonFromParty(PixelmonEntity entity)
Gets the Pokémon from the participant's party who matches the given Pokémon ID.
|
PixelmonWrapper |
getPokemonFromParty(java.util.UUID uuid)
Gets the Pokémon from the participant's party who matches the given Pokémon UUID.
|
PixelmonWrapper |
getPokemonFromUUID(java.util.UUID uuid)
Gets a controlled Pokémon from its UUID.
|
PixelmonWrapper |
getRandomPartyPokemon()
Gets a random Pokémon from the participant's party that isn't already sent out.
|
PartyStorage |
getStorage()
Returns the Pokémon storage of the participant.
|
java.util.List<PixelmonWrapper> |
getTeamPokemon()
Returns all Pokemon on the side of the battle that the participant is on.
|
int |
getTotalFainted()
Returns the number of Pokémon that have fainted for this participant this battle.
|
long |
getTurnTimeSeconds()
Gets the time since the participant last made a move.
|
abstract ParticipantType |
getType()
Gets the type of participant that this participant is.
|
boolean |
getWait()
Checks if the participant is waiting in battle.
|
net.minecraft.world.World |
getWorld()
Gets the world that the participant is in.
|
boolean |
hasMorePokemon()
Checks if the participant has Pokémon that can battle
|
abstract boolean |
hasMorePokemonReserve()
For use with switching in new Pokémon.
|
boolean |
hasRemainingPokemon()
Checks if the participant has unfainted Pokémon remaining.
|
void |
incrementFaintCount()
Increments the number of fainted pokemon.
|
protected void |
loadParty(java.util.List<Pokemon> party)
Loads all Pokémon in the participant's party.
|
protected void |
loadParty(PartyStorage party)
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 |
onEndTurn(BattleController bc) |
float |
onHit(PixelmonWrapper source,
float damage,
DamageTypeEnum damageType) |
void |
onOpponentKO(BattleController bc,
PixelmonWrapper pw) |
void |
onSwitchIn(BattleController bc,
PixelmonWrapper pw) |
boolean |
onTakeTurn(BattleController bc,
PixelmonWrapper pw) |
boolean |
onTargeted(PixelmonWrapper user,
Attack attack) |
boolean |
onUseAttack(BattleController bc,
PixelmonWrapper pw) |
boolean |
onUseAttackOther(BattleController bc,
Attack attack,
BattleParticipant bp,
PixelmonWrapper user) |
void |
onUseAttackPost(BattleController bc,
PixelmonWrapper pw) |
void |
resetMoveTimer()
Resets the timer for the participant making a move.
|
void |
retrieveEntityDuringBattleUnlessRiding(PixelmonWrapper pw)
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 unless the pokemon is fainted.
|
void |
selectAction()
Chooses an action for the participant's Pokémon.
|
void |
sendDamagePacket(PixelmonWrapper target,
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 |
setBattleAI(BattleAIBase ai) |
void |
setNumControlledPokemon(int numControlledPokemon)
Changes the number of Pokémon that the participant will send out.
|
void |
startBattle()
Adds the participant to a battle.
|
void |
switchAllFainted()
Switches out all fainted Pokémon for their replacements.
|
abstract PixelmonWrapper |
switchPokemon(PixelmonWrapper pw,
java.util.UUID newPixelmonUUID)
Switches the participant's Pokémon for another one.
|
void |
tick()
Updates the participant every tick.
|
void |
updateLastFaintedTurn() |
abstract void |
updateOtherPokemon()
Updates the opponent's Pokémon client-side.
|
abstract void |
updatePokemon(PixelmonWrapper poke)
Updates the specified Pokémon client-side.
|
public boolean startedBattle
public BattleController bc
public int team
public boolean wait
public java.util.List<PixelmonWrapper> controlledPokemon
public PixelmonWrapper[] allPokemon
public boolean isDefeated
protected long lastMoveTime
public int numControlledPokemon
protected int lastFaintedTurn
protected int totalFainted
public PokeBall lastFailedCapture
public java.util.List<java.util.UUID> switchingIn
public java.util.List<PixelmonWrapper> switchingOut
public java.util.UUID evolution
public java.util.UUID ultraBurst
public java.util.UUID ashNinja
public java.util.UUID dynamax
public boolean usedZ
public BattleParticipant(int numControlledPokemon)
numControlledPokemon
- The number of Pokémon that the participant will send out.public java.lang.Long getCurrentTime()
public void resetMoveTimer()
public long getTurnTimeSeconds()
public void setNumControlledPokemon(int numControlledPokemon)
numControlledPokemon
- The number of Pokémon that the participant will send out.public boolean hasMorePokemon()
public abstract boolean hasMorePokemonReserve()
public abstract boolean canGainXP()
public void startBattle()
public abstract void endBattle(BattleEndCause cause)
public abstract net.minecraft.util.text.TextComponent getName()
public abstract MoveChoice getMove(PixelmonWrapper pixelmonWrapper)
pixelmonWrapper
- The Pokémon to get a move for.public abstract PixelmonWrapper switchPokemon(PixelmonWrapper pw, java.util.UUID newPixelmonUUID)
pw
- The Pokémon to switch out.newPixelmonUUID
- The UUID of the Pokémon's to switch in.public abstract boolean checkPokemon()
public abstract void updatePokemon(PixelmonWrapper poke)
poke
- The Pokémon to update.public abstract net.minecraft.entity.LivingEntity getEntity()
public abstract void updateOtherPokemon()
public abstract ParticipantType getType()
public abstract void getNextPokemon(int position)
position
- The position to send out the Pokémon at.public abstract java.util.UUID getNextPokemonUUID()
public int countTeam()
public int countAblePokemon()
public float countHealthPercent()
public void tick()
public void clearTurnVariables()
public void selectAction()
public void animateDynamax()
public boolean getWait()
public PixelmonWrapper getFaintedPokemon()
public boolean hasRemainingPokemon()
public boolean faintedLastTurn()
public void updateLastFaintedTurn()
public int getTotalFainted()
public void incrementFaintCount()
public void sendDamagePacket(PixelmonWrapper target, int damage)
target
- The Pokémon who took damage.damage
- The amount of damage dealt.public void sendHealPacket(PixelmonWrapper target, int amount)
target
- The Pokémon who healed.amount
- The amount of hp healed.public java.lang.String getDisplayName()
public static boolean[] canSwitch(PixelmonWrapper p)
p
- The Pokémon to check.public PartyStorage getStorage()
public java.util.List<BattleParticipant> getOpponents()
public java.util.List<BattleParticipant> getAllies()
public java.util.List<PixelmonWrapper> getOpponentPokemon()
public java.util.List<PixelmonWrapper> getTeamPokemon()
public java.util.List<PixelmonWrapper> getActiveUnfaintedPokemon()
public PixelmonWrapper getPokemonFromUUID(java.util.UUID uuid)
uuid
- The UUID of the Pokémon to get.public int getPartyPosition(PixelmonWrapper pokemon)
pokemon
- The Pokémon to get the position of.protected void loadParty(PartyStorage party)
party
- The storage to load Pokémon from.protected void loadParty(java.util.List<Pokemon> party)
party
- The Pokémon to use for the participant's party.protected void loadSingle(Pokemon pokemon)
pokemon
- The Pokémon to use for the participant's party.public PixelmonWrapper getPokemonFromParty(java.util.UUID uuid)
uuid
- The UUID to get a Pokémon with.protected PixelmonWrapper getPokemonFromParty(PixelmonEntity entity)
entity
- The Pokémon to get a PixelmonWrapper
from.public net.minecraft.world.World getWorld()
public boolean addSwitchingOut(PixelmonWrapper pw)
pw
- The Pokémon to add to the list.public void switchAllFainted()
public PixelmonWrapper getRandomPartyPokemon()
public boolean canMegaEvolve()
public boolean canDynamax()
public BattleAIBase getBattleAI()
public void setBattleAI(BattleAIBase ai)
public void sendMessage(PixelmonPacket message)
message
- The packet to send to this playerpublic void onEndTurn(BattleController bc)
public boolean onTakeTurn(BattleController bc, PixelmonWrapper pw)
public boolean onUseAttack(BattleController bc, PixelmonWrapper pw)
public void onUseAttackPost(BattleController bc, PixelmonWrapper pw)
public boolean onAddStatus(BattleController bc, PixelmonWrapper user, PixelmonWrapper target, StatusBase status)
public float onHit(PixelmonWrapper source, float damage, DamageTypeEnum damageType)
public void onOpponentKO(BattleController bc, PixelmonWrapper pw)
public boolean onTargeted(PixelmonWrapper user, Attack attack)
public boolean onUseAttackOther(BattleController bc, Attack attack, BattleParticipant bp, PixelmonWrapper user)
public void onSwitchIn(BattleController bc, PixelmonWrapper pw)
public void retrieveEntityDuringBattleUnlessRiding(PixelmonWrapper pw)
pw
- The Pokémon that is currently in battle that the player may or may not be riding upon.