mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-28 11:12:24 +02:00
pokemon.getType() properly recognizes Normal secondary type
This commit is contained in:
parent
1fb2796d9e
commit
60ad302298
@ -1269,7 +1269,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
types.push(firstType);
|
types.push(firstType);
|
||||||
|
|
||||||
// Second type
|
// Second type
|
||||||
let secondType: Type | null = null;
|
let secondType: Type = Type.UNKNOWN;
|
||||||
|
|
||||||
if (fusionSpeciesForm) {
|
if (fusionSpeciesForm) {
|
||||||
// Check if the fusion Pokemon also had permanently changes when determining the fusion types
|
// Check if the fusion Pokemon also had permanently changes when determining the fusion types
|
||||||
@ -1287,10 +1287,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
} else {
|
} else {
|
||||||
// If not a fusion, just get the second type from the species, checking for permanent changes from ME
|
// If not a fusion, just get the second type from the species, checking for permanent changes from ME
|
||||||
secondType = (customTypes && this.customPokemonData.types.length > 1 && this.customPokemonData.types[1] !== Type.UNKNOWN)
|
secondType = (customTypes && this.customPokemonData.types.length > 1 && this.customPokemonData.types[1] !== Type.UNKNOWN)
|
||||||
? this.customPokemonData.types[1] : speciesForm.type2;
|
? this.customPokemonData.types[1] : (speciesForm.type2 ?? Type.UNKNOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (secondType) {
|
if (secondType !== Type.UNKNOWN) {
|
||||||
types.push(secondType);
|
types.push(secondType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,15 +98,15 @@ describe("Spec - Pokemon", () => {
|
|||||||
expect(types[1]).toBe(Type.FIRE);
|
expect(types[1]).toBe(Type.FIRE);
|
||||||
|
|
||||||
// Abra Psychic/Grass
|
// Abra Psychic/Grass
|
||||||
pokemon.customPokemonData.types = [ Type.UNKNOWN, Type.GRASS ];
|
pokemon.customPokemonData.types = [ Type.UNKNOWN, Type.NORMAL ];
|
||||||
types = pokemon.getTypes();
|
types = pokemon.getTypes();
|
||||||
expect(types[0]).toBe(Type.PSYCHIC);
|
expect(types[0]).toBe(Type.PSYCHIC);
|
||||||
expect(types[1]).toBe(Type.FIRE);
|
expect(types[1]).toBe(Type.FIRE);
|
||||||
|
|
||||||
// Abra Grass
|
// Abra Grass
|
||||||
pokemon.customPokemonData.types = [ Type.GRASS, Type.UNKNOWN ];
|
pokemon.customPokemonData.types = [ Type.NORMAL, Type.UNKNOWN ];
|
||||||
types = pokemon.getTypes();
|
types = pokemon.getTypes();
|
||||||
expect(types[0]).toBe(Type.GRASS);
|
expect(types[0]).toBe(Type.NORMAL);
|
||||||
expect(types[1]).toBe(Type.FIRE);
|
expect(types[1]).toBe(Type.FIRE);
|
||||||
|
|
||||||
if (!pokemon.fusionCustomPokemonData) {
|
if (!pokemon.fusionCustomPokemonData) {
|
||||||
@ -115,23 +115,23 @@ describe("Spec - Pokemon", () => {
|
|||||||
pokemon.customPokemonData.types = [];
|
pokemon.customPokemonData.types = [];
|
||||||
|
|
||||||
// Charmander Fire/Grass
|
// Charmander Fire/Grass
|
||||||
pokemon.fusionCustomPokemonData.types = [ Type.UNKNOWN, Type.GRASS ];
|
pokemon.fusionCustomPokemonData.types = [ Type.UNKNOWN, Type.NORMAL ];
|
||||||
types = pokemon.getTypes();
|
types = pokemon.getTypes();
|
||||||
expect(types[0]).toBe(Type.PSYCHIC);
|
expect(types[0]).toBe(Type.PSYCHIC);
|
||||||
expect(types[1]).toBe(Type.GRASS);
|
expect(types[1]).toBe(Type.NORMAL);
|
||||||
|
|
||||||
// Charmander Grass
|
// Charmander Grass
|
||||||
pokemon.fusionCustomPokemonData.types = [ Type.GRASS, Type.UNKNOWN ];
|
pokemon.fusionCustomPokemonData.types = [ Type.NORMAL, Type.UNKNOWN ];
|
||||||
types = pokemon.getTypes();
|
types = pokemon.getTypes();
|
||||||
expect(types[0]).toBe(Type.PSYCHIC);
|
expect(types[0]).toBe(Type.PSYCHIC);
|
||||||
expect(types[1]).toBe(Type.GRASS);
|
expect(types[1]).toBe(Type.NORMAL);
|
||||||
|
|
||||||
// Abra Grass
|
// Abra Grass
|
||||||
// Charmander Fire/Grass
|
// Charmander Fire/Grass
|
||||||
pokemon.customPokemonData.types = [ Type.GRASS, Type.UNKNOWN ];
|
pokemon.customPokemonData.types = [ Type.NORMAL, Type.UNKNOWN ];
|
||||||
pokemon.fusionCustomPokemonData.types = [ Type.UNKNOWN, Type.GRASS ];
|
pokemon.fusionCustomPokemonData.types = [ Type.UNKNOWN, Type.NORMAL ];
|
||||||
types = pokemon.getTypes();
|
types = pokemon.getTypes();
|
||||||
expect(types[0]).toBe(Type.GRASS);
|
expect(types[0]).toBe(Type.NORMAL);
|
||||||
expect(types[1]).toBe(Type.FIRE);
|
expect(types[1]).toBe(Type.FIRE);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user