@pkmn/sim 0.5.8 → 0.5.9

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.
package/config/formats.ts CHANGED
@@ -234,8 +234,8 @@ export const Formats: FormatList = [
234
234
  mod: 'gen8',
235
235
  ruleset: ['[Gen 8] PU'],
236
236
  banlist: [
237
- 'PU', 'Aurorus', 'Centiskorch', 'Drampa', 'Exeggutor-Alola', 'Gallade', 'Haunter', 'Magmortar', 'Magneton', 'Omastar', 'Rotom-Frost',
238
- 'Turtonator', 'Vanilluxe', 'Vikavolt', 'Silvally-Dragon', 'Silvally-Ground', 'Sneasel', 'Damp Rock', 'Grassy Seed',
237
+ 'PU', 'Arctovish', 'Aurorus', 'Centiskorch', 'Drampa', 'Exeggutor-Alola', 'Gallade', 'Haunter', 'Magmortar', 'Magneton', 'Omastar',
238
+ 'Rotom-Frost', 'Turtonator', 'Vanilluxe', 'Vikavolt', 'Silvally-Dragon', 'Silvally-Ground', 'Sneasel', 'Damp Rock', 'Grassy Seed',
239
239
  ],
240
240
  },
241
241
  {
@@ -639,143 +639,197 @@ export const Formats: FormatList = [
639
639
  column: 2,
640
640
  },
641
641
  {
642
- name: "[Gen 8] Trademarked",
643
- desc: `Sacrifice your Pokémon's ability for a status move that activates on switch-in.`,
642
+ name: "[Gen 8] Shared Power",
643
+ desc: `Once a Pokémon switches in, its ability is shared with the rest of the team.`,
644
644
  threads: [
645
- `&bullet; <a href="https://www.smogon.com/forums/threads/3656980/">Trademarked</a>`,
645
+ `&bullet; <a href="https://www.smogon.com/forums/threads/3660877/">Shared Power</a>`,
646
646
  ],
647
647
 
648
- mod: 'gen8',
648
+ mod: 'sharedpower',
649
649
  // searchShow: false,
650
650
  ruleset: ['Standard', 'Dynamax Clause'],
651
651
  banlist: [
652
- 'Calyrex-Ice', 'Calyrex-Shadow', 'Darmanitan-Galar', 'Dialga', 'Dracovish', 'Dragapult', 'Eternatus', 'Kyurem-Black', 'Kyurem-White', 'Giratina',
653
- 'Giratina-Origin', 'Genesect', 'Groudon', 'Ho-Oh', 'Kartana', 'Kyogre', 'Lugia', 'Lunala', 'Magearna', 'Marowak-Alola', 'Marshadow', 'Melmetal',
654
- 'Mewtwo', 'Naganadel', 'Necrozma-Dawn-Wings', 'Necrozma-Dusk-Mane', 'Palkia', 'Pheromosa', 'Rayquaza', 'Reshiram', 'Solgaleo', 'Spectrier',
655
- 'Urshifu-Base', 'Victini', 'Xerneas', 'Yveltal', 'Zacian', 'Zacian-Crowned', 'Zamazenta', 'Zamazenta-Crowned', 'Zekrom', 'Zygarde-Base',
656
- 'Arena Trap', 'Moody', 'Neutralizing Gas', 'Power Construct', 'Shadow Tag', 'Baton Pass',
657
- ],
658
- restricted: [
659
- 'Baneful Bunker', 'Block', 'Copycat', 'Corrosive Gas', 'Detect', 'Destiny Bond', 'Disable', 'Encore', 'Fairy Lock', 'Hypnosis', 'Ingrain',
660
- 'Instruct', 'Lovely Kiss', 'King\'s Shield', 'Mat Block', 'Mean Look', 'Memento', 'move:Metronome', 'Obstruct', 'Octolock', 'Nature Power',
661
- 'Parting Shot', 'Psycho Shift', 'Protect', 'Roar', 'Sing', 'Skill Swap', 'Sleep Powder', 'Sleep Talk', 'Spiky Shield', 'Spore', 'Substitute',
662
- 'Switcheroo', 'Teleport', 'Trick', 'Whirlwind', 'Wish', 'Yawn',
652
+ 'Calyrex-Ice', 'Calyrex-Shadow', 'Darmanitan-Galar', 'Dialga', 'Dracovish', 'Eternatus', 'Genesect', 'Giratina',
653
+ 'Giratina-Origin', 'Groudon', 'Ho-Oh', 'Kyogre', 'Kyurem-Black', 'Kyurem-White', 'Lugia', 'Lunala', 'Magearna',
654
+ 'Marshadow', 'Melmetal', 'Mewtwo', 'Naganadel', 'Necrozma-Dawn-Wings', 'Necrozma-Dusk-Mane', 'Palkia',
655
+ 'Pheromosa', 'Rayquaza', 'Reshiram', 'Shedinja', 'Solgaleo', 'Urshifu-Base', 'Urshifu-Rapid-Strike',
656
+ 'Xerneas', 'Yveltal', 'Zacian', 'Zacian-Crowned', 'Zamazenta', 'Zamazenta-Crowned', 'Zekrom',
657
+ 'Arena Trap', 'Contrary', 'Drizzle ++ Swift Swim', 'Drought ++ Chlorophyll', 'Electric Surge ++ Surge Surfer',
658
+ 'Fur Coat', 'Guts', 'Harvest', 'Huge Power', 'Imposter', 'Innards Out', 'Libero', 'Magic Bounce', 'Magic Guard',
659
+ 'Magnet Pull', 'Mold Breaker', 'Moody', 'Neutralizing Gas', 'Power Construct', 'Queenly Majesty', 'Quick Draw',
660
+ 'Regenerator', 'Sand Rush', 'Sand Veil', 'Shadow Tag', 'Simple', 'Snow Cloak', 'Snow Warning ++ Slush Rush', 'Speed Boost',
661
+ 'Stakeout', 'Steelworker ++ Steely Spirit', 'Tinted Lens', 'Triage', 'Unaware', 'Unburden', 'Water Bubble',
662
+ 'Baton Pass',
663
663
  ],
664
- onValidateTeam(team, format, teamHas) {
665
- const problems = [];
666
- for (const trademark in teamHas.trademarks) {
667
- if (teamHas.trademarks[trademark] > 1) {
668
- problems.push(`You are limited to 1 of each Trademark.`, `(You have ${teamHas.trademarks[trademark]} Pok\u00e9mon with ${trademark} as a Trademark.)`);
664
+ getSharedPower(pokemon) {
665
+ const sharedPower = new Set<string>();
666
+ for (const ally of pokemon.side.pokemon) {
667
+ if (ally.previouslySwitchedIn > 0) {
668
+ if (pokemon.battle.dex.currentMod !== 'sharedpower' && ['trace', 'mirrorarmor'].includes(ally.baseAbility)) {
669
+ sharedPower.add('noability');
670
+ continue;
671
+ }
672
+ sharedPower.add(ally.baseAbility);
669
673
  }
670
674
  }
671
- return problems;
675
+ sharedPower.delete(pokemon.baseAbility);
676
+ return sharedPower;
672
677
  },
673
- validateSet(set, teamHas) {
674
- const dex = this.dex;
675
- const ability = dex.moves.get(set.ability);
676
- if (!ability.exists) { // Not even a real move
677
- return this.validateSet(set, teamHas);
678
- }
679
- // Absolute trademark bans
680
- if (ability.category !== 'Status') {
681
- return [`${ability.name} is not a status move, and cannot be used as a trademark.`];
682
- }
683
- if (ability.forceSwitch || ability.selfSwitch) {
684
- return [
685
- `Force-switching and self-switching moves are banned from being used as trademarks.`,
686
- `(${ability.name} is a ${ability.forceSwitch ? 'force' : 'self'}-switching move.)`,
687
- ];
678
+ onBeforeSwitchIn(pokemon) {
679
+ let format = this.format;
680
+ if (!format.getSharedPower) format = this.dex.formats.get('gen8sharedpower');
681
+ for (const ability of format.getSharedPower!(pokemon)) {
682
+ const effect = 'ability:' + ability;
683
+ pokemon.volatiles[effect] = {id: this.toID(effect), target: pokemon};
684
+ if (!pokemon.m.abils) pokemon.m.abils = [];
685
+ if (!pokemon.m.abils.includes(effect)) pokemon.m.abils.push(effect);
688
686
  }
689
- const irrevokablyRestricted = [
690
- 'Assist', 'Copycat', 'Metronome', 'Mirror Move', 'Sleep Talk', // Could call another unsafe trademark
691
- 'Recycle', 'Trace', // Causes endless turns
692
- 'Skill Swap', // Self-propagates indefinitely
693
- ];
694
- for (const m of set.moves) {
695
- const move = dex.moves.get(m);
696
- if (irrevokablyRestricted.includes(move.name)) {
697
- return [`${move.name} is banned from Trademark, irrespective of custom rules, because it can cause endless turns.`];
687
+ },
688
+ onSwitchInPriority: 2,
689
+ onSwitchIn(pokemon) {
690
+ let format = this.format;
691
+ if (!format.getSharedPower) format = this.dex.formats.get('gen8sharedpower');
692
+ for (const ability of format.getSharedPower!(pokemon)) {
693
+ if (ability === 'noability') {
694
+ this.hint(`Mirror Armor and Trace break in Shared Power formats that don't use Shared Power as a base, so they get removed from non-base users.`);
698
695
  }
696
+ const effect = 'ability:' + ability;
697
+ delete pokemon.volatiles[effect];
698
+ pokemon.addVolatile(effect);
699
699
  }
700
- if (irrevokablyRestricted.includes(ability.name)) {
701
- return [`${ability.name} cannot safely function as a trademark.`];
702
- }
703
- // Contingent trademark bans
704
- if (this.ruleTable.isRestricted(`move:${ability.id}`)) {
705
- return [`${ability.name} is restricted from being used as a trademark.`];
706
- }
707
- if (set.moves.map(this.toID).includes(ability.id)) {
708
- return [`${set.name} may not use ${ability.name} as both a trademark and one of its moves simultaneously.`];
709
- }
710
- const customRules = this.format.customRules || [];
711
- if (!customRules.includes('!obtainableabilities')) customRules.push('!obtainableabilities');
712
-
713
- const TeamValidator: typeof import('../sim/team-validator').TeamValidator =
714
- require('../sim/team-validator').TeamValidator;
715
-
716
- const validator = new TeamValidator(dex.formats.get(`${this.format.id}@@@${customRules.join(',')}`));
717
- const moves = set.moves;
718
- set.moves = [ability.id];
719
- set.ability = dex.species.get(set.species).abilities['0'];
720
- let problems = validator.validateSet(set, {}) || [];
721
- if (problems.length) return problems;
722
- set.moves = moves;
723
- set.ability = dex.species.get(set.species).abilities['0'];
724
- problems = problems.concat(validator.validateSet(set, teamHas) || []);
725
- set.ability = ability.id;
726
- if (!teamHas.trademarks) teamHas.trademarks = {};
727
- teamHas.trademarks[ability.name] = (teamHas.trademarks[ability.name] || 0) + 1;
728
- return problems.length ? problems : null;
729
- },
730
- pokemon: {
731
- getAbility() {
732
- const move = this.battle.dex.moves.get(this.battle.toID(this.ability));
733
- if (!move.exists) return Object.getPrototypeOf(this).getAbility.call(this);
734
- return {
735
- id: move.id,
736
- name: move.name,
737
- onStart(this: Battle, pokemon: Pokemon) {
738
- this.add('-activate', pokemon, 'ability: ' + move.name);
739
- this.actions.useMove(move, pokemon);
740
- },
741
- toString() {
742
- return "";
743
- },
744
- };
745
- },
746
700
  },
747
701
  },
748
702
  {
749
- name: "[Gen 8] Linked",
750
- desc: `The first two moves in a Pok&eacute;mon's moveset are used simultaneously.`,
703
+ name: "[Gen 8] Cross Evolution",
704
+ desc: `Give a Pok&eacute;mon a Pok&eacute;mon name of the next evolution stage as a nickname to inherit stat changes, typing, abilities, and up to 2 moves from the next stage Pok&eacute;mon.`,
751
705
  threads: [
752
- `&bullet; <a href="https://www.smogon.com/forums/threads/3660421/">Linked</a>`,
706
+ `&bullet; <a href="https://www.smogon.com/forums/threads/3657562/">Cross Evolution</a>`,
753
707
  ],
754
708
 
755
- mod: 'linked',
756
- ruleset: ['Standard', 'Dynamax Clause'],
757
- banlist: [
758
- 'Calyrex-Ice', 'Calyrex-Shadow', 'Cinderace', 'Cloyster', 'Darmanitan-Galar', 'Dialga', 'Dracovish', 'Eternatus', 'Genesect', 'Giratina',
759
- 'Giratina-Origin', 'Groudon', 'Ho-Oh', 'Kyogre', 'Kyurem', 'Kyurem-Black', 'Kyurem-White', 'Landorus-Base', 'Lugia', 'Lunala', 'Magearna',
760
- 'Marshadow', 'Mewtwo', 'Naganadel', 'Necrozma-Dawn-Wings', 'Necrozma-Dusk-Mane', 'Palkia', 'Pheromosa', 'Rayquaza', 'Reshiram', 'Solgaleo',
761
- 'Spectrier', 'Urshifu-Base', 'Volcarona', 'Xerneas', 'Yveltal', 'Zacian', 'Zacian-Crowned', 'Zamazenta', 'Zamazenta-Crowned', 'Zekrom',
762
- 'Zygarde-Base', 'Zygarde-Complete', 'Arena Trap', 'Chlorophyll', 'Moody', 'Power Construct', 'Sand Rush', 'Sand Veil', 'Shadow Tag', 'Slush Rush',
763
- 'Snow Cloak', 'Speed Boost', 'Surge Surfer', 'Swift Swim', 'Unburden', 'Bright Powder', 'King\'s Rock', 'Lax Incense', 'Baton Pass',
764
- ],
765
- restricted: [
766
- 'Baneful Bunker', 'Bounce', 'Protect', 'Detect', 'Dig', 'Dive', 'Fly', 'King\'s Shield', 'Nature\'s Madness', 'Night Shade',
767
- 'Obstruct', 'Phantom Force', 'Seismic Toss', 'Shadow Force', 'Sky Drop', 'Spiky Shield', 'Super Fang', 'Trick Room',
768
- ],
769
- onValidateSet(set) {
770
- const problems = [];
771
- for (const [i, moveid] of set.moves.entries()) {
772
- const move = this.dex.moves.get(moveid);
773
- if ([0, 1].includes(i) && this.ruleTable.isRestricted(`move:${move.id}`)) {
774
- problems.push(`${set.name || set.species}'s move ${move.name} cannot be linked.`);
709
+ mod: 'gen8',
710
+ // searchShow: false,
711
+ ruleset: ['Standard', 'Overflow Stat Mod', 'Dynamax Clause'],
712
+ banlist: ['Corsola-Galar', 'Sneasel', 'Type: Null', 'Arena Trap', 'Ice Scales', 'Moody', 'King\'s Rock', 'Baton Pass'],
713
+ restricted: ['Chansey', 'Lunala', 'Shedinja', 'Solgaleo', 'Gorilla Tactics', 'Huge Power', 'Pure Power', 'Shadow Tag'],
714
+ onValidateTeam(team) {
715
+ const names = new Set<ID>();
716
+ for (const set of team) {
717
+ const name = set.name;
718
+ if (names.has(this.dex.toID(name))) {
719
+ return [
720
+ `Your Pok\u00e9mon must have different nicknames.`,
721
+ `(You have more than one Pok\u00e9mon named '${name}')`,
722
+ ];
775
723
  }
724
+ names.add(this.dex.toID(name));
725
+ }
726
+ if (!names.size) {
727
+ return [
728
+ `${this.format.name} works using nicknames; your team has 0 nicknamed Pok\u00e9mon.`,
729
+ `(If this was intentional, add a nickname to one Pok\u00e9mon that isn't the name of a Pok\u00e9mon species.)`,
730
+ ];
731
+ }
732
+ },
733
+ checkCanLearn(move, species, lsetData, set) {
734
+ // @ts-ignore
735
+ if (!set.sp?.exists || !set.crossSpecies?.exists) {
736
+ return this.checkCanLearn(move, species, lsetData, set);
776
737
  }
738
+ // @ts-ignore
739
+ const problem = this.checkCanLearn(move, set.sp);
740
+ if (!problem) return null;
741
+ // @ts-ignore
742
+ if (!set.crossMovesLeft) return problem;
743
+ // @ts-ignore
744
+ if (this.checkCanLearn(move, set.crossSpecies)) return problem;
745
+ // @ts-ignore
746
+ set.crossMovesLeft--;
747
+ return null;
748
+ },
749
+ validateSet(set, teamHas) {
750
+ const crossSpecies = this.dex.species.get(set.name);
751
+ let problems = this.dex.formats.get('Pokemon').onChangeSet?.call(this, set, this.format) || null;
752
+ if (Array.isArray(problems) && problems.length) return problems;
753
+ const crossNonstandard = (!this.ruleTable.has('standardnatdex') && crossSpecies.isNonstandard === 'Past') ||
754
+ crossSpecies.isNonstandard === 'Future';
755
+ const crossIsCap = !this.ruleTable.has('+pokemontag:cap') && crossSpecies.isNonstandard === 'CAP';
756
+ if (!crossSpecies.exists || crossNonstandard || crossIsCap) return this.validateSet(set, teamHas);
757
+ const species = this.dex.species.get(set.species);
758
+ const check = this.checkSpecies(set, species, species, {});
759
+ if (check) return [check];
760
+ const nonstandard = !this.ruleTable.has('standardnatdex') && species.isNonstandard === 'Past';
761
+ const isCap = !this.ruleTable.has('+pokemontag:cap') && species.isNonstandard === 'CAP';
762
+ if (!species.exists || nonstandard || isCap || species === crossSpecies) return this.validateSet(set, teamHas);
763
+ if (!species.nfe) return [`${species.name} cannot cross evolve because it doesn't evolve.`];
764
+ const crossIsUnreleased = (crossSpecies.tier === "Unreleased" && crossSpecies.isNonstandard === "Unobtainable");
765
+ if (crossSpecies.battleOnly || crossIsUnreleased || !crossSpecies.prevo) {
766
+ return [`${species.name} cannot cross evolve into ${crossSpecies.name} because it isn't an evolution.`];
767
+ }
768
+ if (this.ruleTable.isRestrictedSpecies(crossSpecies)) {
769
+ return [`${species.name} cannot cross evolve into ${crossSpecies.name} because it is banned.`];
770
+ }
771
+ const crossPrevoSpecies = this.dex.species.get(crossSpecies.prevo);
772
+ if (!crossPrevoSpecies.prevo !== !species.prevo) {
773
+ return [
774
+ `${species.name} cannot cross evolve into ${crossSpecies.name} because they are not consecutive evolution stages.`,
775
+ ];
776
+ }
777
+ const ability = this.dex.abilities.get(set.ability);
778
+ if (!this.ruleTable.isRestricted(`ability:${ability.id}`) || Object.values(species.abilities).includes(ability.name)) {
779
+ set.species = crossSpecies.name;
780
+ }
781
+
782
+ // @ts-ignore
783
+ set.sp = species;
784
+ // @ts-ignore
785
+ set.crossSpecies = crossSpecies;
786
+ // @ts-ignore
787
+ set.crossMovesLeft = 2;
788
+ problems = this.validateSet(set, teamHas);
789
+ set.name = crossSpecies.name;
790
+ set.species = species.name;
777
791
  return problems;
778
792
  },
793
+ onModifySpecies(species, target, source, effect) {
794
+ if (!target) return; // chat
795
+ if (effect && ['imposter', 'transform'].includes(effect.id)) return;
796
+ if (target.set.name === target.set.species) return;
797
+ const crossSpecies = this.dex.species.get(target.set.name);
798
+ if (!crossSpecies.exists) return;
799
+ if (species.battleOnly || !species.nfe) return;
800
+ const crossIsUnreleased = (crossSpecies.tier === "Unreleased" && crossSpecies.isNonstandard === "Unobtainable");
801
+ if (crossSpecies.battleOnly || crossIsUnreleased || !crossSpecies.prevo) return;
802
+ const crossPrevoSpecies = this.dex.species.get(crossSpecies.prevo);
803
+ if (!crossPrevoSpecies.prevo !== !species.prevo) return;
804
+
805
+ const mixedSpecies = this.dex.deepClone(species);
806
+ mixedSpecies.baseSpecies = mixedSpecies.name = `${species.name}-${crossSpecies.name}`;
807
+ mixedSpecies.weightkg =
808
+ Math.max(0.1, +(species.weightkg + crossSpecies.weightkg - crossPrevoSpecies.weightkg)).toFixed(1);
809
+ mixedSpecies.nfe = false;
810
+ mixedSpecies.evos = [];
811
+ mixedSpecies.eggGroups = crossSpecies.eggGroups;
812
+ mixedSpecies.abilities = crossSpecies.abilities;
813
+ mixedSpecies.bst = 0;
814
+ let i: StatID;
815
+ for (i in species.baseStats) {
816
+ const statChange = crossSpecies.baseStats[i] - crossPrevoSpecies.baseStats[i];
817
+ mixedSpecies.baseStats[i] = this.clampIntRange(species.baseStats[i] + statChange, 1, 255);
818
+ mixedSpecies.bst += mixedSpecies.baseStats[i];
819
+ }
820
+ if (crossSpecies.types[0] !== crossPrevoSpecies.types[0]) mixedSpecies.types[0] = crossSpecies.types[0];
821
+ if (crossSpecies.types[1] !== crossPrevoSpecies.types[1]) {
822
+ mixedSpecies.types[1] = crossSpecies.types[1] || crossSpecies.types[0];
823
+ }
824
+ if (mixedSpecies.types[0] === mixedSpecies.types[1]) mixedSpecies.types = [mixedSpecies.types[0]];
825
+
826
+ return mixedSpecies;
827
+ },
828
+ onBegin() {
829
+ for (const pokemon of this.getAllPokemon()) {
830
+ pokemon.baseSpecies = pokemon.species;
831
+ }
832
+ },
779
833
  },
780
834
 
781
835
  // Other Metagames
@@ -1093,7 +1147,6 @@ export const Formats: FormatList = [
1093
1147
  ],
1094
1148
 
1095
1149
  mod: 'gen8bdsp',
1096
- searchShow: false,
1097
1150
  ruleset: ['[Gen 8 BDSP] RU'],
1098
1151
  banlist: ['RU', 'NUBL'],
1099
1152
  },
@@ -1375,6 +1428,39 @@ export const Formats: FormatList = [
1375
1428
  this.add('-start', pokemon, donorTemplate.name, '[silent]');
1376
1429
  },
1377
1430
  },
1431
+ {
1432
+ name: "[Gen 8] Linked",
1433
+ desc: `The first two moves in a Pok&eacute;mon's moveset are used simultaneously.`,
1434
+ threads: [
1435
+ `&bullet; <a href="https://www.smogon.com/forums/threads/3660421/">Linked</a>`,
1436
+ ],
1437
+
1438
+ mod: 'linked',
1439
+ searchShow: false,
1440
+ ruleset: ['Standard', 'Dynamax Clause'],
1441
+ banlist: [
1442
+ 'Calyrex-Ice', 'Calyrex-Shadow', 'Cinderace', 'Cloyster', 'Darmanitan-Galar', 'Dialga', 'Dracovish', 'Eternatus', 'Genesect', 'Giratina',
1443
+ 'Giratina-Origin', 'Groudon', 'Ho-Oh', 'Kartana', 'Kyogre', 'Kyurem', 'Kyurem-Black', 'Kyurem-White', 'Landorus-Base', 'Lugia', 'Lunala',
1444
+ 'Magearna', 'Marshadow', 'Mewtwo', 'Naganadel', 'Necrozma-Dawn-Wings', 'Necrozma-Dusk-Mane', 'Palkia', 'Pheromosa', 'Rayquaza', 'Reshiram',
1445
+ 'Solgaleo', 'Spectrier', 'Urshifu-Base', 'Volcarona', 'Xerneas', 'Yveltal', 'Zacian', 'Zacian-Crowned', 'Zamazenta', 'Zamazenta-Crowned',
1446
+ 'Zekrom', 'Zygarde-Base', 'Zygarde-Complete', 'Arena Trap', 'Chlorophyll', 'Moody', 'Power Construct', 'Sand Rush', 'Sand Veil', 'Shadow Tag',
1447
+ 'Slush Rush', 'Snow Cloak', 'Speed Boost', 'Surge Surfer', 'Swift Swim', 'Unburden', 'Bright Powder', 'King\'s Rock', 'Lax Incense', 'Baton Pass',
1448
+ ],
1449
+ restricted: [
1450
+ 'Baneful Bunker', 'Bounce', 'Protect', 'Detect', 'Dig', 'Dive', 'Fly', 'King\'s Shield', 'Nature\'s Madness', 'Night Shade',
1451
+ 'Obstruct', 'Phantom Force', 'Seismic Toss', 'Shadow Force', 'Sky Drop', 'Spiky Shield', 'Super Fang', 'Trick Room',
1452
+ ],
1453
+ onValidateSet(set) {
1454
+ const problems = [];
1455
+ for (const [i, moveid] of set.moves.entries()) {
1456
+ const move = this.dex.moves.get(moveid);
1457
+ if ([0, 1].includes(i) && this.ruleTable.isRestricted(`move:${move.id}`)) {
1458
+ problems.push(`${set.name || set.species}'s move ${move.name} cannot be linked.`);
1459
+ }
1460
+ }
1461
+ return problems;
1462
+ },
1463
+ },
1378
1464
  {
1379
1465
  name: "[Gen 8] Multibility",
1380
1466
  desc: `Run a second ability at the cost of giving up a Pok&eacute;mon's item slot.`,
@@ -1683,64 +1769,113 @@ export const Formats: FormatList = [
1683
1769
  },
1684
1770
  },
1685
1771
  {
1686
- name: "[Gen 8] Shared Power",
1687
- desc: `Once a Pok&eacute;mon switches in, its ability is shared with the rest of the team.`,
1772
+ name: "[Gen 8] Trademarked",
1773
+ desc: `Sacrifice your Pok&eacute;mon's ability for a status move that activates on switch-in.`,
1688
1774
  threads: [
1689
- `&bullet; <a href="https://www.smogon.com/forums/threads/3660877/">Shared Power</a>`,
1775
+ `&bullet; <a href="https://www.smogon.com/forums/threads/3656980/">Trademarked</a>`,
1690
1776
  ],
1691
1777
 
1692
- mod: 'sharedpower',
1778
+ mod: 'gen8',
1779
+ // While bugs are being fixed
1693
1780
  searchShow: false,
1781
+ challengeShow: false,
1782
+ tournamentShow: false,
1694
1783
  ruleset: ['Standard', 'Dynamax Clause'],
1695
1784
  banlist: [
1696
- 'Calyrex-Ice', 'Calyrex-Shadow', 'Darmanitan-Galar', 'Dialga', 'Dracovish', 'Eternatus', 'Genesect', 'Giratina',
1697
- 'Giratina-Origin', 'Groudon', 'Ho-Oh', 'Kyogre', 'Kyurem-Black', 'Kyurem-White', 'Lugia', 'Lunala', 'Magearna',
1698
- 'Marshadow', 'Melmetal', 'Mewtwo', 'Naganadel', 'Necrozma-Dawn-Wings', 'Necrozma-Dusk-Mane', 'Palkia',
1699
- 'Pheromosa', 'Rayquaza', 'Reshiram', 'Shedinja', 'Solgaleo', 'Urshifu-Base', 'Urshifu-Rapid-Strike',
1700
- 'Xerneas', 'Yveltal', 'Zacian', 'Zacian-Crowned', 'Zamazenta', 'Zamazenta-Crowned', 'Zekrom',
1701
- 'Arena Trap', 'Contrary', 'Drizzle ++ Swift Swim', 'Drought ++ Chlorophyll', 'Electric Surge ++ Surge Surfer',
1702
- 'Fur Coat', 'Guts', 'Harvest', 'Huge Power', 'Imposter', 'Innards Out', 'Libero', 'Magic Bounce', 'Magic Guard',
1703
- 'Magnet Pull', 'Mold Breaker', 'Moody', 'Neutralizing Gas', 'Power Construct', 'Queenly Majesty', 'Quick Draw',
1704
- 'Regenerator', 'Sand Rush', 'Sand Veil', 'Shadow Tag', 'Simple', 'Snow Cloak', 'Snow Warning ++ Slush Rush', 'Speed Boost',
1705
- 'Stakeout', 'Steelworker ++ Steely Spirit', 'Tinted Lens', 'Triage', 'Unaware', 'Unburden', 'Water Bubble',
1706
- 'Baton Pass',
1785
+ 'Calyrex-Ice', 'Calyrex-Shadow', 'Darmanitan-Galar', 'Dialga', 'Dracovish', 'Dragapult', 'Eternatus', 'Kyurem-Black', 'Kyurem-White', 'Giratina',
1786
+ 'Giratina-Origin', 'Genesect', 'Groudon', 'Ho-Oh', 'Kartana', 'Kyogre', 'Lugia', 'Lunala', 'Magearna', 'Marowak-Alola', 'Marshadow', 'Melmetal',
1787
+ 'Mewtwo', 'Naganadel', 'Necrozma-Dawn-Wings', 'Necrozma-Dusk-Mane', 'Palkia', 'Pheromosa', 'Rayquaza', 'Reshiram', 'Solgaleo', 'Spectrier',
1788
+ 'Urshifu-Base', 'Victini', 'Xerneas', 'Yveltal', 'Zacian', 'Zacian-Crowned', 'Zamazenta', 'Zamazenta-Crowned', 'Zekrom', 'Zygarde-Base',
1789
+ 'Arena Trap', 'Moody', 'Neutralizing Gas', 'Power Construct', 'Shadow Tag', 'Baton Pass',
1707
1790
  ],
1708
- getSharedPower(pokemon) {
1709
- const sharedPower = new Set<string>();
1710
- for (const ally of pokemon.side.pokemon) {
1711
- if (ally.previouslySwitchedIn > 0) {
1712
- if (pokemon.battle.dex.currentMod !== 'sharedpower' && ['trace', 'mirrorarmor'].includes(ally.baseAbility)) {
1713
- sharedPower.add('noability');
1714
- continue;
1715
- }
1716
- sharedPower.add(ally.baseAbility);
1791
+ restricted: [
1792
+ 'Baneful Bunker', 'Block', 'Copycat', 'Corrosive Gas', 'Detect', 'Destiny Bond', 'Disable', 'Encore', 'Fairy Lock', 'Hypnosis', 'Ingrain',
1793
+ 'Instruct', 'Lovely Kiss', 'King\'s Shield', 'Mat Block', 'Mean Look', 'Memento', 'move:Metronome', 'Obstruct', 'Octolock', 'Nature Power',
1794
+ 'Parting Shot', 'Psycho Shift', 'Protect', 'Roar', 'Sing', 'Skill Swap', 'Sleep Powder', 'Sleep Talk', 'Spiky Shield', 'Spore', 'Substitute',
1795
+ 'Switcheroo', 'Teleport', 'Trick', 'Whirlwind', 'Wish', 'Yawn',
1796
+ ],
1797
+ onValidateTeam(team, format, teamHas) {
1798
+ const problems = [];
1799
+ for (const trademark in teamHas.trademarks) {
1800
+ if (teamHas.trademarks[trademark] > 1) {
1801
+ problems.push(`You are limited to 1 of each Trademark.`, `(You have ${teamHas.trademarks[trademark]} Pok\u00e9mon with ${trademark} as a Trademark.)`);
1717
1802
  }
1718
1803
  }
1719
- sharedPower.delete(pokemon.baseAbility);
1720
- return sharedPower;
1804
+ return problems;
1721
1805
  },
1722
- onBeforeSwitchIn(pokemon) {
1723
- let format = this.format;
1724
- if (!format.getSharedPower) format = this.dex.formats.get('gen8sharedpower');
1725
- for (const ability of format.getSharedPower!(pokemon)) {
1726
- const effect = 'ability:' + ability;
1727
- pokemon.volatiles[effect] = {id: this.toID(effect), target: pokemon};
1728
- if (!pokemon.m.abils) pokemon.m.abils = [];
1729
- if (!pokemon.m.abils.includes(effect)) pokemon.m.abils.push(effect);
1806
+ validateSet(set, teamHas) {
1807
+ const dex = this.dex;
1808
+ const ability = dex.moves.get(set.ability);
1809
+ if (!ability.exists) { // Not even a real move
1810
+ return this.validateSet(set, teamHas);
1730
1811
  }
1731
- },
1732
- onSwitchInPriority: 2,
1733
- onSwitchIn(pokemon) {
1734
- let format = this.format;
1735
- if (!format.getSharedPower) format = this.dex.formats.get('gen8sharedpower');
1736
- for (const ability of format.getSharedPower!(pokemon)) {
1737
- if (ability === 'noability') {
1738
- this.hint(`Mirror Armor and Trace break in Shared Power formats that don't use Shared Power as a base, so they get removed from non-base users.`);
1812
+ // Absolute trademark bans
1813
+ if (ability.category !== 'Status') {
1814
+ return [`${ability.name} is not a status move, and cannot be used as a trademark.`];
1815
+ }
1816
+ if (ability.forceSwitch || ability.selfSwitch) {
1817
+ return [
1818
+ `Force-switching and self-switching moves are banned from being used as trademarks.`,
1819
+ `(${ability.name} is a ${ability.forceSwitch ? 'force' : 'self'}-switching move.)`,
1820
+ ];
1821
+ }
1822
+ const irrevokablyRestricted = [
1823
+ 'Assist', 'Copycat', 'Metronome', 'Mirror Move', 'Sleep Talk', // Could call another unsafe trademark
1824
+ 'Recycle', 'Trace', // Causes endless turns
1825
+ 'Skill Swap', // Self-propagates indefinitely
1826
+ ];
1827
+ for (const m of set.moves) {
1828
+ const move = dex.moves.get(m);
1829
+ if (irrevokablyRestricted.includes(move.name)) {
1830
+ return [`${move.name} is banned from Trademark, irrespective of custom rules, because it can cause endless turns.`];
1739
1831
  }
1740
- const effect = 'ability:' + ability;
1741
- delete pokemon.volatiles[effect];
1742
- pokemon.addVolatile(effect);
1743
1832
  }
1833
+ if (irrevokablyRestricted.includes(ability.name)) {
1834
+ return [`${ability.name} cannot safely function as a trademark.`];
1835
+ }
1836
+ // Contingent trademark bans
1837
+ if (this.ruleTable.isRestricted(`move:${ability.id}`)) {
1838
+ return [`${ability.name} is restricted from being used as a trademark.`];
1839
+ }
1840
+ if (set.moves.map(this.toID).includes(ability.id)) {
1841
+ return [`${set.name} may not use ${ability.name} as both a trademark and one of its moves simultaneously.`];
1842
+ }
1843
+ const customRules = this.format.customRules || [];
1844
+ if (!customRules.includes('!obtainableabilities')) customRules.push('!obtainableabilities');
1845
+
1846
+ const TeamValidator: typeof import('../sim/team-validator').TeamValidator =
1847
+ require('../sim/team-validator').TeamValidator;
1848
+
1849
+ const validator = new TeamValidator(dex.formats.get(`${this.format.id}@@@${customRules.join(',')}`));
1850
+ const moves = set.moves;
1851
+ set.moves = [ability.id];
1852
+ set.ability = dex.species.get(set.species).abilities['0'];
1853
+ let problems = validator.validateSet(set, {}) || [];
1854
+ if (problems.length) return problems;
1855
+ set.moves = moves;
1856
+ set.ability = dex.species.get(set.species).abilities['0'];
1857
+ problems = problems.concat(validator.validateSet(set, teamHas) || []);
1858
+ set.ability = ability.id;
1859
+ if (!teamHas.trademarks) teamHas.trademarks = {};
1860
+ teamHas.trademarks[ability.name] = (teamHas.trademarks[ability.name] || 0) + 1;
1861
+ return problems.length ? problems : null;
1862
+ },
1863
+ pokemon: {
1864
+ getAbility() {
1865
+ const move = this.battle.dex.moves.get(this.battle.toID(this.ability));
1866
+ if (!move.exists) return Object.getPrototypeOf(this).getAbility.call(this);
1867
+ return {
1868
+ id: move.id,
1869
+ name: move.name,
1870
+ onStart(this: Battle, pokemon: Pokemon) {
1871
+ this.add('-activate', pokemon, 'ability: ' + move.name);
1872
+ this.actions.useMove(move, pokemon);
1873
+ },
1874
+ toString() {
1875
+ return "";
1876
+ },
1877
+ };
1878
+ },
1744
1879
  },
1745
1880
  },
1746
1881
  {
@@ -2210,39 +2345,45 @@ export const Formats: FormatList = [
2210
2345
  column: 3,
2211
2346
  },
2212
2347
  {
2213
- name: "[Gen 3] UU",
2348
+ name: "[Gen 4] UU",
2214
2349
  threads: [
2215
- `&bullet; <a href="https://www.smogon.com/forums/threads/3585923/">ADV UU Metagame Discussion</a>`,
2216
- `&bullet; <a href="https://www.smogon.com/forums/threads/3548578/">ADV UU Viability Rankings</a>`,
2350
+ `&bullet; <a href="https://www.smogon.com/forums/threads/3532624/">DPP UU Metagame Discussion</a>`,
2351
+ `&bullet; <a href="https://www.smogon.com/forums/threads/3503638/">DPP UU Viability Rankings</a>`,
2217
2352
  ],
2218
2353
 
2219
- mod: 'gen3',
2354
+ mod: 'gen4',
2220
2355
  // searchShow: false,
2221
- ruleset: ['Standard', 'NFE Clause'],
2222
- banlist: ['Uber', 'OU', 'UUBL', 'Smeargle + Ingrain', 'Baton Pass'],
2223
- unbanlist: ['Scyther', 'Sand Veil'],
2356
+ ruleset: ['[Gen 4] OU'],
2357
+ banlist: ['OU', 'UUBL'],
2358
+ unbanlist: ['Arena Trap', 'Swagger'],
2224
2359
  },
2225
2360
  {
2226
- name: "[Gen 1] NU",
2361
+ name: "[Gen 7] LC",
2227
2362
  threads: [
2228
- `&bullet; <a href="https://www.smogon.com/forums/threads/3668913/">RBY NU Viability Rankings</a>`,
2363
+ `&bullet; <a href="https://www.smogon.com/dex/sm/formats/lc/">USM LC Banlist</a>`,
2364
+ `&bullet; <a href="https://www.smogon.com/forums/threads/3639319/">USM LC Sample Teams</a>`,
2365
+ `&bullet; <a href="https://www.smogon.com/forums/threads/3621440/">USM LC Viability Rankings</a>`,
2229
2366
  ],
2230
2367
 
2231
- mod: 'gen1',
2368
+ mod: 'gen7',
2232
2369
  // searchShow: false,
2233
- ruleset: ['[Gen 1] UU'],
2234
- banlist: ['UU', 'NUBL'],
2370
+ ruleset: ['Little Cup', 'Standard', 'Swagger Clause'],
2371
+ banlist: [
2372
+ 'Aipom', 'Cutiefly', 'Drifloon', 'Gligar', 'Gothita', 'Meditite', 'Misdreavus', 'Murkrow', 'Porygon',
2373
+ 'Scyther', 'Sneasel', 'Swirlix', 'Tangela', 'Trapinch', 'Vulpix-Base', 'Wingull', 'Yanma',
2374
+ 'Eevium Z', 'Baton Pass', 'Dragon Rage', 'Sonic Boom', 'Sticky Web',
2375
+ ],
2235
2376
  },
2236
2377
  {
2237
- name: "[Gen 4] Ubers",
2378
+ name: "[Gen 5] PU",
2238
2379
  threads: [
2239
- `&bullet; <a href="https://www.smogon.com/forums/posts/8286279/">DPP Ubers</a>`,
2380
+ `&bullet; <a href="https://www.smogon.com/forums/posts/7326932/">BW2 PU</a>`,
2240
2381
  ],
2241
2382
 
2242
- mod: 'gen4',
2383
+ mod: 'gen5',
2243
2384
  // searchShow: false,
2244
- ruleset: ['Standard'],
2245
- banlist: ['AG'],
2385
+ ruleset: ['[Gen 5] NU', 'Sleep Moves Clause'],
2386
+ banlist: ['NU', 'PUBL'],
2246
2387
  },
2247
2388
 
2248
2389
  // Past Gens OU
@@ -2535,23 +2676,6 @@ export const Formats: FormatList = [
2535
2676
  ruleset: ['[Gen 7] NU'],
2536
2677
  banlist: ['NU', 'PUBL'],
2537
2678
  },
2538
- {
2539
- name: "[Gen 7] LC",
2540
- threads: [
2541
- `&bullet; <a href="https://www.smogon.com/dex/sm/formats/lc/">USM LC Banlist</a>`,
2542
- `&bullet; <a href="https://www.smogon.com/forums/threads/3639319/">USM LC Sample Teams</a>`,
2543
- `&bullet; <a href="https://www.smogon.com/forums/threads/3621440/">USM LC Viability Rankings</a>`,
2544
- ],
2545
-
2546
- mod: 'gen7',
2547
- searchShow: false,
2548
- ruleset: ['Little Cup', 'Standard', 'Swagger Clause'],
2549
- banlist: [
2550
- 'Aipom', 'Cutiefly', 'Drifloon', 'Gligar', 'Gothita', 'Meditite', 'Misdreavus', 'Murkrow', 'Porygon',
2551
- 'Scyther', 'Sneasel', 'Swirlix', 'Tangela', 'Trapinch', 'Vulpix-Base', 'Wingull', 'Yanma',
2552
- 'Eevium Z', 'Baton Pass', 'Dragon Rage', 'Sonic Boom', 'Sticky Web',
2553
- ],
2554
- },
2555
2679
  {
2556
2680
  name: "[Gen 7] Monotype",
2557
2681
  desc: `All the Pok&eacute;mon on a team must share a type.`,
@@ -2895,14 +3019,15 @@ export const Formats: FormatList = [
2895
3019
  mod: 'gen6',
2896
3020
  searchShow: false,
2897
3021
  ruleset: [
2898
- 'Max Team Size = 3', 'Picked Team Size = 1',
2899
- 'Obtainable', 'Nickname Clause', 'Moody Clause', 'OHKO Clause', 'Evasion Moves Clause', 'Accuracy Moves Clause', 'Swagger Clause', 'Endless Battle Clause', 'HP Percentage Mod', 'Cancel Mod', 'Team Preview',
3022
+ 'Max Team Size = 3', 'Picked Team Size = 1', 'Obtainable', 'Nickname Clause', 'Moody Clause', 'OHKO Clause',
3023
+ 'Evasion Moves Clause', 'Accuracy Moves Clause', 'Swagger Clause', 'Endless Battle Clause', 'HP Percentage Mod',
3024
+ 'Cancel Mod', 'Team Preview',
2900
3025
  ],
2901
3026
  banlist: [
2902
3027
  'Arceus', 'Blaziken', 'Darkrai', 'Deoxys-Base', 'Deoxys-Attack', 'Deoxys-Defense', 'Dialga', 'Giratina',
2903
3028
  'Giratina-Origin', 'Groudon', 'Ho-Oh', 'Kangaskhan-Mega', 'Kyogre', 'Kyurem-White', 'Lugia', 'Mewtwo',
2904
3029
  'Palkia', 'Rayquaza', 'Reshiram', 'Salamence-Mega', 'Shaymin-Sky', 'Xerneas', 'Yveltal', 'Zekrom',
2905
- 'Focus Sash', 'Soul Dew', 'Perish Song',
3030
+ 'Focus Sash', 'Soul Dew', 'Grass Whistle', 'Hypnosis', 'Perish Song', 'Sing', 'Yawn',
2906
3031
  ],
2907
3032
  },
2908
3033
  {
@@ -3115,17 +3240,6 @@ export const Formats: FormatList = [
3115
3240
  ruleset: ['[Gen 5] RU', '!Sleep Moves Clause', 'Sleep Clause Mod'],
3116
3241
  banlist: ['RU', 'NUBL', 'Assist', 'Copycat'],
3117
3242
  },
3118
- {
3119
- name: "[Gen 5] PU",
3120
- threads: [
3121
- `&bullet; <a href="https://www.smogon.com/forums/posts/7326932/">BW2 PU</a>`,
3122
- ],
3123
-
3124
- mod: 'gen5',
3125
- searchShow: false,
3126
- ruleset: ['[Gen 5] NU', 'Sleep Moves Clause'],
3127
- banlist: ['NU', 'PUBL'],
3128
- },
3129
3243
  {
3130
3244
  name: "[Gen 5] LC",
3131
3245
  threads: [
@@ -3165,7 +3279,7 @@ export const Formats: FormatList = [
3165
3279
  'Picked Team Size = 1', 'Max Team Size = 3',
3166
3280
  'Standard', 'Baton Pass Clause', 'Swagger Clause', 'Accuracy Moves Clause',
3167
3281
  ],
3168
- banlist: ['Uber', 'Cottonee', 'Dragonite', 'Kyurem-Black', 'Mew', 'Togekiss', 'Whimsicott', 'Victini', 'Bright Powder', 'Focus Band', 'Focus Sash', 'Lax Incense', 'Quick Claw', 'Soul Dew', 'Perish Song'],
3282
+ banlist: ['Uber', 'Cottonee', 'Dragonite', 'Jirachi', 'Kyurem-Black', 'Mew', 'Togekiss', 'Whimsicott', 'Victini', 'Bright Powder', 'Focus Band', 'Focus Sash', 'Lax Incense', 'Quick Claw', 'Soul Dew', 'Perish Song'],
3169
3283
  unbanlist: ['Genesect', 'Landorus', 'Manaphy', 'Thundurus', 'Tornadus-Therian'],
3170
3284
  },
3171
3285
  {
@@ -3266,17 +3380,15 @@ export const Formats: FormatList = [
3266
3380
  column: 5,
3267
3381
  },
3268
3382
  {
3269
- name: "[Gen 4] UU",
3383
+ name: "[Gen 4] Ubers",
3270
3384
  threads: [
3271
- `&bullet; <a href="https://www.smogon.com/forums/threads/3532624/">DPP UU Metagame Discussion</a>`,
3272
- `&bullet; <a href="https://www.smogon.com/forums/threads/3503638/">DPP UU Viability Rankings</a>`,
3385
+ `&bullet; <a href="https://www.smogon.com/forums/posts/8286279/">DPP Ubers</a>`,
3273
3386
  ],
3274
3387
 
3275
3388
  mod: 'gen4',
3276
3389
  searchShow: false,
3277
- ruleset: ['[Gen 4] OU'],
3278
- banlist: ['OU', 'UUBL'],
3279
- unbanlist: ['Arena Trap', 'Swagger'],
3390
+ ruleset: ['Standard'],
3391
+ banlist: ['AG'],
3280
3392
  },
3281
3393
  {
3282
3394
  name: "[Gen 4] NU",
@@ -3424,6 +3536,19 @@ export const Formats: FormatList = [
3424
3536
  ruleset: ['Standard', 'Deoxys Camouflage Clause', 'One Baton Pass Clause'],
3425
3537
  banlist: ['Wobbuffet + Leftovers'],
3426
3538
  },
3539
+ {
3540
+ name: "[Gen 3] UU",
3541
+ threads: [
3542
+ `&bullet; <a href="https://www.smogon.com/forums/threads/3585923/">ADV UU Metagame Discussion</a>`,
3543
+ `&bullet; <a href="https://www.smogon.com/forums/threads/3548578/">ADV UU Viability Rankings</a>`,
3544
+ ],
3545
+
3546
+ mod: 'gen3',
3547
+ searchShow: false,
3548
+ ruleset: ['Standard', 'NFE Clause'],
3549
+ banlist: ['Uber', 'OU', 'UUBL', 'Smeargle + Ingrain', 'Baton Pass'],
3550
+ unbanlist: ['Scyther', 'Sand Veil'],
3551
+ },
3427
3552
  {
3428
3553
  name: "[Gen 3] NU",
3429
3554
  threads: [
@@ -3583,6 +3708,17 @@ export const Formats: FormatList = [
3583
3708
  ruleset: ['[Gen 1] OU'],
3584
3709
  banlist: ['OU', 'UUBL'],
3585
3710
  },
3711
+ {
3712
+ name: "[Gen 1] NU",
3713
+ threads: [
3714
+ `&bullet; <a href="https://www.smogon.com/forums/threads/3668913/">RBY NU Viability Rankings</a>`,
3715
+ ],
3716
+
3717
+ mod: 'gen1',
3718
+ searchShow: false,
3719
+ ruleset: ['[Gen 1] UU'],
3720
+ banlist: ['UU', 'NUBL'],
3721
+ },
3586
3722
  {
3587
3723
  name: "[Gen 1] Japanese OU",
3588
3724
  desc: `Generation 1 with Japanese battle mechanics.`,