java.lang.Object
com.pixelmonmod.pixelmon.battles.controller.participants.PixelmonWrapper

public class PixelmonWrapper extends Object
Wrapper for a Pokémon in battle.
  • Field Details

    • entity

      public PixelmonEntity entity
      The Pokémon wrapped by this wrapper. Can be null if the Pokémon is not currently sent out.
    • pokemon

      public Pokemon pokemon
      The Pokemon object underlying this wrapper.
    • initialCopyOfPokemon

      public Pokemon initialCopyOfPokemon
    • bc

      public BattleController bc
      The battle controller for the battle the Pokémon is in.
    • attack

      public Attack attack
      The Pokémon's current attack.
    • selectedAttack

      public Attack selectedAttack
      The attack the Pokémon selected for the turn. Used for moves that call other moves.
    • lastAttack

      public Attack lastAttack
      The Pokémon's previous attack.
    • lastSimulatedAttack

      public Attack lastSimulatedAttack
      The Pokémon's previous attack that the AI simulated.
    • lastTempAttack

      public Attack lastTempAttack
      The Pokémon's previous temp attack.
    • lastSimulatedTempAttack

      public Attack lastSimulatedTempAttack
      The Pokémon's previous temp attack that the AI simulated.
    • lastTargets

      public List<PixelmonWrapper> lastTargets
    • lastSimulatedTargets

      public List<PixelmonWrapper> lastSimulatedTargets
    • targetIndex

      public int targetIndex
      The index of the current target of an attack when iterating through targets.
    • attackSucceeded

      public boolean attackSucceeded
      Whether the last attack this pokemon performed succeeded.
    • usedMoves

      public Set<Attack> usedMoves
      The moves used by the Pokémon since it last entered battle.
    • escapeAttempts

      public int escapeAttempts
      The number of times the Pokémon has attempted to escape in the battle.
    • damageTakenThisTurn

      public int damageTakenThisTurn
      The amount of damage the Pokémon has taken in the turn.
    • amountOfTimesHit

      public int amountOfTimesHit
      The amount of times the Pokémon has taken an instance of damage over the entire battle.
    • priority

      public float priority
      The Pokémon's priority in the turn.
    • canAttack

      public boolean canAttack
      Whether the Pokémon can attack in the turn.
    • willTryFlee

      public boolean willTryFlee
      Whether the Pokémon will try to flee in the turn.
    • isSwitching

      public boolean isSwitching
      Whether the Pokémon is switching in the turn.
    • willEvolve

      public boolean willEvolve
      Whether the Pokémon will evolve during the turn.
    • nextSwitchIsMove

      public boolean nextSwitchIsMove
      Whether the Pokémon is switching out because of the effects of a move.
    • willUseItemPokemon

      public UUID willUseItemPokemon
      The UUID of the Pokémon.
    • willUseItemInStack

      public net.minecraft.world.item.ItemStack willUseItemInStack
      The item that is being used on the Pokémon.
    • willUseItemInStackInfo

      public int willUseItemInStackInfo
      An additional argument for the item used on the Pokémon.
    • hasBeenInBattle

      public boolean hasBeenInBattle
      Whether the Pokémon has already been in this battle.
    • isTempAttack

      public boolean isTempAttack
      Whether the Pokémon is performing a called move.
    • wait

      public boolean wait
      Whether the Pokémon is currently waiting for other combatants to make a move in battle.
    • onBattlefield

      public boolean onBattlefield
      Whether the Pokémon is fighting on the field of battle instead of in the party.
    • battlePosition

      public int battlePosition
      The Pokémon's position in battle.
    • addedType

      public Element addedType
      A temporary type added to the Pokémon.
    • tempAbility

      public Ability tempAbility
      The temporary Ability of the Pokémon if it is changed.
    • temporaryMoveset

      public Moveset temporaryMoveset
    • targets

      public List<PixelmonWrapper> targets
      The targets of the Pokémon's attack.
    • newPokemonUUID

      public UUID newPokemonUUID
      The Pokémon that this Pokémon will switch into.
    • inMultipleHit

      public boolean inMultipleHit
      Whether the user is in the middle of a multi-hit move.
    • inParentalBond

      public boolean inParentalBond
      Whether the user is on the first hit of Parental Bond.
    • protectsInARow

      public int protectsInARow
      The number of times the Pokémon has successfully used Protect (or similar moves) in a row.
    • hasAwardedExp

      public boolean hasAwardedExp
      Whether the Pokémon has awarded experience upon fainting.
    • switchedThisTurn

      public boolean switchedThisTurn
      Whether the Pokémon switched in during the current turn.
    • switchedLastTurn

      public boolean switchedLastTurn
      Whether the Pokémon switched in during the previous turn.
    • evolvedThisTurn

      public boolean evolvedThisTurn
      Whether the Pokémon mega evolved/dynamaxed during this turn.
    • faintedAtEndOfTurn

      public boolean faintedAtEndOfTurn
      Whether the Pokémon fainted due to end of turn effects.
    • changeBurmy

      public boolean changeBurmy
      Whether the Pokémon is a Burmy that should change form after the battle.
    • choiceLocked

      public Attack choiceLocked
      The attack that a choice item has restricted the holder to.
    • choiceSwapped

      public boolean choiceSwapped
      Whether the Pokémon's choice item was just swapped with another.
    • metronomeBoost

      public int metronomeBoost
      The current boost from a Metronome held item.
    • eatenBerry

      public boolean eatenBerry
      Whether the Pokémon has eaten a Berry during the battle.
    • eatingBerry

      public boolean eatingBerry
      Whether the Pokémon is currently eating a Berry to cure status.
    • forceEatingBerry

      public boolean forceEatingBerry
      Whether the Pokémon is currently eating a Berry regardless of benefits
    • lastDirectDamage

      public int lastDirectDamage
      The amount of direct damage that was dealt the last time the Pokémon was attacked in the current turn.
    • lastHP

      public int lastHP
      The amount of HP this pokemon had before recieving damage.
    • beginingOfTurnHP

      protected int beginingOfTurnHP
    • lastDirectCategory

      public AttackCategory lastDirectCategory
      The damage category of the last direct damage that was dealt the Pokémon was attacked in the current turn.
    • lastDirectPosition

      public int lastDirectPosition
      The last position of the Pokémon in the battle.
    • evolution

      public EvolutionQuery evolution
      The query used to Mega Evolve the Pokémon.
    • temporaryPokemonLevel

      protected PokemonLevel temporaryPokemonLevel
    • type

      public List<Element> type
      The Pokémon's type.
    • isMega

      public boolean isMega
      Whether the Pokémon is Mega Evolved.
    • isDynamax

      public int isDynamax
      Whether the Pokémon is Dynamaxed (1)/Gigantamaxed (2).
    • dynamaxTurns

      public int dynamaxTurns
    • prevForm

      public Stats prevForm
    • prevPaletteName

      public String prevPaletteName
    • animateHP

      public boolean animateHP
      Whether to animate hp changes client-side.
    • usingZ

      public boolean usingZ
      Whether or not the Pokémon is using a Z-Move.
    • usingZPower

      public boolean usingZPower
    • zMove

      public ZMove zMove
    • ignoringZCrystal

      public boolean ignoringZCrystal
    • skipZConvert

      public boolean skipZConvert
    • shields

      public int shields
      Barriers for Raid Pokémon. Setting these values outside of a Raid is undefined behaviour, and probably won't do anything.
    • maxShields

      public int maxShields
  • Constructor Details

    • PixelmonWrapper

      public PixelmonWrapper(BattleParticipant participant, PixelmonEntity entity, int partyPosition)
      Constructs the wrapper.
      Parameters:
      participant - The battle participant owning the Pokémon.
      entity - The Pokémon wrapped by the wrapper.
      partyPosition - The Pokémon's position in the party.
    • PixelmonWrapper

      public PixelmonWrapper(BattleParticipant participant, PixelmonEntity pixelmon, int partyPosition, BattleController bc)
      Constructs up the wrapper.
      Parameters:
      participant - The battle participant owning the Pokémon.
      pixelmon - The Pokémon wrapped by the wrapper.
      partyPosition - The Pokémon's position in the party.
      bc - The battle controller of the battle the Pokémon is in.
    • PixelmonWrapper

      public PixelmonWrapper(BattleParticipant participant, Pokemon pokemon, int partyPosition)
      Constructs the wrapper.
      Parameters:
      participant - The battle participant owning the Pokémon.
      pokemon - The Pokemon data of the Pokémon wrapped by the wrapper.
      partyPosition - The Pokémon's position in the party.
    • PixelmonWrapper

      public PixelmonWrapper(PixelmonWrapper pw)
      Makes a deep copy of the PixelmonWrapper object
      Parameters:
      pw - The Pokémon that is being assigned
  • Method Details

    • getStats

      public PermanentStats getStats()
      Gets the Pokémon's stat numbers.
      Returns:
      The Pokémon's stat numbers.
    • getBattleStats

      public BattleStats getBattleStats()
      Gets the Pokémon's stats and stat modifiers.
      Returns:
      The Pokémon's stats and stat modifiers.
    • getInitialType

      public List<Element> getInitialType()
      Gets the original type of the Pokémon if it is changed.
      Returns:
      The original type of the Pokémon if it is changed.
    • getFriendship

      public int getFriendship()
      Gets the object that tracks friendship.
      Returns:
      The object that tracks friendship.
    • getAttackers

      public Set<PixelmonWrapper> getAttackers()
      Gets Pokémon that this Pokémon has faced during battle.
      Returns:
      A set of Pokémon that this Pokémon has faced during battle.
    • getPokerus

      public Optional<Pokerus> getPokerus()
    • hasType

      public boolean hasType(Element... types)
      Checks if the Pokémon's type is one of a list of types.
      Parameters:
      types - The types to compare the Pokémon's types against.
      Returns:
      Whether the Pokémon's type is one of a list of types.
    • clearTurnVariables

      public void clearTurnVariables()
      Resets variables that keep track of aspects within turns.
    • setMoveTargets

      public void setMoveTargets(PixelmonWrapper... pokemon)
      Sets the targets of the Pokémon's attack.
      Parameters:
      pokemon - The targeted Pokémon.
    • selectAIAction

      public void selectAIAction()
      Decides what action the AI will take during battle.
    • skipsTurn

      public boolean skipsTurn()
      Checks if the turn is skipped for the Pokémon
      Returns:
      If the turn should be skipped
    • canEvolve

      public boolean canEvolve()
    • stopsForcedSwitches

      public boolean stopsForcedSwitches(PixelmonWrapper cause)
      Checks if the Pokémon prevents being forced out
      Returns:
      If the Pokémon prevents being forced to switch
    • chooseMove

      public void chooseMove()
      Chooses a move to use depending on the AI.
    • chooseMove

      public void chooseMove(MoveChoice moveChoice)
      Prepares a move based on a move choice.
      Parameters:
      moveChoice - The move choice to prepare a move with.
    • getTargets

      public List<PixelmonWrapper> getTargets(Attack chosenAttack)
      Randomly selects targets for an attack.
      Parameters:
      chosenAttack - The attack to find targets for.
      Returns:
      An ArrayList containing the targets for the attack.
    • useAttack

      public void useAttack()
      Uses an attack and processes the results of the attack.
    • useAttack

      public void useAttack(boolean affectPP)
      Uses an attack and processes the results of the attack.
      Parameters:
      affectPP - Whether PP should be deducted after the attack is used.
    • targetNewNonFaintedPokemon

      public List<PixelmonWrapper> targetNewNonFaintedPokemon(List<PixelmonWrapper> correctedTargets, PixelmonWrapper target)
      . In the event this Pokémon only has one target, attempt to find a new target on the enemy team, but only if the enemy team was the targeted team in the first place.
      Parameters:
      correctedTargets - A list of the Pokémon that will be the new target(s).
    • savePreviousAttackValues

      public void savePreviousAttackValues()
      Saves all the data on this attack to the info for the previous attack.
    • reducePP

      public boolean reducePP(boolean reducePP, boolean affectPP)
      Reduce the Power Points (PP) of a move after it has been used.
      Parameters:
      reducePP - Whether the move reduces PP.
      affectPP - Whether the PP will be reduced this turn.
      Returns:
      Returns true if the attack's pp was reduced.
    • registerZMove

      public boolean registerZMove()
      Register a Z-Move as used after it has been used.
      Returns:
      Whether the game attempted to register a Z-Move.
    • useAttackOnly

      public MoveResults[] useAttackOnly()
      Uses an attack without doing anything else.
      Returns:
      An array of results of the attack.
    • useItem

      public void useItem()
      Uses an item on the Pokémon.
    • useTempAttack

      public void useTempAttack(Attack tempAttack)
      Used if the attack used was called by another attack.
      Parameters:
      tempAttack - The attack to use.
    • useTempAttack

      public void useTempAttack(Attack tempAttack, PixelmonWrapper target)
      Used if the attack used was called by another attack.
      Parameters:
      tempAttack - The attack to use.
      target - The target of the attack.
    • useTempAttack

      public void useTempAttack(Attack tempAttack, List<PixelmonWrapper> targets)
      Used if the attack used was called by another attack.
      Parameters:
      tempAttack - The attack to use.
      targets - The targets of the attack.
    • useTempAttack

      public void useTempAttack(Attack tempAttack, List<PixelmonWrapper> targets, boolean affectPP)
      Used if the attack used was called by another attack.
      Parameters:
      tempAttack - The attack to use.
      targets - The targets of the attack.
    • turnTick

      public void turnTick()
      Handles end-of-turn effects.
    • endTurn

      public void endTurn()
    • getParticipant

      public BattleParticipant getParticipant()
      Returns the Pokémon's battle participant.
      Returns:
      The Pokémon's battle participant.
    • doSwitch

      public PixelmonWrapper doSwitch()
      Handles switching.
      Returns:
      The Pokémon who switched in.
    • beforeSwitch

      public void beforeSwitch(PixelmonWrapper switchingIn)
      Handles effects that occur just before switching out.
    • afterSwitch

      public void afterSwitch()
    • afterSwitch

      public void afterSwitch(PixelmonWrapper oldPokemon)
      Handles effects that occur just after switching out.
    • switchThisTurn

      public boolean switchThisTurn()
      Switches the Pokémon for start-of-turn switches. Move based switches are handled in their move effects instead.
      Returns:
      Whether the Pokémon is switching this turn.
    • findPixelmon

      protected PixelmonWrapper findPixelmon(UUID uuid)
    • forcePursuitAttackers

      public void forcePursuitAttackers()
      Force a Pokémon targeting the current Pokémon with Pursuit to attack.
    • takeTurn

      public void takeTurn()
      Does the Pokémon's action for the turn.
    • dynamax

      public boolean dynamax(boolean revert, float healthPercentage)
    • megaEvolve

      public boolean megaEvolve()
      Mega Evolves the Pokémon.
    • canAttackThisTurn

      public boolean canAttackThisTurn(Attack a)
    • setAttack

      public void setAttack(int buttonId, List<PixelmonWrapper> targets, boolean megaEvolving)
      Sets the Pokémon's attack to the button pressed.
      Parameters:
      buttonId - The ID of the pressed button.
      targets - The attack's targets.
      megaEvolving - Whether the Pokémon will Mega Evolve when using the attack.
    • setAttack

      public void setAttack(Attack attack, List<PixelmonWrapper> targets, boolean willEvolve)
      Sets the Pokémon's attack to an attack.
      Parameters:
      attack - The attack to be used.
      targets - The attack's target.
      willEvolve - Whether the Pokémon will evolve(Mega, ultraburst, dynamax) when using the attack.
    • isFainted

      public boolean isFainted()
      Returns whether the Pokémon is fainted.
      Returns:
      Whether the Pokémon is fainted.
    • isAlive

      public boolean isAlive()
      Returns whether the Pokémon can battle.
      Returns:
      Whether the Pokémon can battle.
    • setStruggle

      public void setStruggle(List<PixelmonWrapper> targets)
      Sets the Pokémon's attack to Struggle.
      Parameters:
      targets - The targets of Struggle.
    • returnToBasePos

      public void returnToBasePos()
      Returns the Pokémon to where it was at the start of the battle.
    • setBasePosition

      public void setBasePosition(double[] ds)
      Sets the Pokémon's initial position.
      Parameters:
      ds - The initial position.
    • setTempType

      public void setTempType(Element newType)
      Sets a temporary type for the Pokémon if it changes during battle.
      Parameters:
      newType - The Pokémon's new temporary type.
    • setTempType

      public void setTempType(List<Element> newType)
      Sets a temporary type for the Pokémon if it changes during battle.
      Parameters:
      newType - The Pokémon's new temporary type.
    • setTempAbility

      public void setTempAbility(Ability newAbility)
      Sets a temporary Ability for the Pokémon if its Ability changes during battle.
      Parameters:
      newAbility - The Ability for the Pokémon to receive.
    • setTempAbility

      public void setTempAbility(Ability newAbility, boolean formChange)
      Sets a temporary Ability for the Pokémon if its Ability changes during battle.
      Parameters:
      newAbility - The Ability for the Pokémon to receive.
      formChange - Whether the Ability is the result of a form change.
    • resetOnSwitch

      public void resetOnSwitch()
      Resets Pokémon attributes when switching.
    • getWeight

      public float getWeight(boolean ignoreAbility)
      Returns the Pokémon's weight, factoring in modifications from other sources.
      Parameters:
      ignoreAbility - Whether to ignore the Pokémon's Ability when calculating weight.
      Returns:
      The Pokémon's weight.
    • consumeItem

      public void consumeItem()
      Consumes the Pokémon's held item.
    • setConsumedItem

      public void setConsumedItem(HeldItem heldItem)
      Sets the Pokémon's most recent consumed item.
      Parameters:
      heldItem - The consumed held item.
    • getConsumedItem

      public HeldItem getConsumedItem()
      Returns the Pokémon's most recent consumed held item.
      Returns:
      The Pokémon's most recent consumed held item, or null if there isn't one.
    • setNewHeldItem

      public void setNewHeldItem(HeldItem heldItem)
      Sets a new held item for the Pokémon during battle.
      Parameters:
      heldItem - The new held item for the Pokémon.
    • isGrounded

      public boolean isGrounded()
      Determines whether the Pokémon is grounded by an effect, negating being airborne.
      Returns:
      Whether the Pokémon is grounded.
    • isAirborne

      public boolean isAirborne()
      Checks if the Pokémon is airborne, preventing Ground-type attacks from hitting it.
      Returns:
      Whether the Pokémon is airborne.
    • addTeamStatus

      public boolean addTeamStatus(StatusBase status, PixelmonWrapper cause)
      Adds a team status to all Pokémon on this Pokémon's side of the field.
      Parameters:
      status - The status to add.
      cause - The Pokémon who caused the status to occur.
      Returns:
      Whether the status was added successfully.
    • removeTeamStatus

      public boolean removeTeamStatus(StatusBase status)
      Removes a team status from Pokémon on this Pokémon's side of the field.
      Parameters:
      status - The status to remove.
    • removeTeamStatus

      public boolean removeTeamStatus(StatusType... statuses)
      Removes team statuses from Pokémon on this Pokémon's side of the field.
      Parameters:
      statuses - The statuses to remove.
    • getTeamPokemon

      public List<PixelmonWrapper> getTeamPokemon()
      Gets all Pokémon on this Pokémon's side of the battle.
      Returns:
      A list of all Pokémon on this Pokémon's side of the battle.
    • getTeamPokemonExcludeSelf

      public List<PixelmonWrapper> getTeamPokemonExcludeSelf()
      Gets all Pokémon on this Pokémon's side of the battle excluding itself.
      Returns:
      A list of all Pokémon on this Pokémon's side of the battle excluding itself.
    • getOpponentPokemon

      public List<PixelmonWrapper> getOpponentPokemon()
      Gets all Pokémon on the opposite side of the battle.
      Returns:
      A list of all Pokémon on the opposite side of the battle.
    • isAlly

      public boolean isAlly(PixelmonWrapper pokemon)
    • isOpponent

      public boolean isOpponent(PixelmonWrapper pokemon)
    • getControlledIndex

      public int getControlledIndex()
      Returns the index of the Pokémon in its participant's controlled Pokémon array.
      Returns:
      The index of the Pokémon in its participant's controlled Pokémon array, or -1 if the Pokémon is not found.
    • getBattleAI

      public BattleAIBase getBattleAI()
      Gets the battle AI of the Pokémon's participant.
      Returns:
      The battle AI of the Pokémon's participant.
    • setUpSwitchMove

      public void setUpSwitchMove()
      Sets up variables for the Pokémon to switch out due to a move.
    • forceRandomSwitch

      public void forceRandomSwitch(UUID switchPokemon)
      Randomly switches the Pokémon out for another.
      Parameters:
      switchPokemon - The Pokémon replacing this Pokémon.
    • isImmuneToPowder

      public boolean isImmuneToPowder()
      Checks if the Pokémon is immune to powder moves.
      Returns:
      Whether the Pokémon is immune to powder moves.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • setMoved

      public void setMoved(boolean moved)
      Sets if the Pokémon has already moved during the turn.
    • hasMoved

      public boolean hasMoved()
      Checks if the Pokémon has already moved during the turn.
      Returns:
      Whether the Pokémon has already moved during the turn.
    • isFirstTurn

      public boolean isFirstTurn()
      Checks if it is the first turn that the Pokémon has been out.
      Returns:
      Whether it is the first turn that the Pokémon has been out.
    • isMovingLast

      public boolean isMovingLast()
      Checks if the pokemon is moving last of everyone this turn.
      Returns:
      Whether the user is the last one to move.
    • isSameTeam

      public boolean isSameTeam(PixelmonWrapper other)
      Checks if a Pokémon is on the same team as this Pokémon.
      Parameters:
      other - The Pokémon to check.
      Returns:
      Whether the Pokémon is on the same team as this Pokémon.
    • getMoveset

      public Moveset getMoveset()
      Returns the Pokémon's moveset. If the Pokémon has a temporary moveset due to an in-battle effect, the temporary moveset is returned.
      Returns:
      The Pokémon's moveset.
    • setTemporaryMoveset

      public void setTemporaryMoveset(Moveset moveset)
    • validateAction

      public void validateAction() throws BattleException
      Throws:
      BattleException
    • removeStatus

      public boolean removeStatus(StatusType s)
      Removes the specified status from the Pokémon.
      Parameters:
      s - The status to remove.
      Returns:
      Whether the Pokémon had the status to begin with.
    • removeStatus

      public boolean removeStatus(StatusType s, boolean message)
      Removes the specified status from the Pokémon.
      Parameters:
      s - The status to remove.
      message - Whether to send message or not.
      Returns:
      Whether the Pokémon had the status to begin with.
    • removeStatuses

      public boolean removeStatuses(StatusType... statuses)
      Removes the specified statuses from the Pokémon.
      Parameters:
      statuses - The statuses to remove.
      Returns:
      Whether a status was removed.
    • removeStatuses

      public boolean removeStatuses(boolean showMessage, StatusType... statuses)
      Removes the specified statuses from the Pokémon.
      Parameters:
      showMessage - Whether to show messages when statuses are removed.
      statuses - The statuses to remove.
      Returns:
      Whether a status was removed.
    • removeStatus

      public void removeStatus(int i)
      Removes the status at the specified index.
      Parameters:
      i - The index of the status to remove.
    • getStatus

      public StatusBase getStatus(StatusType type)
      Gets the specified status on the Pokémon.
      Parameters:
      type - The status to get.
      Returns:
      The corresponding status, or null if the Pokémon doesn't have the status.
    • hasStatus

      public boolean hasStatus(StatusType... statuses)
      Checks if the Pokémon has any of the specified statuses.
      Parameters:
      statuses - The statuses to check.
      Returns:
      Whether the Pokémon has any of the statuses.
    • hasAnyStatusPreventingAttack

      public boolean hasAnyStatusPreventingAttack(PixelmonWrapper attacker)
      Checks if the Pokémon has any status blocking the attacker's current attack.
      Parameters:
      attacker - The pokemon attacking this one.
      Returns:
      Whether the Pokémon has any status blocking the attack.
    • hasNonVolatileStatus

      public boolean hasNonVolatileStatus()
      Returns whether the Pokémon has a non-volatile status.
      Returns:
      Whether the Pokémon has a non-volatile status.
    • hasNonVolatileStatus

      public boolean hasNonVolatileStatus(boolean includeComatose)
      Returns whether the Pokémon has a non-volatile status.
      Parameters:
      includeComatose - Whether Comatose is valid or not for this.
      Returns:
      Whether the Pokémon has a non-volatile status.
    • countStatuses

      public int countStatuses(StatusType... statuses)
      Counts the number of statuses from a list that the Pokémon has.
      Parameters:
      statuses - The statuses to take into account when counting.
      Returns:
      The number of statuses from the given list that the Pokémon has.
    • getStatusSize

      public int getStatusSize()
      Returns the number of statuses the Pokémon has.
      Returns:
      The number of statuses the Pokémon has.
    • getStatuses

      public List<StatusBase> getStatuses()
      Returns the Pokémon's statuses.
      Returns:
      The Pokémon statuses as a list.
    • getStatus

      public StatusBase getStatus(int i)
      Returns the Pokémon's status at the specified index.
      Parameters:
      i - The index of the status.
      Returns:
      The status at index i.
    • getStatusIndex

      public int getStatusIndex(StatusType findStatus)
      Returns the index of the status.
      Parameters:
      findStatus - The status to get the index of.
      Returns:
      The index of the status, or -1 if the Pokémon does not have the status.
    • getPrimaryStatus

      public StatusPersist getPrimaryStatus()
      Returns the Pokémon's non-volatile status.
      Returns:
      The Pokémon's non-volatile status, or null if the Pokémon does not have one.
    • setStatus

      public void setStatus(int i, StatusBase newStatus)
      Changes a status into a different status.
      Parameters:
      i - The index of the old status.
      newStatus - The status to turn the old status into.
    • clearStatus

      public void clearStatus()
      Removes all statuses from the Pokémon.
    • addStatus

      public boolean addStatus(StatusBase e, PixelmonWrapper opponent)
      Adds a status to the Pokémon.
      Parameters:
      e - The status to add.
      opponent - The Pokémon who caused the status.
      Returns:
      Whether the status was successfully added.
    • addStatus

      public boolean addStatus(StatusBase e, PixelmonWrapper opponent, net.minecraft.network.chat.MutableComponent message)
      Adds a status to the Pokémon.
      Parameters:
      e - The status to add.
      opponent - The Pokémon who caused the status.
      message - The message to display when the status is added.
      Returns:
      Whether the status was successfully added.
    • sendStatusPacket

      public void sendStatusPacket(int statusID)
      Sends a status update to the client.
      Parameters:
      statusID - The ID of the status to add, or -1 to remove it.
    • removeStatus

      public void removeStatus(StatusBase e)
      Removes the status from the Pokémon.
      Parameters:
      e - The status to remove.
    • removeStatus

      public void removeStatus(StatusBase e, boolean showMessage)
      Removes the status from the Pokémon.
      Parameters:
      e - The status to remove.
    • removePrimaryStatus

      public StatusBase removePrimaryStatus()
      Removes the Pokémon's non-volatile status and returns it.
      Returns:
      The Pokémon's former non-volatile status, or null if it did not have one.
    • removePrimaryStatus

      public StatusBase removePrimaryStatus(boolean showMessage)
      Removes the Pokémon's non-volatile status and returns it.
      Parameters:
      showMessage - Whether to show a message when a status is cured.
      Returns:
      The Pokémon's former non-volatile status, or null if it did not have one.
    • cannotHaveStatus

      public boolean cannotHaveStatus(StatusBase t, PixelmonWrapper opponent)
      Checks whether the Pokémon can receive the status.
      Parameters:
      t - The status to check.
      opponent - The Pokémon causing the status.
      Returns:
      Whether the Pokémon can receive the status.
    • cannotHaveStatus

      public boolean cannotHaveStatus(StatusBase t, PixelmonWrapper opponent, boolean ignorePrimaryOverlap)
      Checks whether the Pokémon can receive the status.
      Parameters:
      t - The status to check.
      opponent - The Pokémon causing the status.
      ignorePrimaryOverlap - Whether to ignore the restriction that primary statuses cannot overlap with each other.
      Returns:
      Whether the Pokémon can receive the status.
    • getEntryHazards

      public List<EntryHazard> getEntryHazards()
      Gets the entry hazards on the Pokémon's side of the field.
      Returns:
      A list of the entry hazards on the Pokémon's side of the field.
    • updateBattleDamage

      public void updateBattleDamage(int damage)
      Updates the client with changes to the Pokémon's health in battle.
      Parameters:
      damage - The damage that was dealt to the Pokémon.
    • getEffectiveTypes

      public List<Element> getEffectiveTypes(PixelmonWrapper user, PixelmonWrapper target)
      Modifies the Pokémon's type to calculate type effectiveness if there are statuses that do so.
      Parameters:
      user - The attack's user.
      target - The attack's target.
      Returns:
      The target's type after applying the statuses.
    • doBattleDamage

      public float doBattleDamage(PixelmonWrapper source, float damage, DamageTypeEnum damageType)
      Damages the Pokémon in battle.
      Parameters:
      source - The Pokémon who caused the damage.
      damage - The amount of damage to deal.
      damageType - The type of damage that is to be dealt.
      Returns:
      The amount of damage dealt.
    • getAbility

      public Ability getAbility()
      Gets the Pokémon's Ability.
      Returns:
      The Pokémon's Ability.
    • getBattleAbility

      public Ability getBattleAbility()
      Gets the Pokémon's active Ability in battle.
      Returns:
      The Pokémon's active Ability in battle.
    • getBattleAbility

      public Ability getBattleAbility(PixelmonWrapper moveUser)
      Gets the Pokémon's Ability in battle.
      Parameters:
      moveUser - The Pokémon using a move on this Pokémon.
      Returns:
      The Pokémon's Ability in battle.
    • getBattleAbility

      public Ability getBattleAbility(boolean canIgnore)
      Gets the Pokémon's Ability in battle.
      Parameters:
      canIgnore - Whether to acknowledge if the Pokémon's Ability is inactive.
      Returns:
      The Pokémon's Ability in battle.
    • getBattleAbility

      public Ability getBattleAbility(boolean canIgnore, PixelmonWrapper moveUser)
      Gets the Pokémon's Ability in battle.
      Parameters:
      canIgnore - Whether to acknowledge if the Pokémon's Ability is inactive.
      moveUser - The Pokémon using a move on this Pokémon.
      Returns:
      The Pokémon's Ability in battle.
    • hasHeldItem

      public boolean hasHeldItem()
      Checks if the Pokémon has a held item.
      Returns:
      Whether the Pokémon has a held item.
    • getHeldItem

      public HeldItem getHeldItem()
      Gets the type of the item the Pokémon is holding.
      Returns:
      The type of the item the Pokémon is holding.
    • getUsableHeldItem

      public HeldItem getUsableHeldItem()
      Gets the type of the item the Pokémon is holding if it is currently usable.
      Returns:
      The type of the item the Pokémon is holding if it is currently usable, or {#link NoItem} otherwise.
    • removeHeldItem

      public void removeHeldItem()
      Removes the Pokémon's held item.
    • setHeldItem

      public void setHeldItem(HeldItem newItem)
      Sets the Pokémon's held item.
      Parameters:
      newItem - The held item to set.
    • setHeldItem

      public void setHeldItem(net.minecraft.world.item.ItemStack itemStack)
      Sets the Pokémon's held item.
      Parameters:
      itemStack - The held item to set.
    • canMegaEvolve

      public boolean canMegaEvolve()
      Checks if the Pokémon can Mega Evolve with its held item.
      Returns:
      Whether the Pokémon can Mega Evolve with its held item.
    • canUltraBurst

      public boolean canUltraBurst()
      Checks if the Pokémon can Ultra Burst with its held item.
      Returns:
      Whether the Pokémon can Ultra Burst with its held item.
    • canDynamax

      public boolean canDynamax()
      Checks if the Pokémon can Dynamax.
      Returns:
      Whether the Pokémon can Dynamax.
    • canGigantamax

      public boolean canGigantamax()
      Checks if the Pokémon can Gigantamax.
      Returns:
      Whether the Pokémon can Gigantamax.
    • canMegaEvolve

      public static boolean canMegaEvolve(net.minecraft.world.item.ItemStack heldItem, Species pokemon, String form)
      Checks if a Pokémon can Mega Evolve with a held item.
      Parameters:
      heldItem - The Pokémon's held item.
      pokemon - The Pokémon's pokemon.
      form - The Pokémon's form index.
      Returns:
      Whether the Pokémon can Mega Evolve with the specified held item.
    • canUseZMove

      public static boolean canUseZMove(net.minecraft.world.item.ItemStack heldItem)
    • canMegaEvolve

      public static boolean canMegaEvolve(HeldItem heldItem, Species species, String form)
      Checks if a Pokémon can Mega Evolve with a held item.
      Parameters:
      heldItem - The Pokémon's held item.
      species - The Pokémon's pokemon.
      form - The Pokémon's form index.
      Returns:
      Whether the Pokémon can Mega Evolve with the specified held item.
    • canUltraBurst

      public static boolean canUltraBurst(Species species, HeldItem heldItem, Stats form)
      Checks if a Pokémon can Ultra Burst (Necrozma only) with a held item.
      Parameters:
      species - The Pokémon's pokemon.
      heldItem - The Pokémon's held item.
      form - The Pokémon's form index.
      Returns:
      Whether the Pokémon can Ultra Burst with the specified held item.
    • canDynamax

      public static boolean canDynamax(Stats form, HeldItem item)
      Checks if a Pokémon can Dynamax.
      Parameters:
      form - The Pokémon's form.
      Returns:
      Whether the Pokémon can Dynamax.
    • canGigantamax

      public static boolean canGigantamax(boolean gigantamaxFactor, Species species, Stats form)
      Checks if a Pokémon can Gigantamax.
      Parameters:
      gigantamaxFactor - The Pokémon's Gigantamax Factor.
      species - The Pokémon's pokemon.
      form - The Pokémon's form.
      Returns:
      Whether the Pokémon can Gigantamax.
    • hasCompatibleMegaStone

      public boolean hasCompatibleMegaStone()
      Checks if the Pokémon is holding a Mega Stone that it can Mega Evolve with.
      Returns:
      Whether the Pokémon is holding a Mega Stone that it can Mega Evolve with.
    • hasCompatibleMegaStone

      public static boolean hasCompatibleMegaStone(HeldItem heldItem, Stats form)
      Checks if a Pokémon is holding a Mega Stone that it can Mega Evolve with.
      Parameters:
      heldItem - The Pokémon's held item.
      form - The Pokémon's form
      Returns:
      Whether the Pokémon is holding a Mega Stone that it can Mega Evolve with.
    • isItemRemovable

      public boolean isItemRemovable(PixelmonWrapper user)
      Checks if this Pokémon's held item can be removed during battle.
      Parameters:
      user - The Pokémon attempting to remove the item.
      Returns:
      Whether the Pokémon's held item can be removed during battle.
    • isItemGivable

      public boolean isItemGivable(HeldItem item)
      Checks if this held item can be given to this pokemon during battle. Used by Tick, Bestow, Switcheroo, Thief, Magician, Pickpocket, and Symbiosis. Should normally be paired with isItemRemovable(com.pixelmonmod.pixelmon.battles.controller.participants.PixelmonWrapper)
      Parameters:
      item - The held item being given to this Pokémon.
      Returns:
      Whether the held item can be given to this Pokémon during battle.
    • hasSpecialItem

      public boolean hasSpecialItem(PixelmonWrapper user)
      Checks if the Pokémon has a special item that cannot be removed in battle by the given user.
      Returns:
      Whether the Pokémon has a special item that cannot be removed in battle.
    • getNickname

      @Deprecated public String getNickname()
      Deprecated.
      Gets the Pokémon's nickname.
      Returns:
      The Pokémon's nickname.
    • getFormattedNickname

      public net.minecraft.network.chat.Component getFormattedNickname()
    • getRealNickname

      @Deprecated public String getRealNickname()
      Deprecated.
      Gets the Pokémon's nickname, ignoring Illusion.
      Returns:
      The Pokémon's nickname, ignoring Illusion.
    • getRealFormattedNickname

      public net.minecraft.network.chat.Component getRealFormattedNickname()
      Gets the Pokémon's nickname, ignoring Illusion.
      Returns:
      The Pokémon's nickname, ignoring Illusion.
    • getGender

      public Gender getGender()
      Gets the Pokémon's gender.
      Returns:
      The Pokémon's gender.
    • getHealth

      public int getHealth(boolean ignoreDynamax)
      Returns the current hp of the Pokémon.
      Parameters:
      ignoreDynamax - Whether to ignore the increase to maximum hp from Dynamax or not.
      Returns:
      The current hp of the Pokémon.
    • getHealth

      public int getHealth()
    • getMaxHealth

      public int getMaxHealth(boolean ignoreDynamax)
      Returns the maximum hp of the Pokémon.
      Parameters:
      ignoreDynamax - Whether to ignore the increase to maximum hp from Dynamax or not.
      Returns:
      The maximum hp of the Pokémon.
    • recalculateMaxHP

      public void recalculateMaxHP()
    • getMaxHealth

      public int getMaxHealth()
    • getDynamaxHealthMod

      public double getDynamaxHealthMod()
    • getHealthPercent

      public float getHealthPercent()
      Returns the Pokémon's current health percentage.
      Returns:
      The Pokémon's current health percentage.
    • getHealthPercent

      public float getHealthPercent(float amount)
      Returns the Pokémon's health percentage compared to a certain amount.
      Parameters:
      amount - The amount of health to get a percentage for.
      Returns:
      The Pokémon's health percentage compared to the specified amount.
    • getHealPercent

      public float getHealPercent(float amount)
      Returns the percentage of health that the Pokémon will recover from an amount.
      Parameters:
      amount - The amount of health that the Pokémon can recover.
      Returns:
      The percentage of health that the Pokémon will recover from the given amount.
    • getHealthDeficit

      public int getHealthDeficit()
      Returns the difference between the Pokémon's maximum and current health.
      Returns:
      The difference between the Pokémon's maximum and current health.
    • hasFullHealth

      public boolean hasFullHealth(boolean ignoreAbility)
      Checks if the Pokémon is at full health.
      Parameters:
      ignoreAbility - Whether the Pokémon's ability should be ignored for this check or not.
      Returns:
      Whether the Pokémon is at full health.
    • hasFullHealth

      public boolean hasFullHealth()
      Checks if the Pokémon is at full health.
      Returns:
      Whether the Pokémon is at full health.
    • getPercentMaxHealth

      public int getPercentMaxHealth(float percent, boolean ignoreDynamax)
      Gets an amount of the Pokémon's maximum hp from a percentage.
      Parameters:
      percent - The percentage of the Pokémon's maximum hp to get.
      ignoreDynamax - Whether to ignore the increase to maximum hp from Dynamax or not.
      Returns:
      The amount of the Pokémon's maximum hp from a percentage.
    • getPercentMaxHealth

      public int getPercentMaxHealth(float percent)
    • healByPercent

      public int healByPercent(float percent)
      Heals the Pokémon by a certain percentage of its maximum health.
      Parameters:
      percent - The percentage of the Pokémon maximum health to heal it by.
      Returns:
      The amount actually healed.
    • healEntityBy

      public int healEntityBy(int i)
      Heals a Pokémon by a specified amount.
      Parameters:
      i - The amount to heal the Pokémon by.
      Returns:
      The amount actually healed.
    • setHealth

      public void setHealth(int newHP)
      Sets the Pokémon's current hp.
      Parameters:
      newHP - The new current hp of the Pokémon.
    • setAttackFailed

      public void setAttackFailed()
      Marks the Pokémon's current attack as failed.
    • attackMakesContact

      public boolean attackMakesContact()
      Checks if the Pokémon's attack makes contact
      Returns:
      Whether the Pokémon's attack should be treated as making contact
    • doesLevel

      public boolean doesLevel()
      Checks if the Pokémon can gain experience and pokemonLevel up.
      Returns:
      Whether the Pokémon can gain experience and pokemonLevel up.
    • getPokemonUUID

      public UUID getPokemonUUID()
      Gets the ID of the Pokémon.
      Returns:
      The ID of the Pokémon.
    • update

      public void update(EnumUpdateType... types)
      Updates the Pokémon client-side.
      Parameters:
      types - The types of data to update.
    • getForm

      public Stats getForm()
      Gets the form index of the Pokémon.
      Returns:
      The form index of the Pokémon.
    • setForm

      public void setForm(String form)
      Sets the form of a Pokémon.
      Parameters:
      form - The index of the new form.
    • setForm

      public void setForm(Stats form)
      Sets the form of a Pokémon.
      Parameters:
      form - The index of the new form.
    • getPrevForm

      public Stats getPrevForm()
      Gets the previous form.
    • setPrevForm

      public void setPrevForm(String form)
      Sets the previous form.
      Parameters:
      form - The index of the previous form.
    • setPrevForm

      public void setPrevForm(Stats form)
      Sets the previous form.
      Parameters:
      form - The index of the previous form.
    • setPalette

      public void setPalette(String paletteName)
      Sets the palette of a Pokémon.
      Parameters:
      paletteName - The name of the palette.
    • setPrevPaletteName

      public void setPrevPaletteName(String paletteName)
      Sets the palette of a Pokémon.
      Parameters:
      paletteName - The name of the palette.
    • hasGigantamaxFactor

      public boolean hasGigantamaxFactor()
      Gets the Gigantamax Factor of the Pokémon.
      Returns:
      The Gigantamax Factor of the Pokémon.
    • resetBattleEvolution

      public void resetBattleEvolution()
      Resets a Mega and Ash-Greninja Evolved Pokémon back to their base form.
    • getWorldPosition

      public net.minecraft.core.BlockPos getWorldPosition()
      Gets the world position of the Pokémon.
      Returns:
      The world position of the Pokémon.
    • getWorld

      public net.minecraft.world.level.Level getWorld()
      Gets the world that the Pokémon is in.
      Returns:
      The world that the Pokémon is in.
    • getPlayerOwner

      public net.minecraft.server.level.ServerPlayer getPlayerOwner()
      Gets the player who owns the Pokémon.
      Returns:
      The player who owns the Pokémon, or null if no player owns the Pokémon.
    • getTrainerOwner

      public NPCTrainer getTrainerOwner()
      Gets the trainer who owns the Pokémon.
      Returns:
      The trainer who owns the Pokémon, or null if no trainer owns the Pokémon.
    • getOwnerName

      public String getOwnerName()
    • isWildPokemon

      public boolean isWildPokemon()
      Gets whether this is a wild Pokémon.
      Returns:
      Whether this is a wild Pokémon or not.
    • isRaidPokemon

      public boolean isRaidPokemon()
      Gets whether this is a raid Pokémon.
      Returns:
      Whether this is a raid Pokémon or not.
    • isSingleType

      public boolean isSingleType()
      Checks if the Pokémon is a single-typed Pokémon.
      Returns:
      Whether the Pokémon is a single-typed Pokémon.
    • isSingleType

      public boolean isSingleType(Element type)
      Checks if the Pokémon is a single-typed Pokémon of a certain type.
      Parameters:
      type - The type to check for.
      Returns:
      Whether the Pokémon is a single-typed Pokémon of a certain type.
    • addAttackers

      public void addAttackers()
      Updates experience-gaining Pokémon to and from the Pokémon.
    • getOriginalTrainer

      public String getOriginalTrainer()
      Gets the name of the Pokémon's original Trainer.
      Returns:
      The name of the Pokémon's original Trainer.
    • getPokemonName

      public String getPokemonName()
      Gets the Pokémon's unlocalized pokemon name.
      Returns:
      The Pokémon's unlocalized pokemon name.
    • getSpecies

      public Species getSpecies()
      Gets the Pokémon's pokemon.
      Returns:
      The Pokémon's pokemon.
    • getNature

      public Nature getNature()
      Gets the Pokémon's Nature.
      Returns:
      The Pokémon's Nature.
    • getBaseNature

      public Nature getBaseNature()
      Gets the Pokémon's actual Nature.
      Returns:
      The Pokémon's actual Nature.
    • getPokemonLevel

      public PokemonLevel getPokemonLevel()
      Gets the Pokémon's pokemonLevel container.
      Returns:
      The Pokémon's pokemonLevel container.
    • getPokemonLevelNum

      public int getPokemonLevelNum()
      Gets the Pokémon's pokemonLevel.
      Returns:
      The Pokémon's pokemonLevel.
    • getExp

      public int getExp()
      Gets the Pokémon's experience.
      Returns:
      The Pokémon's experience.
    • setLevelNum

      public void setLevelNum(int level)
      Sets the Pokémon's pokemonLevel.
      Parameters:
      level - The Pokémon's pokemonLevel.
    • setExp

      public void setExp(int experience)
      Sets the Pokémon's experience.
      Parameters:
      experience - The Pokémon's experience.
    • setTempLevel

      public void setTempLevel(int level)
      Sets a temporary pokemonLevel for the Pokémon to use in battle.
      Parameters:
      level - The pokemonLevel for the Pokémon to use.
    • getInnerLink

      public Pokemon getInnerLink()
      Gets the Pokémon stored inside this wrapper.
      Returns:
      The Pokémon stored inside this wrapper.
    • getPartyPosition

      public int getPartyPosition()
      Gets the position of the Pokémon in the party.
      Returns:
      The position of the Pokémon in the party.
    • enableReturnHeldItem

      public void enableReturnHeldItem()
      Causes the Pokémon to regain a lost held item after the battle ends.
    • shouldReturnHeldItem

      public boolean shouldReturnHeldItem()
    • writeToNBT

      public void writeToNBT()
      Saves the battling Pokémon's data to NBT.
    • updateHPIncrease

      public void updateHPIncrease()
      Updates Pokémon in battle.
    • isDynamax

      public boolean isDynamax()
    • isGigantamax

      public boolean isGigantamax()
    • setRaidShields

      public void setRaidShields(int shields)
    • updateRaidShields

      public void updateRaidShields(int shields)
    • addGlobalStatus

      public void addGlobalStatus(GlobalStatusBase g)
      Adds a global statuses and allows items to catch when one is added.
      Parameters:
      g - The GlobalStatusBase to be added to the battle.
    • copy

      public PixelmonWrapper copy()
    • getBeginingOfTurnHP

      public int getBeginingOfTurnHP()