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 { 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;
}

View File

@ -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");

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 () => {
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");