Skip to contents

Create two teams of Pokémon and play out a match to see who is the world's number one Pokémon master!

To create a random team use PokemonTeam$new(generation = 1L).

In the initial version, the CPU will use a random move. AI will improve in future releases.

Methods


Method new()

Commence a Pokémon battle

Usage

PokemonBattle$new(
  team_1,
  team_2,
  player_2_cpu = TRUE,
  level = 50L,
  generation = 1L,
  init_battle = interactive()
)

Arguments

team_1

Player 1's Pokémon team

team_2

Player 2's Pokémon team

player_2_cpu

Logical, is player 2 a CPU? Default set to TRUE

level

If random teams, the level the Pokémon should be

generation

If teams are random, then the generation the Pokémon will be selected from. Default is Gen 8.

init_battle

Logical, should the battle start on initialisation? Will start if interactive.

Returns

A state where a Pokémon battle can commence


Method start()

A helper to start the local console version of a battle

Usage

PokemonBattle$start()


Method status()

Show current status of Pokémon Battle

Usage

PokemonBattle$status()


Method attack()

Select Pokémon attack

Usage

PokemonBattle$attack()


Method attack_p2()

Select Pokémon attack (player 2)

Usage

PokemonBattle$attack_p2()


Method switch()

Select active Pokémon

Usage

PokemonBattle$switch(new_active, curr_active = private$active_1)

Arguments

new_active

Team position of the Pokémon to switch in

curr_active

Team position of the Pokémon to switch out. Defaults to current active


Method switch_p2()

Select active Pokémon (player 2)

Usage

PokemonBattle$switch_p2(new_active, curr_active = private$active_2)

Arguments

new_active

Team position of the Pokémon to switch in

curr_active

Team position of the Pokémon to switch out. Defaults to current active


Method clone()

The objects of this class are cloneable with this method.

Usage

PokemonBattle$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.