From a8d72a3cb4015eb58488a4690b39129dc0fabc1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bastos=20Dias?= <80102738+andrebastosdias@users.noreply.github.com> Date: Fri, 9 Jan 2026 22:54:50 +0000 Subject: [PATCH] Fix Mega ability display (#2592) --- play.pokemonshowdown.com/src/battle.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/play.pokemonshowdown.com/src/battle.ts b/play.pokemonshowdown.com/src/battle.ts index 0f9a84531..8d1075f2c 100644 --- a/play.pokemonshowdown.com/src/battle.ts +++ b/play.pokemonshowdown.com/src/battle.ts @@ -2471,12 +2471,15 @@ export class Battle { newSpeciesForme = args[2].substr(0, commaIndex); } let species = this.dex.species.get(newSpeciesForme); + if (nextArgs) { + // Handle abilities in Mix and Mega if (nextArgs[0] === '-mega') { const item = this.dex.items.get(nextArgs[3]); if (item.megaStone) { - const index = Object.values(item.megaStone).indexOf(species.name); - if (index >= 0) species = this.dex.species.get(Object.keys(item.megaStone)[index]); + let index = Object.values(item.megaStone).indexOf(species.name); + if (index < 0) index = 0; + species = this.dex.species.get(Object.values(item.megaStone)[index]); } } else if (nextArgs[0] === '-primal' && nextArgs.length > 2) { if (nextArgs[2] === 'Red Orb') species = this.dex.species.get('Groudon-Primal');