Class Pokemon

java.lang.Object
Pokemon.Pokemon
Direct Known Subclasses:
Blastoise, Bulbasaur, Charizard, Charmander, Charmeleon, Ivysaur, Pikachu, Raichu, Squirtle, Venusaur, Wartortle

public abstract class Pokemon extends Object
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 Details

    • name

      private final String name
      The display name of the Pokémon.
    • health

      private int health
      The current health points of the Pokémon.
    • asciiArt

      private final String asciiArt
      ASCII art representation of the Pokémon.
    • attackInfo

      private final AttackInfo[] attackInfo
      The list of attacks available to this Pokémon.
    • counterToIncreaseAttackDamage

      private int counterToIncreaseAttackDamage
      Counter used to track attack-based damage increases.
    • elementType

      protected final ElementType elementType
      The elemental type of the Pokémon (e.g., Fire, Water, Grass).
    • tellsIfPokemonIsPoisoned

      protected boolean tellsIfPokemonIsPoisoned
      Indicates whether the Pokémon is currently poisoned.
    • tellsIfPokemonIsInvincible

      protected boolean tellsIfPokemonIsInvincible
      Indicates whether the Pokémon is currently invincible.
  • Constructor Details

    • Pokemon

      public Pokemon(String name, int health, ElementType elementType, String asciiArt, AttackInfo[] attackInfos)
      Constructs a new Pokemon with the specified attributes.
      Parameters:
      name - the name of the Pokémon
      health - the starting health of the Pokémon
      elementType - the elemental type of the Pokémon
      asciiArt - the ASCII art representation of the Pokémon
      attackInfos - the attacks available to the Pokémon
  • Method Details

    • getAsciiArt

      public void getAsciiArt()
      Prints the Pokémon's ASCII art to the console.
    • getAttackInfo

      public AttackInfo[] getAttackInfo()
      Returns the attacks available to this Pokémon.
      Returns:
      an array of AttackInfo objects
    • getElementType

      public ElementType getElementType()
      Returns the elemental type of the Pokémon.
      Returns:
      the ElementType of the Pokémon
    • getName

      public String getName()
      Returns the name of the Pokémon.
      Returns:
      the Pokémon's name
    • 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 health
      healthToSelf - the amount of health restored
    • getTellsIfPokemonIsPoisoned

      public boolean getTellsIfPokemonIsPoisoned()
      Indicates whether the Pokémon is poisoned.
      Returns:
      true if poisoned; false otherwise
    • setTellsIfPokemonIsPoisoned

      public void setTellsIfPokemonIsPoisoned(boolean tellsIfPokemonIsPoisoned)
      Sets the poisoned status of the Pokémon.
      Parameters:
      tellsIfPokemonIsPoisoned - true to poison the Pokémon; false otherwise
    • 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:
      true if invincible; false otherwise
    • setTellsIfPokemonIsInvincible

      public void setTellsIfPokemonIsInvincible(boolean updater)
      Sets the invincibility status of the Pokémon.
      Parameters:
      updater - true to make the Pokémon invincible; false otherwise
    • 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

      public abstract void hitOpponent(Pokemon OpponentPokemon, int attack)
      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 attacked
      attack - the index of the attack being used