From 355fbac9c31b1c4bae1f84373fd63a316dfbcaa6 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Wed, 21 Feb 2024 12:18:57 -0500 Subject: [PATCH] Add fix for crash when setting name if form index is too high --- src/data/move.ts | 1 + src/data/pokemon-species.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/data/move.ts b/src/data/move.ts index a220df259e6..86de43fe43e 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -3770,6 +3770,7 @@ export function initMoves() { new AttackMove(Moves.BRUTAL_SWING, "Brutal Swing", Type.DARK, MoveCategory.PHYSICAL, 60, 100, 20, -1, "The user swings its body around violently to inflict damage on everything in its vicinity.", -1, 0, 7) .target(MoveTarget.ALL_NEAR_OTHERS), new StatusMove(Moves.AURORA_VEIL, "Aurora Veil (N)", Type.ICE, -1, 20, -1, "This move reduces damage from physical and special moves for five turns. This can be used only in a hailstorm.", -1, 0, 7) + .condition((user, target, move) => user.scene.arena.weather?.weatherType === WeatherType.HAIL) .target(MoveTarget.USER_SIDE), /* Unused */ new AttackMove(Moves.SINISTER_ARROW_RAID, "Sinister Arrow Raid (N)", Type.GHOST, MoveCategory.PHYSICAL, 180, -1, 1, -1, "The user, Decidueye, creates countless arrows using its Z-Power and shoots the target with full force.", -1, 0, 7), diff --git a/src/data/pokemon-species.ts b/src/data/pokemon-species.ts index e566e67dde1..cec9e062a50 100644 --- a/src/data/pokemon-species.ts +++ b/src/data/pokemon-species.ts @@ -352,7 +352,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm { getName(formIndex?: integer): string { if (formIndex !== undefined && this.forms.length) { - const form = this.forms[formIndex]; + const form = this.forms[Math.min(formIndex, this.forms.length - 1)]; switch (form.formKey) { case SpeciesFormKey.MEGA: case SpeciesFormKey.ETERNAMAX: