java.lang.Object
com.pixelmonmod.pixelmon.battles.controller.participants.BattleParticipant
com.pixelmonmod.pixelmon.battles.controller.participants.TrainerParticipant

public class TrainerParticipant extends BattleParticipant
An NPC Trainer battle participant.
  • Field Details

    • trainer

      public NPCTrainer trainer
      The Trainer entity that this participant is representing.
  • Constructor Details

    • TrainerParticipant

      public TrainerParticipant(NPCTrainer trainer, net.minecraft.world.entity.player.Player opponent, int numPokemon) throws IllegalStateException
      Initializes the participant.
      Parameters:
      trainer - The Trainer entity that this participant is representing.
      opponent - The player that is battling the Trainer.
      numPokemon - The number of Pokémon to be sent out by the Trainer.
      Throws:
      IllegalStateException - When the player is prevented from battling the NPC.
    • TrainerParticipant

      public TrainerParticipant(NPCTrainer trainer, net.minecraft.world.entity.player.Player opponent, int numPokemon, List<Pokemon> teamSelection) throws IllegalStateException
      Initializes the participant.
      Parameters:
      trainer - The Trainer entity that this participant is representing.
      opponent - The player that is battling the Trainer.
      numPokemon - The number of Pokémon to be sent out by the Trainer.
      teamSelection - The team selected by the Trainer for battle.
      Throws:
      IllegalStateException - When the player is prevented from battling the NPC.
    • TrainerParticipant

      public TrainerParticipant(NPCTrainer trainer, int numPokemon) throws IllegalStateException
      Initializes the participant.
      Parameters:
      trainer - The Trainer entity that this participant is representing.
      numPokemon - The number of Pokémon to be sent out by the Trainer.
      Throws:
      IllegalStateException - When the player is prevented from battling the NPC.
  • Method Details

    • startBattle

      public void startBattle()
      Description copied from class: BattleParticipant
      Adds the participant to a battle.
      Overrides:
      startBattle in class BattleParticipant
    • getType

      public ParticipantType getType()
      Description copied from class: BattleParticipant
      Gets the type of participant that this participant is.
      Specified by:
      getType in class BattleParticipant
      Returns:
      The type of participant that this participant is.
    • 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 class BattleParticipant
      Returns:
      True if the player has a Pokémon in reserve.
    • canGainXP

      public boolean canGainXP()
      Description copied from class: BattleParticipant
      Checks if the participant's Pokémon can give experience.
      Specified by:
      canGainXP in class BattleParticipant
      Returns:
      Whether the participant's Pokémon can give experience.
    • endBattle

      public void endBattle(BattleEndCause cause)
      Description copied from class: BattleParticipant
      Ends the battle the participant is in.
      Specified by:
      endBattle in class BattleParticipant
    • 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 class BattleParticipant
      Parameters:
      position - The position to send out the Pokémon at.
    • getNextPokemonUUID

      public UUID 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 class BattleParticipant
      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 class BattleParticipant
      Returns:
      The name of the participant.
    • getMove

      public MoveChoice getMove(PixelmonWrapper p)
      Description copied from class: BattleParticipant
      Gets the move to be used by the specified Pokémon.
      Specified by:
      getMove in class BattleParticipant
      Parameters:
      p - The Pokémon to get a move for.
      Returns:
      The move to be used by the specified Pokémon.
    • switchPokemon

      public PixelmonWrapper switchPokemon(PixelmonWrapper oldPokemon, UUID newPixelmonUUID)
      Description copied from class: BattleParticipant
      Switches the participant's Pokémon for another one.
      Specified by:
      switchPokemon in class BattleParticipant
      Parameters:
      oldPokemon - 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 class BattleParticipant
      Returns:
      Whether the participant's Pokémon are in a valid state.
    • canMegaEvolve

      public boolean canMegaEvolve()
      Description copied from class: BattleParticipant
      Checks if the participant is allowed to Mega Evolve Pokémon.
      Overrides:
      canMegaEvolve in class BattleParticipant
      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 class BattleParticipant
      Returns:
      Whether the participant is allowed to Dynamax Pokémon.
    • updatePokemon

      public void updatePokemon(PixelmonWrapper p)
      Description copied from class: BattleParticipant
      Updates the specified Pokémon client-side.
      Specified by:
      updatePokemon in class BattleParticipant
      Parameters:
      p - The Pokémon to update.
    • getEntity

      public net.minecraft.world.entity.Mob getEntity()
      Description copied from class: BattleParticipant
      Gets the entity that this participant is representing.
      Specified by:
      getEntity in class BattleParticipant
      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 class BattleParticipant
    • getDisplayName

      public String getDisplayName()
      Description copied from class: BattleParticipant
      Returns the name of the entity the participant is representing.
      Overrides:
      getDisplayName in class BattleParticipant
      Returns:
      The name of the entity the participant is representing.
    • getStorage

      public TrainerPartyStorage getStorage()
      Description copied from class: BattleParticipant
      Returns the Pokémon storage of the participant.
      Overrides:
      getStorage in class BattleParticipant
      Returns:
      The Pokémon storage of the participant.