Class Pokemon
java.lang.Object
Pokemon.Pokemon
- Direct Known Subclasses:
Blastoise,Bulbasaur,Charizard,Charmander,Charmeleon,Ivysaur,Pikachu,Raichu,Squirtle,Venusaur,Wartortle
Abstract base class representing a Pokémon in the game.
A Pokemon encapsulates shared attributes and behaviors such as name, health, element
type, available attacks, status effects, and combat-related mechanics. Concrete Pokémon
subclasses define specific behavior for attacking opponents.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StringASCII art representation of the Pokémon.private final AttackInfo[]The list of attacks available to this Pokémon.private intCounter used to track attack-based damage increases.protected final ElementTypeThe elemental type of the Pokémon (e.g., Fire, Water, Grass).private intThe current health points of the Pokémon.private final StringThe display name of the Pokémon.protected booleanIndicates whether the Pokémon is currently invincible.protected booleanIndicates whether the Pokémon is currently poisoned. -
Constructor Summary
ConstructorsConstructorDescriptionPokemon(String name, int health, ElementType elementType, String asciiArt, AttackInfo[] attackInfos) Constructs a newPokemonwith the specified attributes. -
Method Summary
Modifier and TypeMethodDescriptionvoidPrints the Pokémon's ASCII art to the console.voidPrints the Pokémon's current health, status effects, and available attacks.Returns the attacks available to this Pokémon.intReturns the counter tracking increased attack damage.Returns the elemental type of the Pokémon.intReturns the current health of the Pokémon.getName()Returns the name of the Pokémon.booleanIndicates whether the Pokémon is invincible.booleanIndicates whether the Pokémon is poisoned.abstract voidhitOpponent(Pokemon OpponentPokemon, int attack) Executes an attack against an opponent Pokémon.voidApplies poison damage to the Pokémon if it is poisoned.voidIncrements the counter used to increase attack damage.protected voidPrints the current buffs and debuffs affecting the Pokémon.voidsetHealth(int newHealth) Updates the Pokémon's health to a new value.voidsetHealthIfPokemonDamagesItsSelf(int damageToSelf) Reduces the Pokémon's health when it damages itself.voidsetHealthIfPokemonHealsItsSelf(int currentHealth, int healthToSelf) Increases the Pokémon's health when it heals itself.voidsetTellsIfPokemonIsInvincible(boolean updater) Sets the invincibility status of the Pokémon.voidsetTellsIfPokemonIsPoisoned(boolean tellsIfPokemonIsPoisoned) Sets the poisoned status of the Pokémon.
-
Field Details
-
name
The display name of the Pokémon. -
health
private int healthThe current health points of the Pokémon. -
asciiArt
ASCII art representation of the Pokémon. -
attackInfo
The list of attacks available to this Pokémon. -
counterToIncreaseAttackDamage
private int counterToIncreaseAttackDamageCounter used to track attack-based damage increases. -
elementType
The elemental type of the Pokémon (e.g., Fire, Water, Grass). -
tellsIfPokemonIsPoisoned
protected boolean tellsIfPokemonIsPoisonedIndicates whether the Pokémon is currently poisoned. -
tellsIfPokemonIsInvincible
protected boolean tellsIfPokemonIsInvincibleIndicates whether the Pokémon is currently invincible.
-
-
Constructor Details
-
Pokemon
public Pokemon(String name, int health, ElementType elementType, String asciiArt, AttackInfo[] attackInfos) Constructs a newPokemonwith the specified attributes.- Parameters:
name- the name of the Pokémonhealth- the starting health of the PokémonelementType- the elemental type of the PokémonasciiArt- the ASCII art representation of the PokémonattackInfos- the attacks available to the Pokémon
-
-
Method Details
-
getAsciiArt
public void getAsciiArt()Prints the Pokémon's ASCII art to the console. -
getAttackInfo
Returns the attacks available to this Pokémon.- Returns:
- an array of
AttackInfoobjects
-
getElementType
Returns the elemental type of the Pokémon.- Returns:
- the
ElementTypeof the Pokémon
-
getName
-
getHealth
public int getHealth()Returns the current health of the Pokémon.- Returns:
- the current health value
-
setHealth
public void setHealth(int newHealth) Updates the Pokémon's health to a new value.- Parameters:
newHealth- the new health value
-
getCounterToIncreaseAttackDamage
public int getCounterToIncreaseAttackDamage()Returns the counter tracking increased attack damage.- Returns:
- the current attack damage counter
-
IncreaseCounterToIncreaseAttackDamage
public void IncreaseCounterToIncreaseAttackDamage()Increments the counter used to increase attack damage. -
setHealthIfPokemonDamagesItsSelf
public void setHealthIfPokemonDamagesItsSelf(int damageToSelf) Reduces the Pokémon's health when it damages itself.- Parameters:
damageToSelf- the amount of damage dealt to itself
-
setHealthIfPokemonHealsItsSelf
public void setHealthIfPokemonHealsItsSelf(int currentHealth, int healthToSelf) Increases the Pokémon's health when it heals itself.- Parameters:
currentHealth- the Pokémon's current healthhealthToSelf- the amount of health restored
-
getTellsIfPokemonIsPoisoned
public boolean getTellsIfPokemonIsPoisoned()Indicates whether the Pokémon is poisoned.- Returns:
trueif poisoned;falseotherwise
-
setTellsIfPokemonIsPoisoned
public void setTellsIfPokemonIsPoisoned(boolean tellsIfPokemonIsPoisoned) Sets the poisoned status of the Pokémon.- Parameters:
tellsIfPokemonIsPoisoned-trueto poison the Pokémon;falseotherwise
-
ifPoisonedChangeHealth
public void ifPoisonedChangeHealth()Applies poison damage to the Pokémon if it is poisoned. -
getTellsIfPokemonIsInvincible
public boolean getTellsIfPokemonIsInvincible()Indicates whether the Pokémon is invincible.- Returns:
trueif invincible;falseotherwise
-
setTellsIfPokemonIsInvincible
public void setTellsIfPokemonIsInvincible(boolean updater) Sets the invincibility status of the Pokémon.- Parameters:
updater-trueto make the Pokémon invincible;falseotherwise
-
printBuffsAndDebuffs
protected void printBuffsAndDebuffs()Prints the current buffs and debuffs affecting the Pokémon.This includes status effects such as poison and invincibility.
-
getAttackAndDamageInfo
public void getAttackAndDamageInfo()Prints the Pokémon's current health, status effects, and available attacks. -
hitOpponent
Executes an attack against an opponent Pokémon.Concrete subclasses define how damage is calculated and applied for specific Pokémon attacks.
- Parameters:
OpponentPokemon- the Pokémon being attackedattack- the index of the attack being used
-