@pkmn/mods 0.9.0 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6341,12 +6341,58 @@ var Pokedex = {
6341
6341
  };
6342
6342
 
6343
6343
  // src/gen7letsgo/scripts.ts
6344
+ function checkMegaForme(species, forme, battle) {
6345
+ const baseSpecies = battle.dex.species.get(species.baseSpecies);
6346
+ const altForme = battle.dex.species.get(`${baseSpecies.name}-${forme}`);
6347
+ if (altForme.exists && !battle.ruleTable.isBannedSpecies(altForme) && !battle.ruleTable.isBanned("pokemontag:mega")) {
6348
+ return altForme.name;
6349
+ }
6350
+ return null;
6351
+ }
6344
6352
  var Scripts = {
6345
6353
  inherit: "gen7",
6346
6354
  init() {
6347
6355
  this.modData("Abilities", "noability").isNonstandard = null;
6348
6356
  for (const i in this.data.Pokedex) {
6349
6357
  this.modData("Pokedex", i).abilities = { 0: "No Ability" };
6358
+ delete this.modData("Pokedex", i).requiredItem;
6359
+ }
6360
+ },
6361
+ actions: {
6362
+ canMegaEvo(pokemon) {
6363
+ return checkMegaForme(pokemon.baseSpecies, "Mega", this.battle);
6364
+ },
6365
+ canMegaEvoX(pokemon) {
6366
+ return checkMegaForme(pokemon.baseSpecies, "Mega-X", this.battle);
6367
+ },
6368
+ canMegaEvoY(pokemon) {
6369
+ return checkMegaForme(pokemon.baseSpecies, "Mega-Y", this.battle);
6370
+ },
6371
+ runMegaEvo(pokemon) {
6372
+ const speciesid = pokemon.canMegaEvo || pokemon.canMegaEvoX || pokemon.canMegaEvoY;
6373
+ if (!speciesid)
6374
+ return false;
6375
+ pokemon.formeChange(speciesid, null, true);
6376
+ this.battle.add("-mega", pokemon, this.dex.species.get(speciesid).baseSpecies);
6377
+ for (const ally of pokemon.side.pokemon) {
6378
+ ally.canMegaEvo = null;
6379
+ ally.canMegaEvoX = null;
6380
+ ally.canMegaEvoY = null;
6381
+ }
6382
+ this.battle.runEvent("AfterMega", pokemon);
6383
+ return true;
6384
+ },
6385
+ runMegaEvoX(pokemon) {
6386
+ if (!pokemon.canMegaEvoX)
6387
+ return false;
6388
+ pokemon.canMegaEvoY = null;
6389
+ return this.runMegaEvo(pokemon);
6390
+ },
6391
+ runMegaEvoY(pokemon) {
6392
+ if (!pokemon.canMegaEvoY)
6393
+ return false;
6394
+ pokemon.canMegaEvoX = null;
6395
+ return this.runMegaEvo(pokemon);
6350
6396
  }
6351
6397
  },
6352
6398
  /**