From 16b58c19dc9bb17ab0114fa66d4ad8aa8e117b67 Mon Sep 17 00:00:00 2001 From: Fuad Ali Date: Thu, 6 Mar 2025 16:39:28 +0000 Subject: [PATCH] Fix #5159: Harsh Sun, Heavy Rain, Delta Stream Messages Incorrect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The abilities Desolate Land, Primordial Sea and Delta Stream display the normal weather effect messages instead of special ones (e.g., "the sunlight got hot" instead of "The sunlight turned extremely harsh!"). Another issue is that if one of these special weathers is active and the opponent uses a move that is ineffective in this weather, it doesn't display a special message but the normal one (e.g., using a Water-type move in Harsh Sunlight). - Updated `weather.json` with the correct texts in: - `heavyRainStartMessage` - `harshSunStartMessage` - `strongWindsStartMessage` - Added new "effect" messages to fix the fail message bug: - `heavyRainEffectMessage` - `harshSunEffectMessage` - `defaultEffectMessage` - Added `getWeatherBlockMessage(WeatherType)` in `weather.ts` to return the correct message when a move fails due to Primordial Sea or Desolate Land. - Called `getWeatherBlockMessage()` in `useMove()` (line 385) to update `failedText` using `failedDueToWeather`. - Added `getWeatherType()` in `arena.ts` as a getter for `WeatherType`, since it wasn’t implemented yet. --- src/data/weather.ts | 10 ++++++++++ src/field/arena.ts | 4 ++++ src/phases/move-phase.ts | 7 +++++-- 3 files changed, 19 insertions(+), 2 deletions(-) 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);