Add fix for crash when setting name if form index is too high

pull/16/head
Flashfyre 2024-02-21 12:18:57 -05:00
parent b054992ffa
commit 355fbac9c3
2 changed files with 2 additions and 1 deletions

View File

@ -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),

View File

@ -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: