From 85c3a10d0fa47ba12328b3c9332d37832a13bc15 Mon Sep 17 00:00:00 2001 From: Mikhail-Shueb Date: Wed, 5 Mar 2025 20:25:53 +0000 Subject: [PATCH] Fixes #5378 --- public/locales | 2 +- src/data/weather.ts | 12 ++++++++++++ src/field/arena.ts | 8 +++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/public/locales b/public/locales index 0e5c6096ba2..841250a37b6 160000 --- a/public/locales +++ b/public/locales @@ -1 +1 @@ -Subproject commit 0e5c6096ba26f6b87aed1aab3fe9b0b23f6cbb7b +Subproject commit 841250a37b649e9ddbb004f2ebab4b6327e00a21 diff --git a/src/data/weather.ts b/src/data/weather.ts index 0c90f381130..51367c23efc 100644 --- a/src/data/weather.ts +++ b/src/data/weather.ts @@ -205,6 +205,18 @@ export function getWeatherClearMessage(weatherType: WeatherType): string | null return null; } +export function getLegendaryWeatherContinuesMessage(weatherType: WeatherType): string | null { + switch (weatherType) { + case WeatherType.HARSH_SUN: + return i18next.t("weather:harshSunContinueMessage"); + case WeatherType.HEAVY_RAIN: + return i18next.t("weather:heavyRainContinueMessage"); + case WeatherType.STRONG_WINDS: + return i18next.t("weather:strongWindsContinueMessage"); + } + return null; +} + 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..0eabd29c2a3 100644 --- a/src/field/arena.ts +++ b/src/field/arena.ts @@ -5,7 +5,7 @@ import type { Constructor } from "#app/utils"; import * as Utils from "#app/utils"; import type PokemonSpecies from "#app/data/pokemon-species"; import { getPokemonSpecies } from "#app/data/pokemon-species"; -import { getTerrainClearMessage, getTerrainStartMessage, getWeatherClearMessage, getWeatherStartMessage, Weather } from "#app/data/weather"; +import { getTerrainClearMessage, getTerrainStartMessage, getWeatherClearMessage, getWeatherStartMessage, getLegendaryWeatherContinuesMessage, Weather } from "#app/data/weather"; import { CommonAnim } from "#app/data/battle-anims"; import type { Type } from "#enums/type"; import type Move from "#app/data/move"; @@ -274,6 +274,12 @@ export class Arena { const oldWeatherType = this.weather?.weatherType || WeatherType.NONE; + if (this.weather?.isImmutable()) { + globalScene.unshiftPhase(new CommonAnimPhase(undefined, undefined, CommonAnim.SUNNY + (oldWeatherType - 1), true)); + globalScene.queueMessage(getLegendaryWeatherContinuesMessage(oldWeatherType)!); + return false; + } + this.weather = weather ? new Weather(weather, hasPokemonSource ? 5 : 0) : null; this.eventTarget.dispatchEvent(new WeatherChangedEvent(oldWeatherType, this.weather?.weatherType!, this.weather?.turnsLeft!)); // TODO: is this bang correct?