Fix Mega ability display (#2592)

This commit is contained in:
André Bastos Dias 2026-01-09 22:54:50 +00:00 committed by GitHub
parent 56df608ba8
commit a8d72a3cb4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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');