[Bug] Harsh Sun, Heavy Rain, and Delta Stream messages now display when their effects are triggered (#5489)

This commit is contained in:
Fuad Ali 2025-03-07 00:03:01 +00:00 committed by GitHub
parent fdc5e7daea
commit da68cf15c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 2 deletions

View File

@ -205,6 +205,16 @@ export function getWeatherClearMessage(weatherType: WeatherType): string | null
return 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 { export function getTerrainStartMessage(terrainType: TerrainType): string | null {
switch (terrainType) { switch (terrainType) {
case TerrainType.MISTY: case TerrainType.MISTY:

View File

@ -358,6 +358,10 @@ export class Arena {
return !!this.terrain && this.terrain.isMoveTerrainCancelled(user, targets, move); return !!this.terrain && this.terrain.isMoveTerrainCancelled(user, targets, move);
} }
public getWeatherType(): WeatherType {
return this.weather?.weatherType ?? WeatherType.NONE;
}
public getTerrainType(): TerrainType { public getTerrainType(): TerrainType {
return this.terrain?.terrainType ?? TerrainType.NONE; return this.terrain?.terrainType ?? TerrainType.NONE;
} }

View File

@ -30,7 +30,7 @@ import {
import { SpeciesFormChangePreMoveTrigger } from "#app/data/pokemon-forms"; import { SpeciesFormChangePreMoveTrigger } from "#app/data/pokemon-forms";
import { getStatusEffectActivationText, getStatusEffectHealText } from "#app/data/status-effect"; import { getStatusEffectActivationText, getStatusEffectHealText } from "#app/data/status-effect";
import { Type } from "#enums/type"; 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 { MoveUsedEvent } from "#app/events/battle-scene";
import type { PokemonMove } from "#app/field/pokemon"; import type { PokemonMove } from "#app/field/pokemon";
import type Pokemon from "#app/field/pokemon"; import type Pokemon from "#app/field/pokemon";
@ -342,9 +342,10 @@ export class MovePhase extends BattlePhase {
* TODO: is this sustainable? * TODO: is this sustainable?
*/ */
let failedDueToTerrain: boolean = false; let failedDueToTerrain: boolean = false;
let failedDueToWeather: boolean = false;
if (success) { if (success) {
const passesConditions = move.applyConditions(this.pokemon, targets[0], move); 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); failedDueToTerrain = globalScene.arena.isMoveTerrainCancelled(this.pokemon, this.targets, move);
success = passesConditions && !failedDueToWeather && !failedDueToTerrain; success = passesConditions && !failedDueToWeather && !failedDueToTerrain;
} }
@ -381,6 +382,8 @@ export class MovePhase extends BattlePhase {
failedText = failureMessage; failedText = failureMessage;
} else if (failedDueToTerrain) { } else if (failedDueToTerrain) {
failedText = getTerrainBlockMessage(targets[0], globalScene.arena.getTerrainType()); failedText = getTerrainBlockMessage(targets[0], globalScene.arena.getTerrainType());
} else if (failedDueToWeather) {
failedText = getWeatherBlockMessage(globalScene.arena.getWeatherType());
} }
this.showFailedText(failedText); this.showFailedText(failedText);