Type Chart
Types are properties applied to Pokémon and their moves, which affect the power of moves in battles. As of Generation IX, there are 19 types, with 18 regular types and the special Stellar type. Most of the types were introduced during Generation I, but the Dark and Steel types were introduced in Generation II, the Fairy type was introduced in Generation VI, and the Stellar type was introduced in Generation IX.
See more on Bulbapedia.
Methods
getPokemonTypeChartAttack()
Returns types which given type's attack has no effet, is normal, not effective, and super effective. Also, returns an array of PokemonTypesArrayIndex with damage multiples for given type. See more about the TYPES_CHART_MATRIX
at PokemonDB. The index 0 stands for NORMAL type, index 1 stands for FIRE type etc.
Signature
getPokemonTypeChartAttack(index: PokemonTypesArrayIndex) => TypeChartReturn
Parameter | Type | Required | Description |
---|---|---|---|
index | PokemonTypesArrayIndex | Yes | An index from Pokémon types chart matrix. |
Returns
An object with complete type chart, and normal, no effect, super effective, not effective types against given type.
Examples
getPokemonTypeChartAttack(PokemonTypesArrayIndex.FIRE); // returns 328
getPokemonTypeChartAttackPros()
Returns only types which given type's attack has super effective damage. See more about the TYPES_CHART_MATRIX
at PokemonDB. The index 0 stands for NORMAL type, index 1 stands for FIRE type etc.
Signature
getPokemonTypeChartAttackPros(index: PokemonTypesArrayIndex) => PokemonTypesArrayIndex[]
Parameter | Type | Required | Description |
---|---|---|---|
index | PokemonTypesArrayIndex | Yes | An index from Pokémon types chart matrix. |
Returns
An array of indexes from Pokémon types chart where given Pokémon type is super effective.
Examples
getPokemonTypeChartAttackPros(PokemonTypesArrayIndex.FIRE); // returns 328
getPokemonTypeChartAttackCons()
Returns only types which given type's attack has no effect or not effective damage. See more about the TYPES_CHART_MATRIX
at PokemonDB. The index 0 stands for NORMAL type, index 1 stands for FIRE type etc.
Signature
getPokemonTypeChartAttackCons(index: PokemonTypesArrayIndex) => TypeChartReturnDamageReduction
Parameter | Type | Required | Description |
---|---|---|---|
index | PokemonTypesArrayIndex | Yes | An index from Pokémon types chart matrix. |
Returns
An object with array of indexes from Pokémon types chart where given Pokémon type is not effective nor has effect.
Examples
getPokemonTypeChartAttackCons(PokemonTypesArrayIndex.FIRE); // returns 328
getPokemonTypeChartDefense()
Returns types which given type's defense has no effet, is normal, not effective, and super effective. Also, returns an array of PokemonTypesArrayIndex with damage multiples for given type. See more about the TYPES_CHART_MATRIX
at PokemonDB. The index 0 stands for NORMAL type, index 1 stands for FIRE type etc.
Signature
getPokemonTypeChartDefense(index: PokemonTypesArrayIndex) => TypeChartReturn
Parameter | Type | Required | Description |
---|---|---|---|
index | PokemonTypesArrayIndex | Yes | An index from Pokémon types chart matrix. |
Returns
An object with array of indexes from Pokémon types chart.
Examples
getPokemonTypeChartDefense(PokemonTypesArrayIndex.FIRE); // returns 328
getPokemonTypeChartDefensePros()
Returns only types which given type's defense has resistance. See more about the TYPES_CHART_MATRIX
at PokemonDB. The index 0 stands for NORMAL type, index 1 stands for FIRE type etc.
Signature
getPokemonTypeChartDefensePros(index: PokemonTypesArrayIndex) => TypeChartReturnDamageReduction
Parameter | Type | Required | Description |
---|---|---|---|
index | PokemonTypesArrayIndex | Yes | An index from Pokémon types chart matrix. |
Returns
An object with array of indexes from Pokémon types chart.
Examples
getPokemonTypeChartDefensePros(PokemonTypesArrayIndex.FIRE); // returns 328
getPokemonTypeChartDefenseCons()
Returns only types which given type's defense has weakness. See more about the TYPES_CHART_MATRIX
at PokemonDB. The index 0 stands for NORMAL type, index 1 stands for FIRE type etc.
Signature
getPokemonTypeChartDefenseCons(index: PokemonTypesArrayIndex) => PokemonTypesArrayIndex[]
Parameter | Type | Required | Description |
---|---|---|---|
index | PokemonTypesArrayIndex | Yes | An index from Pokémon types chart matrix. |
Returns
An object with array of indexes from Pokémon types chart.
Examples
getPokemonTypeChartDefenseCons(PokemonTypesArrayIndex.FIRE); // returns 328
getAttackMultipleByTypeChart()
Returns the damage multiplier considering the attacking move type, the targeted Pokémon types and ability.
Signature
getAttackMultipleByTypeChart(
moveType: PokemonTypesArrayIndex,
targetType: PokemonTypesArrayIndex[],
targetAbility?: AlterDamageAbility,
) => number
Parameter | Type | Required | Description |
---|---|---|---|
moveType | PokemonTypesArrayIndex | Yes | The type of move that will produce the damage. |
targetTypes | Array<PokemonTypesArrayIndex> | Yes | The types of target Pokémon which will receive the damage. |
targetAbility | AlterDamageAbility | No | A string of few selected abilities which affect damage calculation. |
Returns
The damage multiplier.
Examples
getAttackMultipleByTypeChart(
PokemonTypesArrayIndex.GROUND,
[PokemonTypesArrayIndex.FIRE, PokemonTypesArrayIndex.ELECTRIC],
'levitate'
); // returns 0
getPokemonTypeMatchups()
Returns a detailed offensive an defensive data from given PokéAPI Pokémon resource. It also returns the Pokémon types converted from Type resource id to PokemonTypesArrayIndex
.
Signature
getAttackMultipleByTypeChart(pokemon: Pokemon, verbose?: boolean) => GetPokemonTypeMatchupsReturn
Parameter | Type | Required | Description |
---|---|---|---|
pokemon | Pokemon | Yes | The PokéAPI Pokémon resource. |
verbose | boolean | No | True if defensive data will return the type names instead of its indexes. |
Returns
An GetPokemonTypeMatchupsReturn
object with detailed offensive an defensive data.
Examples
const pokemon = pokeapi('charizard').get();
getPokemonTypeMatchups(pokemon, true);
isMoveNullifyByAbility()
Returns true if ability is immune to type of given move; false otherwise.
Signature
isMoveNullifyByAbility(move: PokemonTypesArrayIndex, ability: AlterDamageAbility) => boolean
Parameter | Type | Required | Description |
---|---|---|---|
moveType | PokemonTypesArrayIndex | Yes | The type of attacking move. |
ability | AlterDamageAbility | Yes | A string of few selected abilities which affect damage calculation. |
Returns
A boolean with value true if ability receives no damage from given move type.
Examples
isMoveNullifyByAbility(PokemonTypesArrayIndex.WATER, 'storm-drain'); // returns true
damageMultipleByAbility()
Returns the damage multiple of attacking move by oponent's ability.
Signature
damageMultipleByAbility(move: PokemonTypesArrayIndex, ability: AlterDamageAbility) => number
Parameter | Type | Required | Description |
---|---|---|---|
moveType | PokemonTypesArrayIndex | Yes | The type of attacking move. |
ability | AlterDamageAbility | Yes | A string of few selected abilities which affect damage calculation. |
Returns
The damage multiple.
Examples
damageMultipleByAbility(PokemonTypesArrayIndex.GHOST, 'purifying-salt'); // returns 0.5
superEffectiveDamageMultipleByAbility()
Returns the correct super effective damage multiple applied to a oponent's ability.
Signature
superEffectiveDamageMultipleByAbility(multiple: number, ability: AlterDamageAbility) => number
Parameter | Type | Required | Description |
---|---|---|---|
multiple | number | Yes | The current damage multiplier. |
ability | AlterDamageAbility | Yes | A string of few selected abilities which affect damage calculation. |
Returns
The super effective damage multiple.
Examples
superEffectiveDamageMultipleByAbility(0.5, 'wonder-guard'); // returns 0
superEffectiveDamageMultipleByAbility(1, 'wonder-guard'); // returns 0
superEffectiveDamageMultipleByAbility(2, 'wonder-guard'); // returns 2
superEffectiveDamageMultipleByAbility(1, 'prism-armor'); // returns 1
superEffectiveDamageMultipleByAbility(2, 'prism-armor'); // returns 0.75
Type Definitions
TypeChartReturn
An interface to determine the Pokémon's final stat value with getStatValue()
.
Type |
---|
Interface |
Properties
Name | Required | Type |
---|---|---|
normal | Yes | Array<[PokemonTypesArrayIndex]> |
noEffect | Yes | Array<[PokemonTypesArrayIndex]> |
notEffective | Yes | Array<[PokemonTypesArrayIndex]> |
superEffective | Yes | Array<[PokemonTypesArrayIndex]> |
chart | Yes | Array<[PokemonTypesArrayIndex]> |
TypeChartReturnDamageReduction
An interface to determine the Pokémon's final stat value with getStatValue()
.
Type |
---|
Interface |
Properties
Name | Required | Type |
---|---|---|
noEffect | Yes | Array<[PokemonTypesArrayIndex]> |
notEffective | Yes | Array<[PokemonTypesArrayIndex]> |
GetPokemonTypeMatchupsReturn
An interface to determine the Pokémon's final stat value with getPokemonTypeMatchups()
.
Type |
---|
Interface |
Properties
Name | Required | Type |
---|---|---|
types | Yes | Array<[PokemonTypesArrayIndex]> |
offensive | Yes | Array<object> |
offensive.normal | Yes | Array<[PokemonTypesArrayIndex]> |
offensive.noEffect | Yes | Array<[PokemonTypesArrayIndex]> |
offensive.notEffective | Yes | Array<[PokemonTypesArrayIndex]> |
offensive.superEffective | Yes | Array<[PokemonTypesArrayIndex]> |
offensive.chart | Yes | Array<[PokemonTypesArrayIndex]> |
offensive.typeIndex | Yes | PokemonTypesArrayIndex |
offensive.name | Yes | string |
defensive | Yes | Array<object> |
defensive.ability | Yes | string |
defensive.normal | Yes |
|
defensive.noEffect | Yes |
|
defensive.weakness | Yes |
|
defensive.resistance | Yes |
|
defensive.doubleWeakness | Yes |
|
defensive.doubleResistance | Yes |
|