diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 112665e1723..0458c5471d2 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -1269,7 +1269,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { types.push(firstType); // Second type - let secondType: Type | null = null; + let secondType: Type = Type.UNKNOWN; if (fusionSpeciesForm) { // Check if the fusion Pokemon also has permanent changes from ME when determining the fusion types @@ -1287,10 +1287,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { } else { // 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) - ? this.customPokemonData.types[1] : speciesForm.type2; + ? this.customPokemonData.types[1] : (speciesForm.type2 ?? Type.UNKNOWN); } - if (secondType) { + if (secondType !== Type.UNKNOWN) { types.push(secondType); } } diff --git a/src/test/field/pokemon.test.ts b/src/test/field/pokemon.test.ts index b8b7349c1f8..0a1ddac9e90 100644 --- a/src/test/field/pokemon.test.ts +++ b/src/test/field/pokemon.test.ts @@ -97,16 +97,14 @@ describe("Spec - Pokemon", () => { expect(types[0]).toBe(Type.PSYCHIC); expect(types[1]).toBe(Type.FIRE); - // Abra Psychic/Grass - pokemon.customPokemonData.types = [ Type.UNKNOWN, Type.GRASS ]; + pokemon.customPokemonData.types = [ Type.UNKNOWN, Type.NORMAL ]; types = pokemon.getTypes(); expect(types[0]).toBe(Type.PSYCHIC); expect(types[1]).toBe(Type.FIRE); - // Abra Grass - pokemon.customPokemonData.types = [ Type.GRASS, Type.UNKNOWN ]; + pokemon.customPokemonData.types = [ Type.NORMAL, Type.UNKNOWN ]; types = pokemon.getTypes(); - expect(types[0]).toBe(Type.GRASS); + expect(types[0]).toBe(Type.NORMAL); expect(types[1]).toBe(Type.FIRE); if (!pokemon.fusionCustomPokemonData) { @@ -114,24 +112,20 @@ describe("Spec - Pokemon", () => { } pokemon.customPokemonData.types = []; - // Charmander Fire/Grass - pokemon.fusionCustomPokemonData.types = [ Type.UNKNOWN, Type.GRASS ]; + pokemon.fusionCustomPokemonData.types = [ Type.UNKNOWN, Type.NORMAL ]; types = pokemon.getTypes(); expect(types[0]).toBe(Type.PSYCHIC); - expect(types[1]).toBe(Type.GRASS); + expect(types[1]).toBe(Type.NORMAL); - // Charmander Grass - pokemon.fusionCustomPokemonData.types = [ Type.GRASS, Type.UNKNOWN ]; + pokemon.fusionCustomPokemonData.types = [ Type.NORMAL, Type.UNKNOWN ]; types = pokemon.getTypes(); expect(types[0]).toBe(Type.PSYCHIC); - expect(types[1]).toBe(Type.GRASS); + expect(types[1]).toBe(Type.NORMAL); - // Abra Grass - // Charmander Fire/Grass - pokemon.customPokemonData.types = [ Type.GRASS, Type.UNKNOWN ]; - pokemon.fusionCustomPokemonData.types = [ Type.UNKNOWN, Type.GRASS ]; + pokemon.customPokemonData.types = [ Type.NORMAL, Type.UNKNOWN ]; + pokemon.fusionCustomPokemonData.types = [ Type.UNKNOWN, Type.NORMAL ]; types = pokemon.getTypes(); - expect(types[0]).toBe(Type.GRASS); + expect(types[0]).toBe(Type.NORMAL); expect(types[1]).toBe(Type.FIRE); }); diff --git a/src/test/moves/effectiveness.test.ts b/src/test/moves/effectiveness.test.ts index 7742178f595..c78416b1237 100644 --- a/src/test/moves/effectiveness.test.ts +++ b/src/test/moves/effectiveness.test.ts @@ -73,6 +73,10 @@ describe("Moves - Type Effectiveness", () => { () => testMoveEffectiveness(game, Moves.THUNDERBOLT, Species.BLASTOISE, 2) ); + it("Ghost-type attacks have no effect on Normal-type Pokemon", + () => testMoveEffectiveness(game, Moves.SHADOW_BALL, Species.URSALUNA, 0) + ); + it("Electric-type attacks are doubly super-effective against Water/Flying-type Pokemon", () => testMoveEffectiveness(game, Moves.THUNDERBOLT, Species.GYARADOS, 4) );