[Client] Implement Mega Stones as {key: value} pairs (#2590)

* [Client] Implement Mega Stones as pairs {key: value}

* Simplify conditions

* Fix

* Update play.pokemonshowdown.com/js/client-teambuilder.js

---------

Co-authored-by: Kris Johnson <11083252+KrisXV@users.noreply.github.com>
This commit is contained in:
André Bastos Dias 2026-01-08 22:04:54 +00:00 committed by GitHub
parent 38bf75f6a8
commit cedd472222
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 8 deletions

View File

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

View File

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

View File

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

View File

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