Class Raichu
java.lang.Object
Pokemon.Pokemon
Pokemon.Electricity.Raichu
Represents the Pokémon Raichu, an Electric-type Pokémon.
Raichu has two available attacks:
Agility: Deals base damage plus any elemental bonus. Performs a coin flip; if heads, Raichu becomes invincible for the opponent's next turn.Thunder: Deals base damage plus any elemental bonus. Performs a coin flip; if tails, Raichu damages itself for 30 HP.
Pokemon.hitOpponent(Pokemon, int) method.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AttackInfo[]Array of attacks available to Raichu.Fields inherited from class Pokemon.Pokemon
elementType, tellsIfPokemonIsInvincible, tellsIfPokemonIsPoisoned -
Constructor Summary
ConstructorsConstructorDescriptionRaichu()Constructs a new Raichu Pokémon with default health, element type, ASCII art, and its two attacks. -
Method Summary
Modifier and TypeMethodDescriptionintgetAttackResult1(ElementType elementTypeOfOpponentPokemon) Executes Raichu'sAgilityattack.intgetAttackResult2(ElementType elementTypeOfOpponentPokemon) Executes Raichu'sThunderattack.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 Raichu.
-
-
Constructor Details
-
Raichu
public Raichu()Constructs a new Raichu Pokémon with default health, element type, ASCII art, and its two attacks.
-
-
Method Details
-
getAttackResult1
Executes Raichu'sAgilityattack.Deals damage equal to the attack's base damage plus any elemental bonus against the opponent's type. A coin flip determines whether Raichu becomes invincible for the opponent's next turn.
- Parameters:
elementTypeOfOpponentPokemon- the element type of the opponent Pokémon- Returns:
- the total damage dealt by
Agility
-
getAttackResult2
Executes Raichu'sThunderattack.Deals damage equal to the attack's base damage plus any elemental bonus against the opponent's type. A coin flip determines whether Raichu damages itself for 30 HP.
- Parameters:
elementTypeOfOpponentPokemon- the element type of the opponent Pokémon- Returns:
- the total damage dealt by
Thunder
-
hitOpponent
Performs an attack on an opponent Pokémon.Executes
Agilityifattackequals 1; otherwise, executesThunderand may damage Raichu 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 forAgility, others forThunder)
-