Skip to contents

R6 object containing required information about a Pokémon.

Methods


Method new()

Create a Pokémon

Usage

Pokemon$new(
  pokemon = NULL,
  level = 50L,
  generation = 1L,
  nature = NULL,
  api_data = NULL,
  language = "en"
)

Arguments

pokemon

Name of the Pokémon to create

level

The level the Pokémon should be

generation

The generation that the Pokémon comes from

nature

Either a specified nature, or NULL for a random nature. NB Nature is only required from generation 3 onwards

api_data

Either data pulled from pokeapi::get_pokemon, or NULL to select the data of a random Pokémon

language

ISO-2 character of the language to pull the name of the Pokémon

Returns

A Pokemon


Method status()

Show current status of the Pokémon

Usage

Pokemon$status(simple = FALSE, console = TRUE)

Arguments

simple

Logical, do you just want the simple status (name + HP) printed?

console

Logical, should the status be printed or returned as a string?


Method use_move()

Use an attack of the Pokémon

Usage

Pokemon$use_move(move, def_pokemon, battle)

Arguments

move

The name of the move that is being used

def_pokemon

The defending Pokemon

battle

A PokemonBattle


Method get_stat()

Get the stat of the Pokémon

Usage

Pokemon$get_stat(stat)

Arguments

stat

The private field of the Pokémon


Method get_moves()

Get the moveset of the Pokémon

Usage

Pokemon$get_moves()


Method get_moves_pp()

Get the detailed move information of the Pokémon

Usage

Pokemon$get_moves_pp()


Method change_move()

Change one of the moves of the Pokémon

Usage

Pokemon$change_move(new_move = NULL, replace_move = NULL)

Arguments

new_move

Name of the new move

replace_move

Either the name of the move to replace, or the position of the move


Method get_crit_chance()

Get the critical hit chance for a move used by the Pokémon

Usage

Pokemon$get_crit_chance(move)

Arguments

move

Name of the move used by the Pokémon


Method crit_applied()

Helper function to know that a critical hit has been applied to an attack.

Usage

Pokemon$crit_applied()


Method type_multiplier_applied()

Helper function to know about the type multiplier of an attack.

Usage

Pokemon$type_multiplier_applied(multiplier)

Arguments

multiplier

A numeric value of the type multiplier applied to the attack


Method take_damage()

Take damage from attack

Usage

Pokemon$take_damage(damage_dealt)

Arguments

damage_dealt

The amount of damage dealt by the opposing Pokémon's attack


Method apply_ailment()

Apply an ailment to the Pokémon

Usage

Pokemon$apply_ailment(ailment)

Arguments

ailment

Numeric ID of the ailment

Returns

A logical value determining whether or not the ailment has been applied


Method change_stat()

Change the stat e.g. attack of a Pokémon

Usage

Pokemon$change_stat(stat = PK_STATS, change = 1L)

Arguments

stat

The name of the stat to change

change

Points of change of the stat

Details

Stats cannot change by more than +/-6 points


Method heal()

Heal the Pokémon

Usage

Pokemon$heal(perc, n)

Arguments

perc

The percentage of the maximum HP to heal

n

The percentage points to heal

Details

Pokémon healing can never go above full health, and cannot recover from being fainted


Method clone()

The objects of this class are cloneable with this method.

Usage

Pokemon$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.