From 77f6befb7030d3ff69be45c68ce76edb5139ecd9 Mon Sep 17 00:00:00 2001 From: Bertie690 Date: Tue, 3 Jun 2025 23:05:56 -0400 Subject: [PATCH 1/8] Moved terrain messages to `terrain.ts`, made status failures use correct text --- src/battle-scene.ts | 5 +++ src/data/terrain.ts | 68 ++++++++++++++++++++++++++++++++++++++++ src/data/weather.ts | 45 -------------------------- src/field/arena.ts | 8 ++--- src/field/pokemon.ts | 49 +++++++++++++++++++---------- src/overrides.ts | 8 +++-- src/phases/move-phase.ts | 3 +- 7 files changed, 116 insertions(+), 70 deletions(-) diff --git a/src/battle-scene.ts b/src/battle-scene.ts index cbaf07d579c..3f435e947f3 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -2856,6 +2856,11 @@ export default class BattleScene extends SceneBase { promptDelay?: number | null, defer?: boolean | null, ) { + // don't display empty strings + if (!message) { + return; + } + const phase = new MessagePhase(message, callbackDelay, prompt, promptDelay); if (!defer) { // adds to the end of PhaseQueuePrepend diff --git a/src/data/terrain.ts b/src/data/terrain.ts index 5b6063cee68..c20a109276b 100644 --- a/src/data/terrain.ts +++ b/src/data/terrain.ts @@ -4,6 +4,7 @@ import { PokemonType } from "#enums/pokemon-type"; import { ProtectAttr } from "./moves/move"; import type { BattlerIndex } from "#app/battle"; import i18next from "i18next"; +import { getPokemonNameWithAffix } from "#app/messages"; export enum TerrainType { NONE, @@ -97,3 +98,70 @@ export function getTerrainColor(terrainType: TerrainType): [number, number, numb return [0, 0, 0]; } + +/** + * Return the message associated with a terrain effect starting. + * @param terrainType - The {@linkcode TerrainType} starting. + * @returns A string containing the appropriate terrain start text. + */ +export function getTerrainStartMessage(terrainType: TerrainType): string { + switch (terrainType) { + case TerrainType.MISTY: + return i18next.t("terrain:mistyStartMessage"); + case TerrainType.ELECTRIC: + return i18next.t("terrain:electricStartMessage"); + case TerrainType.GRASSY: + return i18next.t("terrain:grassyStartMessage"); + case TerrainType.PSYCHIC: + return i18next.t("terrain:psychicStartMessage"); + default: + console.warn(`${terrainType} unexpectedly provided as terrain type to getTerrainStartMessage!`); + return ""; + } +} + +/** + * Return the message associated with a terrain effect ceasing to exist. + * @param terrainType - The {@linkcode TerrainType} being cleared. + * @returns A string containing the appropriate terrain clear text. + */ +export function getTerrainClearMessage(terrainType: TerrainType): string { + switch (terrainType) { + case TerrainType.MISTY: + return i18next.t("terrain:mistyClearMessage"); + case TerrainType.ELECTRIC: + return i18next.t("terrain:electricClearMessage"); + case TerrainType.GRASSY: + return i18next.t("terrain:grassyClearMessage"); + case TerrainType.PSYCHIC: + return i18next.t("terrain:psychicClearMessage"); + default: + console.warn(`${terrainType} unexpectedly provided as terrain type to getTerrainClearMessage!`); + return ""; + } +} + +/** + * Return the message associated with a terrain-induced move/effect blockage. + * @param pokemon - The {@linkcode Pokemon} being protected. + * @param terrainType - The {@linkcode TerrainType} in question + * @returns A string containing the appropriate terrain block text. + */ +export function getTerrainBlockMessage(pokemon: Pokemon, terrainType: TerrainType): string { + switch (terrainType) { + case TerrainType.MISTY: + return i18next.t("terrain:mistyBlockMessage", { + pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), + }); + case TerrainType.ELECTRIC: + case TerrainType.GRASSY: + case TerrainType.PSYCHIC: + return i18next.t("terrain:defaultBlockMessage", { + pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), + terrainName: getTerrainName(terrainType), + }); + default: + console.warn(`${terrainType} unexpectedly provided as terrain type to getTerrainBlockMessage!`); + return ""; + } +} diff --git a/src/data/weather.ts b/src/data/weather.ts index be9107798df..5c266984615 100644 --- a/src/data/weather.ts +++ b/src/data/weather.ts @@ -7,7 +7,6 @@ import type Move from "./moves/move"; import { AttackMove } from "./moves/move"; import { randSeedInt } from "#app/utils/common"; import { SuppressWeatherEffectAbAttr } from "./abilities/ability"; -import { TerrainType, getTerrainName } from "./terrain"; import i18next from "i18next"; import { globalScene } from "#app/global-scene"; import type { Arena } from "#app/field/arena"; @@ -236,50 +235,6 @@ export function getWeatherBlockMessage(weatherType: WeatherType): string { return i18next.t("weather:defaultEffectMessage"); } -export function getTerrainStartMessage(terrainType: TerrainType): string | null { - switch (terrainType) { - case TerrainType.MISTY: - return i18next.t("terrain:mistyStartMessage"); - case TerrainType.ELECTRIC: - return i18next.t("terrain:electricStartMessage"); - case TerrainType.GRASSY: - return i18next.t("terrain:grassyStartMessage"); - case TerrainType.PSYCHIC: - return i18next.t("terrain:psychicStartMessage"); - default: - console.warn("getTerrainStartMessage not defined. Using default null"); - return null; - } -} - -export function getTerrainClearMessage(terrainType: TerrainType): string | null { - switch (terrainType) { - case TerrainType.MISTY: - return i18next.t("terrain:mistyClearMessage"); - case TerrainType.ELECTRIC: - return i18next.t("terrain:electricClearMessage"); - case TerrainType.GRASSY: - return i18next.t("terrain:grassyClearMessage"); - case TerrainType.PSYCHIC: - return i18next.t("terrain:psychicClearMessage"); - default: - console.warn("getTerrainClearMessage not defined. Using default null"); - return null; - } -} - -export function getTerrainBlockMessage(pokemon: Pokemon, terrainType: TerrainType): string { - if (terrainType === TerrainType.MISTY) { - return i18next.t("terrain:mistyBlockMessage", { - pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), - }); - } - return i18next.t("terrain:defaultBlockMessage", { - pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), - terrainName: getTerrainName(terrainType), - }); -} - export interface WeatherPoolEntry { weatherType: WeatherType; weight: number; diff --git a/src/field/arena.ts b/src/field/arena.ts index f083180490b..e2736a55d2f 100644 --- a/src/field/arena.ts +++ b/src/field/arena.ts @@ -5,8 +5,6 @@ import { randSeedInt, NumberHolder, isNullOrUndefined, type Constructor } from " import type PokemonSpecies from "#app/data/pokemon-species"; import { getPokemonSpecies } from "#app/data/pokemon-species"; import { - getTerrainClearMessage, - getTerrainStartMessage, getWeatherClearMessage, getWeatherStartMessage, getLegendaryWeatherContinuesMessage, @@ -18,7 +16,7 @@ import type Move from "#app/data/moves/move"; import type { ArenaTag } from "#app/data/arena-tag"; import { ArenaTagSide, ArenaTrapTag, getArenaTag } from "#app/data/arena-tag"; import type { BattlerIndex } from "#app/battle"; -import { Terrain, TerrainType } from "#app/data/terrain"; +import { Terrain, TerrainType, getTerrainClearMessage, getTerrainStartMessage } from "#app/data/terrain"; import { applyAbAttrs, applyPostTerrainChangeAbAttrs, @@ -433,9 +431,9 @@ export class Arena { if (!ignoreAnim) { globalScene.unshiftPhase(new CommonAnimPhase(undefined, undefined, CommonAnim.MISTY_TERRAIN + (terrain - 1))); } - globalScene.queueMessage(getTerrainStartMessage(terrain)!); // TODO: is this bang correct? + globalScene.queueMessage(getTerrainStartMessage(terrain)); } else { - globalScene.queueMessage(getTerrainClearMessage(oldTerrainType)!); // TODO: is this bang correct? + globalScene.queueMessage(getTerrainClearMessage(oldTerrainType)); } globalScene diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 329ba06fd09..c5a1ff4394f 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -257,6 +257,7 @@ import { MoveFlags } from "#enums/MoveFlags"; import { timedEventManager } from "#app/global-event-manager"; import { loadMoveAnimations } from "#app/sprites/pokemon-asset-loader"; import { ResetStatusPhase } from "#app/phases/reset-status-phase"; +import { getTerrainBlockMessage } from "#app/data/terrain"; export enum LearnMoveSituation { MISC, @@ -4612,16 +4613,33 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { ); } - queueImmuneMessage(quiet: boolean, effect?: StatusEffect): void { - if (!effect || quiet) { + /** + * Display an immunity message for a failed status application. + * @param quiet - Whether to suppress message and return early + * @param reason - The reason for the terrain blockage - + * can be "overlap" (already has same status), "other" (generic fail message) + * or a {@linkcode TerrainType} for terrain-based blockages. + */ + private queueImmuneMessage(quiet: boolean, reason: "overlap" | "other" | TerrainType = "other"): void { + if (quiet) { return; } - const message = - effect && this.status?.effect === effect - ? getStatusEffectOverlapText(effect ?? StatusEffect.NONE, getPokemonNameWithAffix(this)) - : i18next.t("abilityTriggers:moveImmunity", { - pokemonNameWithAffix: getPokemonNameWithAffix(this), - }); + + let message = ""; + if (reason === "overlap" && this) { + // "XYZ is already XXX!" + message = getStatusEffectOverlapText(this.status?.effect ?? StatusEffect.NONE, getPokemonNameWithAffix(this)); + } else if (typeof reason === "number") { + // "XYZ was protected by the XXX terrain!" / + // "XYZ surrounds itself with a protective mist!" + message = getTerrainBlockMessage(this, reason); + } else { + // "It doesn't affect XXX!" + message = i18next.t("abilityTriggers:moveImmunity", { + pokemonNameWithAffix: getPokemonNameWithAffix(this), + }); + } + globalScene.queueMessage(message); } @@ -4643,11 +4661,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { ): boolean { if (effect !== StatusEffect.FAINT) { if (overrideStatus ? this.status?.effect === effect : this.status) { - this.queueImmuneMessage(quiet, effect); + this.queueImmuneMessage(quiet, overrideStatus ? "overlap" : "other"); // having different status displays generic fail message return false; } if (this.isGrounded() && !ignoreField && globalScene.arena.terrain?.terrainType === TerrainType.MISTY) { - this.queueImmuneMessage(quiet, effect); + this.queueImmuneMessage(quiet, TerrainType.MISTY); return false; } } @@ -4678,7 +4696,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { if (this.isOfType(PokemonType.POISON) || this.isOfType(PokemonType.STEEL)) { if (poisonImmunity.includes(true)) { - this.queueImmuneMessage(quiet, effect); + this.queueImmuneMessage(quiet); return false; } } @@ -4686,13 +4704,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { } case StatusEffect.PARALYSIS: if (this.isOfType(PokemonType.ELECTRIC)) { - this.queueImmuneMessage(quiet, effect); + this.queueImmuneMessage(quiet); return false; } break; case StatusEffect.SLEEP: if (this.isGrounded() && globalScene.arena.terrain?.terrainType === TerrainType.ELECTRIC) { - this.queueImmuneMessage(quiet, effect); + this.queueImmuneMessage(quiet, TerrainType.ELECTRIC); return false; } break; @@ -4703,13 +4721,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { globalScene?.arena?.weather?.weatherType && [WeatherType.SUNNY, WeatherType.HARSH_SUN].includes(globalScene.arena.weather.weatherType)) ) { - this.queueImmuneMessage(quiet, effect); + this.queueImmuneMessage(quiet); return false; } break; case StatusEffect.BURN: if (this.isOfType(PokemonType.FIRE)) { - this.queueImmuneMessage(quiet, effect); + this.queueImmuneMessage(quiet); return false; } break; @@ -6702,7 +6720,6 @@ export class EnemyPokemon extends Pokemon { return ret; } - /** * Show or hide the type effectiveness multiplier window * Passing undefined will hide the window diff --git a/src/overrides.ts b/src/overrides.ts index 95c758d7c43..8fc97452d16 100644 --- a/src/overrides.ts +++ b/src/overrides.ts @@ -43,7 +43,9 @@ import { WeatherType } from "#enums/weather-type"; * } * ``` */ -const overrides = {} satisfies Partial>; +const overrides = { + MOVESET_OVERRIDE: [Moves.WHIRLWIND, Moves.BATON_PASS, Moves.DRAGON_TAIL, Moves.CIRCLE_THROW] +} satisfies Partial>; /** * If you need to add Overrides values for local testing do that inside {@linkcode overrides} @@ -272,7 +274,7 @@ class DefaultOverrides { /** * Set all non-scripted waves to use the selected battle type. - * + * * Ignored if set to {@linkcode BattleType.TRAINER} and `DISABLE_STANDARD_TRAINERS_OVERRIDE` is `true`. */ readonly BATTLE_TYPE_OVERRIDE: Exclude | null = null; @@ -298,4 +300,4 @@ export type RandomTrainerOverride = { } /** The type of the {@linkcode DefaultOverrides} class */ -export type OverridesType = typeof DefaultOverrides; \ No newline at end of file +export type OverridesType = typeof DefaultOverrides; diff --git a/src/phases/move-phase.ts b/src/phases/move-phase.ts index d7cbf1b9a6f..70fc0c01465 100644 --- a/src/phases/move-phase.ts +++ b/src/phases/move-phase.ts @@ -31,7 +31,7 @@ import { MoveFlags } from "#enums/MoveFlags"; import { SpeciesFormChangePreMoveTrigger } from "#app/data/pokemon-forms"; import { getStatusEffectActivationText, getStatusEffectHealText } from "#app/data/status-effect"; import { PokemonType } from "#enums/pokemon-type"; -import { getTerrainBlockMessage, getWeatherBlockMessage } from "#app/data/weather"; +import { 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"; @@ -50,6 +50,7 @@ import { BattlerTagType } from "#enums/battler-tag-type"; import { Moves } from "#enums/moves"; import { StatusEffect } from "#enums/status-effect"; import i18next from "i18next"; +import { getTerrainBlockMessage } from "#app/data/terrain"; export class MovePhase extends BattlePhase { protected _pokemon: Pokemon; From 4d66324442627d4ad7cb2d157324109e50752b90 Mon Sep 17 00:00:00 2001 From: Bertie690 <136088738+Bertie690@users.noreply.github.com> Date: Wed, 4 Jun 2025 07:30:39 -0400 Subject: [PATCH 2/8] Revert overrides.ts --- src/overrides.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/overrides.ts b/src/overrides.ts index 8fc97452d16..17f1a9c0bc0 100644 --- a/src/overrides.ts +++ b/src/overrides.ts @@ -43,9 +43,7 @@ import { WeatherType } from "#enums/weather-type"; * } * ``` */ -const overrides = { - MOVESET_OVERRIDE: [Moves.WHIRLWIND, Moves.BATON_PASS, Moves.DRAGON_TAIL, Moves.CIRCLE_THROW] -} satisfies Partial>; +const overrides = {} satisfies Partial>; /** * If you need to add Overrides values for local testing do that inside {@linkcode overrides} From 023964dbd8d6eba98b7711b00f34b28e6848c1a1 Mon Sep 17 00:00:00 2001 From: Bertie690 Date: Wed, 4 Jun 2025 08:33:55 -0400 Subject: [PATCH 3/8] Comment fix --- src/field/pokemon.ts | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index c5a1ff4394f..9bf9b663ad6 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -4616,11 +4616,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { /** * Display an immunity message for a failed status application. * @param quiet - Whether to suppress message and return early - * @param reason - The reason for the terrain blockage - + * @param reason - The reason for the status application failure - * can be "overlap" (already has same status), "other" (generic fail message) * or a {@linkcode TerrainType} for terrain-based blockages. + * Defaults to "other". */ - private queueImmuneMessage(quiet: boolean, reason: "overlap" | "other" | TerrainType = "other"): void { + private queueStatusImmuneMessage(quiet: boolean, reason: "overlap" | "other" | TerrainType = "other"): void { if (quiet) { return; } @@ -4661,11 +4662,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { ): boolean { if (effect !== StatusEffect.FAINT) { if (overrideStatus ? this.status?.effect === effect : this.status) { - this.queueImmuneMessage(quiet, overrideStatus ? "overlap" : "other"); // having different status displays generic fail message + this.queueStatusImmuneMessage(quiet, overrideStatus ? "overlap" : "other"); // having different status displays generic fail message return false; } if (this.isGrounded() && !ignoreField && globalScene.arena.terrain?.terrainType === TerrainType.MISTY) { - this.queueImmuneMessage(quiet, TerrainType.MISTY); + this.queueStatusImmuneMessage(quiet, TerrainType.MISTY); return false; } } @@ -4696,7 +4697,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { if (this.isOfType(PokemonType.POISON) || this.isOfType(PokemonType.STEEL)) { if (poisonImmunity.includes(true)) { - this.queueImmuneMessage(quiet); + this.queueStatusImmuneMessage(quiet); return false; } } @@ -4704,13 +4705,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { } case StatusEffect.PARALYSIS: if (this.isOfType(PokemonType.ELECTRIC)) { - this.queueImmuneMessage(quiet); + this.queueStatusImmuneMessage(quiet); return false; } break; case StatusEffect.SLEEP: if (this.isGrounded() && globalScene.arena.terrain?.terrainType === TerrainType.ELECTRIC) { - this.queueImmuneMessage(quiet, TerrainType.ELECTRIC); + this.queueStatusImmuneMessage(quiet, TerrainType.ELECTRIC); return false; } break; @@ -4721,13 +4722,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { globalScene?.arena?.weather?.weatherType && [WeatherType.SUNNY, WeatherType.HARSH_SUN].includes(globalScene.arena.weather.weatherType)) ) { - this.queueImmuneMessage(quiet); + this.queueStatusImmuneMessage(quiet); return false; } break; case StatusEffect.BURN: if (this.isOfType(PokemonType.FIRE)) { - this.queueImmuneMessage(quiet); + this.queueStatusImmuneMessage(quiet); return false; } break; From 13fc68546af9a58722ac518d9f7cca681054a78a Mon Sep 17 00:00:00 2001 From: Bertie690 Date: Wed, 4 Jun 2025 13:44:32 -0400 Subject: [PATCH 4/8] Fixed confusion message not appearing for misty terrain blockages --- src/data/battler-tags.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index c284fcd5130..5e6e464e651 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -717,7 +717,11 @@ export class ConfusedTag extends BattlerTag { } canAdd(pokemon: Pokemon): boolean { - return globalScene.arena.terrain?.terrainType !== TerrainType.MISTY || !pokemon.isGrounded(); + const blockedByTerrain = !(pokemon.isGrounded() && globalScene.arena.terrain?.terrainType === TerrainType.MISTY); + if (blockedByTerrain) { + pokemon.queueStatusImmuneMessage(false, TerrainType.MISTY); + } + return blockedByTerrain; } onAdd(pokemon: Pokemon): void { From 794ab9dcbb5975fa460b1ab8bfd8b8a6d476e88e Mon Sep 17 00:00:00 2001 From: Bertie690 Date: Wed, 4 Jun 2025 13:45:36 -0400 Subject: [PATCH 5/8] Fixed bug --- src/field/pokemon.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 9bf9b663ad6..c31991c9429 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -4621,7 +4621,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { * or a {@linkcode TerrainType} for terrain-based blockages. * Defaults to "other". */ - private queueStatusImmuneMessage(quiet: boolean, reason: "overlap" | "other" | TerrainType = "other"): void { + queueStatusImmuneMessage(quiet: boolean, reason: "overlap" | "other" | TerrainType = "other"): void { if (quiet) { return; } From cc901739b3ffbbaee07241618cef670d3b586c8f Mon Sep 17 00:00:00 2001 From: Bertie690 Date: Sat, 14 Jun 2025 20:13:57 -0400 Subject: [PATCH 6/8] re-added import --- src/field/pokemon.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 0ebbda4b604..53a2228306c 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -193,6 +193,7 @@ import type { MoveResult } from "#enums/move-result"; import { PokemonMove } from "#app/data/moves/pokemon-move"; import type { AbAttrMap, AbAttrString } from "#app/@types/ability-types"; import { getTerrainBlockMessage } from "#app/data/terrain"; +import { LearnMoveSituation } from "#enums/learn-move-situation"; /** Base typeclass for damage parameter methods, used for DRY */ type damageParams = { From 9d232199a38b087b89af2860853aa1d152e90de9 Mon Sep 17 00:00:00 2001 From: Bertie690 <136088738+Bertie690@users.noreply.github.com> Date: Sun, 15 Jun 2025 08:25:11 -0400 Subject: [PATCH 7/8] Update battler-tags.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --- src/data/battler-tags.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index a10c3d1852e..28120c8337e 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -678,11 +678,12 @@ export class ConfusedTag extends BattlerTag { } canAdd(pokemon: Pokemon): boolean { - const blockedByTerrain = !(pokemon.isGrounded() && globalScene.arena.terrain?.terrainType === TerrainType.MISTY); + const blockedByTerrain = pokemon.isGrounded() && globalScene.arena.terrain?.terrainType === TerrainType.MISTY; if (blockedByTerrain) { pokemon.queueStatusImmuneMessage(false, TerrainType.MISTY); + return false; } - return blockedByTerrain; + return true; } onAdd(pokemon: Pokemon): void { From 247321b529f8c9de39de71e25efd9cb93143f4b2 Mon Sep 17 00:00:00 2001 From: Bertie690 Date: Mon, 16 Jun 2025 17:22:56 -0400 Subject: [PATCH 8/8] Added exhaustiveness checking --- src/data/terrain.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/data/terrain.ts b/src/data/terrain.ts index 83cdf1db519..bcb28558de6 100644 --- a/src/data/terrain.ts +++ b/src/data/terrain.ts @@ -113,7 +113,9 @@ export function getTerrainStartMessage(terrainType: TerrainType): string { return i18next.t("terrain:grassyStartMessage"); case TerrainType.PSYCHIC: return i18next.t("terrain:psychicStartMessage"); + case TerrainType.NONE: default: + terrainType satisfies TerrainType.NONE; console.warn(`${terrainType} unexpectedly provided as terrain type to getTerrainStartMessage!`); return ""; } @@ -134,7 +136,9 @@ export function getTerrainClearMessage(terrainType: TerrainType): string { return i18next.t("terrain:grassyClearMessage"); case TerrainType.PSYCHIC: return i18next.t("terrain:psychicClearMessage"); + case TerrainType.NONE: default: + terrainType satisfies TerrainType.NONE; console.warn(`${terrainType} unexpectedly provided as terrain type to getTerrainClearMessage!`); return ""; } @@ -159,7 +163,9 @@ export function getTerrainBlockMessage(pokemon: Pokemon, terrainType: TerrainTyp pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), terrainName: getTerrainName(terrainType), }); + case TerrainType.NONE: default: + terrainType satisfies TerrainType.NONE; console.warn(`${terrainType} unexpectedly provided as terrain type to getTerrainBlockMessage!`); return ""; }