Apply suggestions from code review

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
This commit is contained in:
Mumble 2024-10-21 19:37:22 -07:00 committed by NightKev
parent 8277d2e334
commit fa5f6f88fd
4 changed files with 14 additions and 8 deletions

View File

@ -4687,7 +4687,7 @@ export class TerrainEventTypeChangeAbAttr extends PostSummonAbAttr {
super(true); super(true);
} }
apply(pokemon: Pokemon, passive: boolean, simulated: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean { apply(pokemon: Pokemon, _passive: boolean, _simulated: boolean, _cancelled: Utils.BooleanHolder, _args: any[]): boolean {
if (pokemon.isTerastallized()) { if (pokemon.isTerastallized()) {
return false; return false;
} }

View File

@ -10,7 +10,14 @@ import Move from "#app/data/move";
import { ArenaTag, ArenaTagSide, ArenaTrapTag, getArenaTag } from "#app/data/arena-tag"; import { ArenaTag, ArenaTagSide, ArenaTrapTag, getArenaTag } from "#app/data/arena-tag";
import { BattlerIndex } from "#app/battle"; import { BattlerIndex } from "#app/battle";
import { Terrain, TerrainType } from "#app/data/terrain"; import { Terrain, TerrainType } from "#app/data/terrain";
import { applyAbAttrs, applyPostTerrainChangeAbAttrs, applyPostWeatherChangeAbAttrs, PostTerrainChangeAbAttr, PostWeatherChangeAbAttr, TerrainEventTypeChangeAbAttr } from "#app/data/ability"; import {
applyAbAttrs,
applyPostTerrainChangeAbAttrs,
applyPostWeatherChangeAbAttrs,
PostTerrainChangeAbAttr,
PostWeatherChangeAbAttr,
TerrainEventTypeChangeAbAttr
} from "#app/data/ability";
import Pokemon from "#app/field/pokemon"; import Pokemon from "#app/field/pokemon";
import Overrides from "#app/overrides"; import Overrides from "#app/overrides";
import { TagAddedEvent, TagRemovedEvent, TerrainChangedEvent, WeatherChangedEvent } from "#app/events/arena"; import { TagAddedEvent, TagRemovedEvent, TerrainChangedEvent, WeatherChangedEvent } from "#app/events/arena";

View File

@ -1245,8 +1245,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
// the type added to Pokemon from moves like Forest's Curse or Trick Or Treat // the type added to Pokemon from moves like Forest's Curse or Trick Or Treat
if (this.summonData?.addedType && !types.includes(this.summonData?.addedType)) { if (this.summonData && this.summonData.addedType && !types.includes(this.summonData.addedType)) {
types.push(this.summonData?.addedType); types.push(this.summonData.addedType);
} }
// this.scene potentially can be undefined for a fainted pokemon in doubles // this.scene potentially can be undefined for a fainted pokemon in doubles

View File

@ -38,16 +38,15 @@ describe("Abilities - Mimicry", () => {
game.override.enemyAbility(Abilities.MISTY_SURGE); game.override.enemyAbility(Abilities.MISTY_SURGE);
await game.classicMode.startBattle([ Species.FEEBAS, Species.ABRA ]); await game.classicMode.startBattle([ Species.FEEBAS, Species.ABRA ]);
const playerPokemon1 = game.scene.getPlayerPokemon(); const [ playerPokemon1, playerPokemon2 ] = game.scene.getParty();
game.move.select(Moves.SPLASH); game.move.select(Moves.SPLASH);
await game.toNextTurn(); await game.toNextTurn();
expect(playerPokemon1?.getTypes().includes(Type.FAIRY)).toBe(true); expect(playerPokemon1.getTypes().includes(Type.FAIRY)).toBe(true);
game.doSwitchPokemon(1); game.doSwitchPokemon(1);
await game.toNextTurn(); await game.toNextTurn();
const playerPokemon2 = game.scene.getPlayerPokemon(); expect(playerPokemon2.getTypes().includes(Type.FAIRY)).toBe(true);
expect(playerPokemon2?.getTypes().includes(Type.FAIRY)).toBe(true);
}); });
it("Pokemon should revert back to its original, root type once terrain ends", async () => { it("Pokemon should revert back to its original, root type once terrain ends", async () => {