Class Trainer
java.lang.Object
Trainer.Trainer
Represents a Pokémon trainer who can own and manage Pokémon in battles.
Each trainer has a name, a current Pokémon, a faint counter, and a life status. The faint counter decreases when the trainer's Pokémon faints, and the alive status indicates whether the trainer can continue participating in battles.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate PokemonThe Pokémon the trainer is currently using in battle.private intCounts how many times the trainer's Pokémon have fainted.private booleanIndicates whether the trainer is still considered alive in the battle.private final StringThe name of the trainer. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDecreases the faint counter by one.Returns the Pokémon the trainer is currently using in battle.intReturns the number of remaining faints before the trainer is considered defeated.booleanChecks if the trainer is still alive and able to battle.getName()Returns the name of the trainer.voidsetCurrentPokemon(Pokemon newPokemon) Sets the trainer's current Pokémon.voidsetIfTrainerIsAlive(boolean isAlive) Sets the trainer's alive status.
-
Field Details
-
trainerName
The name of the trainer. -
currentPokemon
The Pokémon the trainer is currently using in battle. -
faintCounter
private int faintCounterCounts how many times the trainer's Pokémon have fainted. -
ifTrainerIsAlive
private boolean ifTrainerIsAliveIndicates whether the trainer is still considered alive in the battle.
-
-
Constructor Details
-
Trainer
Constructs a newTrainerwith the specified name.- Parameters:
trainerName- the name of the trainer
-
-
Method Details
-
getName
-
getFaintCounter
public int getFaintCounter()Returns the number of remaining faints before the trainer is considered defeated.- Returns:
- the faint counter
-
getIfTrainerIsAlive
public boolean getIfTrainerIsAlive()Checks if the trainer is still alive and able to battle.- Returns:
trueif the trainer is alive;falseotherwise
-
setIfTrainerIsAlive
public void setIfTrainerIsAlive(boolean isAlive) Sets the trainer's alive status.- Parameters:
isAlive-trueif the trainer is alive;falseif defeated
-
decreaseFaintCounter
public void decreaseFaintCounter()Decreases the faint counter by one.This method is typically called when the trainer's current Pokémon faints.
-
getCurrentPokemon
-
setCurrentPokemon
-