[Bug] Ensuring proper .getTypes() behavior with secondary Normal type (#5241)
* customPokemonData.types now accepts Type.UNKNOWN, ignores when determining type * Changed test for clowning around encounter to look at getTypes() instead of directly accessing customData * Simplifying logic for fusions when overrides are involved, introducing new tests in pokemon.test.ts * Renamed overrideTypes to customTypes to avoid confusion with override * pokemon.getType() properly recognizes Normal secondary type * Added effectiveness test for ghost on normal --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
This commit is contained in:
parent
f5c4a205b4
commit
3f71f79d7b
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
||||
|
|
|
@ -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)
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue