diff --git a/src/data/weather.ts b/src/data/weather.ts index 0c90f381130..7de4d93b398 100644 --- a/src/data/weather.ts +++ b/src/data/weather.ts @@ -205,6 +205,16 @@ export function getWeatherClearMessage(weatherType: WeatherType): string | null return null; } +export function getWeatherBlockMessage(weatherType: WeatherType): string { + switch (weatherType) { + case WeatherType.HARSH_SUN: + return i18next.t("weather:harshSunEffectMessage"); + case WeatherType.HEAVY_RAIN: + return i18next.t("weather:heavyRainEffectMessage"); + } + return i18next.t("weather:defaultEffectMessage"); +} + export function getTerrainStartMessage(terrainType: TerrainType): string | null { switch (terrainType) { case TerrainType.MISTY: diff --git a/src/field/arena.ts b/src/field/arena.ts index 752eef81596..fe3e205bd2d 100644 --- a/src/field/arena.ts +++ b/src/field/arena.ts @@ -358,6 +358,10 @@ export class Arena { return !!this.terrain && this.terrain.isMoveTerrainCancelled(user, targets, move); } + public getWeatherType(): WeatherType { + return this.weather?.weatherType ?? WeatherType.NONE; + } + public getTerrainType(): TerrainType { return this.terrain?.terrainType ?? TerrainType.NONE; } diff --git a/src/phases/move-phase.ts b/src/phases/move-phase.ts index d58c052812f..3804ea78a3c 100644 --- a/src/phases/move-phase.ts +++ b/src/phases/move-phase.ts @@ -30,7 +30,7 @@ import { import { SpeciesFormChangePreMoveTrigger } from "#app/data/pokemon-forms"; import { getStatusEffectActivationText, getStatusEffectHealText } from "#app/data/status-effect"; import { Type } from "#enums/type"; -import { getTerrainBlockMessage } from "#app/data/weather"; +import { getTerrainBlockMessage, getWeatherBlockMessage } from "#app/data/weather"; import { MoveUsedEvent } from "#app/events/battle-scene"; import type { PokemonMove } from "#app/field/pokemon"; import type Pokemon from "#app/field/pokemon"; @@ -342,9 +342,10 @@ export class MovePhase extends BattlePhase { * TODO: is this sustainable? */ let failedDueToTerrain: boolean = false; + let failedDueToWeather: boolean = false; if (success) { const passesConditions = move.applyConditions(this.pokemon, targets[0], move); - const failedDueToWeather: boolean = globalScene.arena.isMoveWeatherCancelled(this.pokemon, move); + failedDueToWeather = globalScene.arena.isMoveWeatherCancelled(this.pokemon, move); failedDueToTerrain = globalScene.arena.isMoveTerrainCancelled(this.pokemon, this.targets, move); success = passesConditions && !failedDueToWeather && !failedDueToTerrain; } @@ -381,6 +382,8 @@ export class MovePhase extends BattlePhase { failedText = failureMessage; } else if (failedDueToTerrain) { failedText = getTerrainBlockMessage(targets[0], globalScene.arena.getTerrainType()); + } else if (failedDueToWeather) { + failedText = getWeatherBlockMessage(globalScene.arena.getWeatherType()); } this.showFailedText(failedText);