mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 09:02:47 +02:00
[Bug] Harsh Sun, Heavy Rain, and Delta Stream messages now display when their effects are triggered (#5489)
This commit is contained in:
parent
fdc5e7daea
commit
da68cf15c6
@ -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:
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user