Class Wartortle

java.lang.Object
Pokemon.Pokemon
Pokemon.Water.Wartortle

public class Wartortle extends Pokemon
Represents the Pokémon Wartortle, a Water-type Pokémon.

Wartortle has two available attacks:

  • Withdraw: May grant temporary invincibility based on a coin flip.
  • Bite: Deals base damage plus any elemental bonus against the opponent.
This class defines Wartortle'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 Wartortle.
  • Constructor Details

    • Wartortle

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

    • getAttackResult1

      public int getAttackResult1(ElementType elementTypeOfOpponentPokemon)
      Executes Wartortle's Withdraw attack.

      Performs a coin flip to determine if Wartortle becomes invincible for the opponent's next turn. This attack does not deal direct damage.

      Parameters:
      elementTypeOfOpponentPokemon - the opponent's elemental type (ignored, Withdraw does no damage)
      Returns:
      0 as Withdraw does not deal damage
    • getAttackResult2

      public int getAttackResult2(ElementType elementTypeOfOpponentPokemon)
      Executes Wartortle's Bite attack.

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

      Parameters:
      elementTypeOfOpponentPokemon - the opponent's elemental type
      Returns:
      total damage dealt by Bite
    • hitOpponent

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

      Executes Withdraw if attack equals 1; otherwise, executes Bite.

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