Class Ivysaur

java.lang.Object
Pokemon.Pokemon
Pokemon.Grass.Ivysaur

public class Ivysaur extends Pokemon
Represents the Pokémon Ivysaur, a Grass-type Pokémon.

Ivysaur has two available attacks:

  • Vine Whip: Deals base damage plus any elemental bonus against the opponent.
  • Poisonpowder: Deals base damage plus any elemental bonus and poisons the opponent Pokémon.
This class defines Ivysaur's specific attack logic and overrides the abstract Pokemon.hitOpponent(Pokemon, int) method.

  • Field Details

    • attackInfo

      private final AttackInfo[] attackInfo
      Array of attacks available to Ivysaur.
  • Constructor Details

    • Ivysaur

      public Ivysaur()
      Constructs a new Ivysaur Pokémon with default health, element type, ASCII art, and its two attacks.
  • Method Details

    • getAttackResult1

      public int getAttackResult1(ElementType elementTypeOfOpponentPokemon)
      Executes Ivysaur's Vine Whip attack.

      Deals damage equal to the attack's base damage plus any elemental bonus against the opponent's type.

      Parameters:
      elementTypeOfOpponentPokemon - the element type of the opponent Pokémon
      Returns:
      the total damage dealt by Vine Whip
    • getAttackResult2

      public int getAttackResult2(ElementType elementTypeOfOpponentPokemon)
      Executes Ivysaur's Poisonpowder attack.

      Deals damage equal to the attack's base damage plus any elemental bonus against the opponent's type. Additionally, poisons the opponent Pokémon.

      Parameters:
      elementTypeOfOpponentPokemon - the element type of the opponent Pokémon
      Returns:
      the total damage dealt by Poisonpowder
    • hitOpponent

      public void hitOpponent(Pokemon OpponentPokemon, int attack)
      Performs an attack on an opponent Pokémon.

      Executes Vine Whip if attack equals 1; otherwise, executes Poisonpowder and poisons the opponent Pokémon.

      Specified by:
      hitOpponent in class Pokemon
      Parameters:
      OpponentPokemon - the Pokémon being attacked
      attack - the index of the attack to use (1 for Vine Whip, others for Poisonpowder)