cant fly high enough to avoid sandstorm/hail damage

This commit is contained in:
torranx 2024-09-06 21:55:49 +08:00
parent 2b7b069ffb
commit 8d0f32404b
3 changed files with 17 additions and 14 deletions

View File

@ -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 { applyPreWeatherEffectAbAttrs, SuppressWeatherEffectAbAttr, PreWeatherDamageAbAttr, applyAbAttrs, BlockNonDirectDamageAbAttr, applyPostWeatherLapseAbAttrs, PostWeatherLapseAbAttr } from "#app/data/ability.js";
import { CommonAnim } from "#app/data/battle-anims.js"; import { CommonAnim } from "#app/data/battle-anims";
import { SemiInvulnerableTag } from "#app/data/battler-tags.js"; import { Weather, getWeatherDamageMessage, getWeatherLapseMessage } from "#app/data/weather";
import { Weather, getWeatherDamageMessage, getWeatherLapseMessage } from "#app/data/weather.js"; import { BattlerTagType } from "#app/enums/battler-tag-type.js";
import { WeatherType } from "#app/enums/weather-type.js"; import { WeatherType } from "#app/enums/weather-type";
import Pokemon, { HitResult } from "#app/field/pokemon.js"; import Pokemon, { HitResult } from "#app/field/pokemon";
import * as Utils from "#app/utils.js"; import * as Utils from "#app/utils";
import { CommonAnimPhase } from "./common-anim-phase"; import { CommonAnimPhase } from "./common-anim-phase";
export class WeatherEffectPhase extends CommonAnimPhase { export class WeatherEffectPhase extends CommonAnimPhase {
@ -40,7 +40,7 @@ export class WeatherEffectPhase extends CommonAnimPhase {
applyPreWeatherEffectAbAttrs(PreWeatherDamageAbAttr, pokemon, this.weather, cancelled); applyPreWeatherEffectAbAttrs(PreWeatherDamageAbAttr, pokemon, this.weather, cancelled);
applyAbAttrs(BlockNonDirectDamageAbAttr, pokemon, cancelled); applyAbAttrs(BlockNonDirectDamageAbAttr, pokemon, cancelled);
if (cancelled.value || pokemon.getTag(SemiInvulnerableTag)) { if (cancelled.value || pokemon.getTag(BattlerTagType.UNDERGROUND) || pokemon.getTag(BattlerTagType.UNDERWATER)) {
return; return;
} }

View File

@ -5,6 +5,7 @@ import GameManager from "#test/utils/gameManager";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { SPLASH_ONLY } from "../utils/testUtils"; import { SPLASH_ONLY } from "../utils/testUtils";
import { BattlerIndex } from "#app/battle";
describe("Weather - Hail", () => { describe("Weather - Hail", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -34,6 +35,7 @@ describe("Weather - Hail", () => {
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
game.move.select(Moves.SPLASH); game.move.select(Moves.SPLASH);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
await game.phaseInterceptor.to("TurnEndPhase"); 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 () => { it("does not inflict damage to a Pokemon that is underwater (Dive) or underground (Dig)", async () => {
game.override.moveset([Moves.FLY]); game.override.moveset([Moves.DIG]);
await game.classicMode.startBattle([Species.MAGIKARP]); 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"); await game.phaseInterceptor.to("TurnEndPhase");

View File

@ -42,11 +42,11 @@ describe("Weather - Sandstorm", () => {
}); });
}); });
it("does not inflict damage to a Pokemon that is in a semi-invulnerable state", async () => { it("does not inflict damage to a Pokemon that is underwater (Dive) or underground (Dig)", async () => {
game.override.moveset([Moves.FLY]); game.override.moveset([Moves.DIVE]);
await game.classicMode.startBattle([Species.MAGIKARP]); await game.classicMode.startBattle([Species.MAGIKARP]);
game.move.select(Moves.FLY); game.move.select(Moves.DIVE);
await game.phaseInterceptor.to("TurnEndPhase"); await game.phaseInterceptor.to("TurnEndPhase");