diff --git a/play.pokemonshowdown.com/js/client-teambuilder.js b/play.pokemonshowdown.com/js/client-teambuilder.js index 8d8c4d809d..5a265b5b3b 100644 --- a/play.pokemonshowdown.com/js/client-teambuilder.js +++ b/play.pokemonshowdown.com/js/client-teambuilder.js @@ -1521,8 +1521,8 @@ } if (this.curTeam.gen >= 6) { var item = dex.items.get(set.item); - if (item.megaStone && species.baseSpecies === item.megaEvolves) { - species = dex.species.get(item.megaStone); + if (item.megaEvolves && item.megaEvolves[species.baseSpecies]) { + species = dex.species.get(item.megaEvolves[species.baseSpecies]); typeTable = typeTable.filter(function (type) { return species.types.includes(type); }); diff --git a/play.pokemonshowdown.com/src/battle-dex-data.ts b/play.pokemonshowdown.com/src/battle-dex-data.ts index 983da372f6..df2ec834d2 100644 --- a/play.pokemonshowdown.com/src/battle-dex-data.ts +++ b/play.pokemonshowdown.com/src/battle-dex-data.ts @@ -1154,8 +1154,7 @@ export class Item implements Effect { readonly desc: string; readonly shortDesc: string; - readonly megaStone: string; - readonly megaEvolves: string; + readonly megaStone: { [megaEvolves: string]: string }; readonly zMove: string | true | null; readonly zMoveType: TypeName | ''; readonly zMoveFrom: string; @@ -1181,8 +1180,7 @@ export class Item implements Effect { this.desc = data.desc || data.shortDesc || ''; this.shortDesc = data.shortDesc || this.desc; - this.megaStone = data.megaStone || ''; - this.megaEvolves = data.megaEvolves || ''; + this.megaStone = data.megaStone || null; this.zMove = data.zMove || null; this.zMoveType = data.zMoveType || ''; this.zMoveFrom = data.zMoveFrom || ''; diff --git a/play.pokemonshowdown.com/src/battle-tooltips.ts b/play.pokemonshowdown.com/src/battle-tooltips.ts index 78bcbb881b..4bc1eb5ec3 100644 --- a/play.pokemonshowdown.com/src/battle-tooltips.ts +++ b/play.pokemonshowdown.com/src/battle-tooltips.ts @@ -2620,7 +2620,7 @@ export class BattleStatGuesser { let abilityid = toID(set.ability); let species = this.dex.species.get(set.species || set.name!); - if (item.megaEvolves === species.name) species = this.dex.species.get(item.megaStone); + if (item.megaStone?.[species.name]) species = this.dex.species.get(item.megaStone[species.name]); if (!species.exists) return '?'; let stats = species.baseStats; diff --git a/play.pokemonshowdown.com/src/battle.ts b/play.pokemonshowdown.com/src/battle.ts index 71c56a7c8d..0f9a845313 100644 --- a/play.pokemonshowdown.com/src/battle.ts +++ b/play.pokemonshowdown.com/src/battle.ts @@ -2473,7 +2473,11 @@ export class Battle { let species = this.dex.species.get(newSpeciesForme); if (nextArgs) { if (nextArgs[0] === '-mega') { - species = this.dex.species.get(this.dex.items.get(nextArgs[3]).megaStone); + 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]); + } } else if (nextArgs[0] === '-primal' && nextArgs.length > 2) { if (nextArgs[2] === 'Red Orb') species = this.dex.species.get('Groudon-Primal'); if (nextArgs[2] === 'Blue Orb') species = this.dex.species.get('Kyogre-Primal');