Class Pikachu
java.lang.Object
Pokemon.Pokemon
Pokemon.Electricity.Pikachu
Represents the Pokémon Pikachu, an Electric-type Pokémon.
Pikachu has two available attacks:
Gnaw: Deals base damage plus any elemental bonus against the opponent.Thunder Jolt: Deals base damage plus any elemental bonus. Performs a coin flip; if tails, Pikachu takes 10 damage itself.
Pokemon.hitOpponent(Pokemon, int) method.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AttackInfo[]Array of attacks available to Pikachu.Fields inherited from class Pokemon.Pokemon
elementType, tellsIfPokemonIsInvincible, tellsIfPokemonIsPoisoned -
Constructor Summary
ConstructorsConstructorDescriptionPikachu()Constructs a new Pikachu Pokémon with default health, element type, ASCII art, and its two attacks. -
Method Summary
Modifier and TypeMethodDescriptionintgetAttackResult1(ElementType elementTypeOfOpponentPokemon) Executes Pikachu'sGnawattack.intgetAttackResult2(ElementType elementTypeOfOpponentPokemon) Executes Pikachu'sThunder Joltattack.voidhitOpponent(Pokemon OpponentPokemon, int attack) Performs an attack on an opponent Pokémon.Methods inherited from class Pokemon.Pokemon
getAsciiArt, getAttackAndDamageInfo, getAttackInfo, getCounterToIncreaseAttackDamage, getElementType, getHealth, getName, getTellsIfPokemonIsInvincible, getTellsIfPokemonIsPoisoned, ifPoisonedChangeHealth, IncreaseCounterToIncreaseAttackDamage, printBuffsAndDebuffs, setHealth, setHealthIfPokemonDamagesItsSelf, setHealthIfPokemonHealsItsSelf, setTellsIfPokemonIsInvincible, setTellsIfPokemonIsPoisoned
-
Field Details
-
attackInfo
Array of attacks available to Pikachu.
-
-
Constructor Details
-
Pikachu
public Pikachu()Constructs a new Pikachu Pokémon with default health, element type, ASCII art, and its two attacks.
-
-
Method Details
-
getAttackResult1
Executes Pikachu'sGnawattack.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
Gnaw
-
getAttackResult2
Executes Pikachu'sThunder Joltattack.Deals damage equal to the attack's base damage plus any elemental bonus against the opponent's type. A coin flip determines whether Pikachu damages itself for 10 HP.
- Parameters:
elementTypeOfOpponentPokemon- the element type of the opponent Pokémon- Returns:
- the total damage dealt by
Thunder Jolt
-
hitOpponent
Performs an attack on an opponent Pokémon.Executes
Gnawifattackequals 1; otherwise, executesThunder Joltand may damage Pikachu itself based on a coin flip.- Specified by:
hitOpponentin classPokemon- Parameters:
OpponentPokemon- the Pokémon being attackedattack- the index of the attack to use (1 forGnaw, others forThunder Jolt)
-