From 8d0f32404b26fb29ee1b19b143bc6be9d44e720e Mon Sep 17 00:00:00 2001 From: torranx Date: Fri, 6 Sep 2024 21:55:49 +0800 Subject: [PATCH] cant fly high enough to avoid sandstorm/hail damage --- src/phases/weather-effect-phase.ts | 16 ++++++++-------- src/test/arena/weather_hail.test.ts | 9 ++++++--- src/test/arena/weather_sandstorm.test.ts | 6 +++--- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/phases/weather-effect-phase.ts b/src/phases/weather-effect-phase.ts index a0900f4fa33..ccfc9abb64f 100644 --- a/src/phases/weather-effect-phase.ts +++ b/src/phases/weather-effect-phase.ts @@ -1,11 +1,11 @@ -import BattleScene from "#app/battle-scene.js"; +import BattleScene from "#app/battle-scene"; import { applyPreWeatherEffectAbAttrs, SuppressWeatherEffectAbAttr, PreWeatherDamageAbAttr, applyAbAttrs, BlockNonDirectDamageAbAttr, applyPostWeatherLapseAbAttrs, PostWeatherLapseAbAttr } from "#app/data/ability.js"; -import { CommonAnim } from "#app/data/battle-anims.js"; -import { SemiInvulnerableTag } from "#app/data/battler-tags.js"; -import { Weather, getWeatherDamageMessage, getWeatherLapseMessage } from "#app/data/weather.js"; -import { WeatherType } from "#app/enums/weather-type.js"; -import Pokemon, { HitResult } from "#app/field/pokemon.js"; -import * as Utils from "#app/utils.js"; +import { CommonAnim } from "#app/data/battle-anims"; +import { Weather, getWeatherDamageMessage, getWeatherLapseMessage } from "#app/data/weather"; +import { BattlerTagType } from "#app/enums/battler-tag-type.js"; +import { WeatherType } from "#app/enums/weather-type"; +import Pokemon, { HitResult } from "#app/field/pokemon"; +import * as Utils from "#app/utils"; import { CommonAnimPhase } from "./common-anim-phase"; export class WeatherEffectPhase extends CommonAnimPhase { @@ -40,7 +40,7 @@ export class WeatherEffectPhase extends CommonAnimPhase { applyPreWeatherEffectAbAttrs(PreWeatherDamageAbAttr, pokemon, this.weather, cancelled); applyAbAttrs(BlockNonDirectDamageAbAttr, pokemon, cancelled); - if (cancelled.value || pokemon.getTag(SemiInvulnerableTag)) { + if (cancelled.value || pokemon.getTag(BattlerTagType.UNDERGROUND) || pokemon.getTag(BattlerTagType.UNDERWATER)) { return; } diff --git a/src/test/arena/weather_hail.test.ts b/src/test/arena/weather_hail.test.ts index 63065bdc2bb..75125b3448c 100644 --- a/src/test/arena/weather_hail.test.ts +++ b/src/test/arena/weather_hail.test.ts @@ -5,6 +5,7 @@ import GameManager from "#test/utils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { SPLASH_ONLY } from "../utils/testUtils"; +import { BattlerIndex } from "#app/battle"; describe("Weather - Hail", () => { let phaserGame: Phaser.Game; @@ -34,6 +35,7 @@ describe("Weather - Hail", () => { await game.classicMode.startBattle([Species.MAGIKARP]); game.move.select(Moves.SPLASH); + await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]); await game.phaseInterceptor.to("TurnEndPhase"); @@ -42,11 +44,12 @@ describe("Weather - Hail", () => { }); }); - it("does not inflict damage to a Pokemon that is in a semi-invulnerable state", async () => { - game.override.moveset([Moves.FLY]); + it("does not inflict damage to a Pokemon that is underwater (Dive) or underground (Dig)", async () => { + game.override.moveset([Moves.DIG]); await game.classicMode.startBattle([Species.MAGIKARP]); - game.move.select(Moves.FLY); + game.move.select(Moves.DIG); + await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]); await game.phaseInterceptor.to("TurnEndPhase"); diff --git a/src/test/arena/weather_sandstorm.test.ts b/src/test/arena/weather_sandstorm.test.ts index 475694eb45f..978774ba4c1 100644 --- a/src/test/arena/weather_sandstorm.test.ts +++ b/src/test/arena/weather_sandstorm.test.ts @@ -42,11 +42,11 @@ describe("Weather - Sandstorm", () => { }); }); - it("does not inflict damage to a Pokemon that is in a semi-invulnerable state", async () => { - game.override.moveset([Moves.FLY]); + it("does not inflict damage to a Pokemon that is underwater (Dive) or underground (Dig)", async () => { + game.override.moveset([Moves.DIVE]); await game.classicMode.startBattle([Species.MAGIKARP]); - game.move.select(Moves.FLY); + game.move.select(Moves.DIVE); await game.phaseInterceptor.to("TurnEndPhase");