From e73dbe98615588af8778a7a12a2eb259e6b9df99 Mon Sep 17 00:00:00 2001 From: Mikhail Shueb Date: Fri, 7 Mar 2025 17:31:34 +0000 Subject: [PATCH] [Bug] Chilly Reception no longer replaces Legendary Weather (Primordial Sea, Desolate Land, Delta Stream) (#5484) Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --- src/data/weather.ts | 12 ++++++++++++ src/field/arena.ts | 8 +++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/data/weather.ts b/src/data/weather.ts index 7de4d93b398..587d46f0772 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 getWeatherBlockMessage(weatherType: WeatherType): string { switch (weatherType) { case WeatherType.HARSH_SUN: diff --git a/src/field/arena.ts b/src/field/arena.ts index fe3e205bd2d..08ba3542fc2 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() && ![ WeatherType.HARSH_SUN, WeatherType.HEAVY_RAIN, WeatherType.STRONG_WINDS, WeatherType.NONE ].includes(weather)) { + 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?