@pkmn/sim 0.7.7 → 0.7.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.
Files changed (48) hide show
  1. package/build/cjs/config/formats.js +27 -6
  2. package/build/cjs/config/formats.js.map +1 -1
  3. package/build/cjs/data/abilities.js +54 -28
  4. package/build/cjs/data/abilities.js.map +1 -1
  5. package/build/cjs/data/aliases.js +1 -1
  6. package/build/cjs/data/formats-data.js +2 -2
  7. package/build/cjs/data/formats-data.js.map +1 -1
  8. package/build/cjs/data/mods/gen4/moves.js +6 -0
  9. package/build/cjs/data/mods/gen4/moves.js.map +1 -1
  10. package/build/cjs/data/mods/gen6/abilities.js +3 -3
  11. package/build/cjs/data/mods/gen6/abilities.js.map +1 -1
  12. package/build/cjs/data/mods/gen8/moves.js +6 -16
  13. package/build/cjs/data/mods/gen8/moves.js.map +1 -1
  14. package/build/cjs/data/moves.js +6 -12
  15. package/build/cjs/data/moves.js.map +1 -1
  16. package/build/cjs/data/pokedex.js +918 -946
  17. package/build/cjs/data/pokedex.js.map +1 -1
  18. package/build/cjs/sim/battle-actions.js +5 -1
  19. package/build/cjs/sim/battle-actions.js.map +1 -1
  20. package/build/cjs/sim/dex-moves.js.map +1 -1
  21. package/build/cjs/sim/pokemon.js +1 -1
  22. package/build/cjs/sim/pokemon.js.map +1 -1
  23. package/build/esm/config/formats.mjs +27 -6
  24. package/build/esm/config/formats.mjs.map +1 -1
  25. package/build/esm/data/abilities.mjs +54 -28
  26. package/build/esm/data/abilities.mjs.map +1 -1
  27. package/build/esm/data/aliases.mjs +1 -1
  28. package/build/esm/data/formats-data.mjs +2 -2
  29. package/build/esm/data/formats-data.mjs.map +1 -1
  30. package/build/esm/data/mods/gen4/moves.mjs +6 -0
  31. package/build/esm/data/mods/gen4/moves.mjs.map +1 -1
  32. package/build/esm/data/mods/gen6/abilities.mjs +3 -3
  33. package/build/esm/data/mods/gen6/abilities.mjs.map +1 -1
  34. package/build/esm/data/mods/gen8/moves.mjs +6 -16
  35. package/build/esm/data/mods/gen8/moves.mjs.map +1 -1
  36. package/build/esm/data/moves.mjs +6 -12
  37. package/build/esm/data/moves.mjs.map +1 -1
  38. package/build/esm/data/pokedex.mjs +918 -946
  39. package/build/esm/data/pokedex.mjs.map +1 -1
  40. package/build/esm/sim/battle-actions.mjs +5 -1
  41. package/build/esm/sim/battle-actions.mjs.map +1 -1
  42. package/build/esm/sim/dex-moves.mjs.map +1 -1
  43. package/build/esm/sim/pokemon.mjs +1 -1
  44. package/build/esm/sim/pokemon.mjs.map +1 -1
  45. package/build/types/sim/dex-moves.d.ts +5 -6
  46. package/build/types/sim/exported-global-types.d.ts +3 -0
  47. package/build/types/sim/global-types.d.ts +3 -0
  48. package/package.json +1 -1
@@ -55,12 +55,12 @@ export const Abilities = {
55
55
  if (move.type === 'Normal' && !noModifyType.includes(move.id) &&
56
56
  !(move.isZ && move.category !== 'Status') && !(move.name === 'Tera Blast' && pokemon.terastallized)) {
57
57
  move.type = 'Flying';
58
- move.aerilateBoosted = true;
58
+ move.typeChangerBoosted = this.effect;
59
59
  }
60
60
  },
61
61
  onBasePowerPriority: 23,
62
62
  onBasePower(basePower, pokemon, target, move) {
63
- if (move.aerilateBoosted)
63
+ if (move.typeChangerBoosted === this.effect)
64
64
  return this.chainModify([4915, 4096]);
65
65
  },
66
66
  name: "Aerilate",
@@ -365,8 +365,13 @@ export const Abilities = {
365
365
  return;
366
366
  this.add('-ability', pokemon, 'Beads of Ruin');
367
367
  },
368
- onAnyModifySpD(spd, source, target, move) {
369
- if (this.effectState.target === source)
368
+ onAnyModifySpD(spd, target, source, move) {
369
+ const abilityHolder = this.effectState.target;
370
+ if (abilityHolder === target)
371
+ return;
372
+ if (!move.ruinedSpD?.hasAbility('Beads of Ruin'))
373
+ move.ruinedSpD = abilityHolder;
374
+ if (move.ruinedSpD !== abilityHolder && move.ruinedSpD !== target)
370
375
  return;
371
376
  this.debug('Beads of Ruin SpD drop');
372
377
  return this.chainModify(0.75);
@@ -524,7 +529,7 @@ export const Abilities = {
524
529
  },
525
530
  onStart(pokemon) {
526
531
  // Cloud Nine does not activate when Skill Swapped or when Neutralizing Gas leaves the field
527
- if (!this.effectState.switchingIn) {
532
+ if (this.effectState.switchingIn) {
528
533
  this.add('-ability', pokemon, 'Cloud Nine');
529
534
  this.effectState.switchingIn = false;
530
535
  }
@@ -707,25 +712,31 @@ export const Abilities = {
707
712
  },
708
713
  cudchew: {
709
714
  onEatItem(item, pokemon) {
710
- if (!item.isBerry)
711
- return;
712
- pokemon.abilityState.berry = item;
713
- pokemon.addVolatile('cudchew');
715
+ if (item.isBerry && pokemon.addVolatile('cudchew')) {
716
+ pokemon.volatiles['cudchew'].berry = item;
717
+ }
718
+ },
719
+ onEnd(pokemon) {
720
+ delete pokemon.volatiles['cudchew'];
714
721
  },
715
722
  condition: {
716
723
  noCopy: true,
717
724
  duration: 2,
725
+ onRestart() {
726
+ this.effectState.duration = 2;
727
+ },
728
+ onResidualOrder: 28,
729
+ onResidualSubOrder: 2,
718
730
  onEnd(pokemon) {
719
- if (pokemon.hp && pokemon.abilityState.berry) {
720
- const item = pokemon.abilityState.berry;
731
+ if (pokemon.hp) {
732
+ const item = this.effectState.berry;
721
733
  this.add('-activate', pokemon, 'ability: Cud Chew');
722
- this.add('-enditem', pokemon, item.name);
734
+ this.add('-enditem', pokemon, item.name, '[eat]');
723
735
  if (this.singleEvent('Eat', item, null, pokemon, null, null)) {
724
736
  this.runEvent('EatItem', pokemon, null, null, item);
725
737
  }
726
738
  if (item.onEat)
727
739
  pokemon.ateBerry = true;
728
- delete pokemon.abilityState.berry;
729
740
  }
730
741
  },
731
742
  },
@@ -804,7 +815,7 @@ export const Abilities = {
804
815
  onAnyBasePower(basePower, source, target, move) {
805
816
  if (target === source || move.category === 'Status' || move.type !== 'Dark')
806
817
  return;
807
- if (!move.auraBooster)
818
+ if (!move.auraBooster?.hasAbility('Dark Aura'))
808
819
  move.auraBooster = this.effectState.target;
809
820
  if (move.auraBooster !== this.effectState.target)
810
821
  return;
@@ -1163,7 +1174,7 @@ export const Abilities = {
1163
1174
  onAnyBasePower(basePower, source, target, move) {
1164
1175
  if (target === source || move.category === 'Status' || move.type !== 'Fairy')
1165
1176
  return;
1166
- if (!move.auraBooster)
1177
+ if (!move.auraBooster?.hasAbility('Fairy Aura'))
1167
1178
  move.auraBooster = this.effectState.target;
1168
1179
  if (move.auraBooster !== this.effectState.target)
1169
1180
  return;
@@ -1487,12 +1498,12 @@ export const Abilities = {
1487
1498
  if (move.type === 'Normal' && !noModifyType.includes(move.id) &&
1488
1499
  !(move.isZ && move.category !== 'Status') && !(move.name === 'Tera Blast' && pokemon.terastallized)) {
1489
1500
  move.type = 'Electric';
1490
- move.galvanizeBoosted = true;
1501
+ move.typeChangerBoosted = this.effect;
1491
1502
  }
1492
1503
  },
1493
1504
  onBasePowerPriority: 23,
1494
1505
  onBasePower(basePower, pokemon, target, move) {
1495
- if (move.galvanizeBoosted)
1506
+ if (move.typeChangerBoosted === this.effect)
1496
1507
  return this.chainModify([4915, 4096]);
1497
1508
  },
1498
1509
  name: "Galvanize",
@@ -2803,12 +2814,12 @@ export const Abilities = {
2803
2814
  // TODO: Figure out actual interaction
2804
2815
  !(move.name === 'Tera Blast' && pokemon.terastallized)) {
2805
2816
  move.type = 'Normal';
2806
- move.normalizeBoosted = true;
2817
+ move.typeChangerBoosted = this.effect;
2807
2818
  }
2808
2819
  },
2809
2820
  onBasePowerPriority: 23,
2810
2821
  onBasePower(basePower, pokemon, target, move) {
2811
- if (move.normalizeBoosted)
2822
+ if (move.typeChangerBoosted === this.effect)
2812
2823
  return this.chainModify([4915, 4096]);
2813
2824
  },
2814
2825
  name: "Normalize",
@@ -3091,12 +3102,12 @@ export const Abilities = {
3091
3102
  if (move.type === 'Normal' && !noModifyType.includes(move.id) &&
3092
3103
  !(move.isZ && move.category !== 'Status') && !(move.name === 'Tera Blast' && pokemon.terastallized)) {
3093
3104
  move.type = 'Fairy';
3094
- move.pixilateBoosted = true;
3105
+ move.typeChangerBoosted = this.effect;
3095
3106
  }
3096
3107
  },
3097
3108
  onBasePowerPriority: 23,
3098
3109
  onBasePower(basePower, pokemon, target, move) {
3099
- if (move.pixilateBoosted)
3110
+ if (move.typeChangerBoosted === this.effect)
3100
3111
  return this.chainModify([4915, 4096]);
3101
3112
  },
3102
3113
  name: "Pixilate",
@@ -3615,12 +3626,12 @@ export const Abilities = {
3615
3626
  if (move.type === 'Normal' && !noModifyType.includes(move.id) &&
3616
3627
  !(move.isZ && move.category !== 'Status') && !(move.name === 'Tera Blast' && pokemon.terastallized)) {
3617
3628
  move.type = 'Ice';
3618
- move.refrigerateBoosted = true;
3629
+ move.typeChangerBoosted = this.effect;
3619
3630
  }
3620
3631
  },
3621
3632
  onBasePowerPriority: 23,
3622
3633
  onBasePower(basePower, pokemon, target, move) {
3623
- if (move.refrigerateBoosted)
3634
+ if (move.typeChangerBoosted === this.effect)
3624
3635
  return this.chainModify([4915, 4096]);
3625
3636
  },
3626
3637
  name: "Refrigerate",
@@ -4615,8 +4626,13 @@ export const Abilities = {
4615
4626
  return;
4616
4627
  this.add('-ability', pokemon, 'Sword of Ruin');
4617
4628
  },
4618
- onAnyModifyDef(def, source, target, move) {
4619
- if (this.effectState.target === source)
4629
+ onAnyModifyDef(def, target, source, move) {
4630
+ const abilityHolder = this.effectState.target;
4631
+ if (abilityHolder === target)
4632
+ return;
4633
+ if (!move.ruinedDef?.hasAbility('Sword of Ruin'))
4634
+ move.ruinedDef = abilityHolder;
4635
+ if (move.ruinedDef !== abilityHolder && move.ruinedDef !== target)
4620
4636
  return;
4621
4637
  this.debug('Sword of Ruin Def drop');
4622
4638
  // TODO Placeholder
@@ -4633,7 +4649,12 @@ export const Abilities = {
4633
4649
  this.add('-ability', pokemon, 'Tablets of Ruin');
4634
4650
  },
4635
4651
  onAnyModifyAtk(atk, source, target, move) {
4636
- if (this.effectState.target === source)
4652
+ const abilityHolder = this.effectState.target;
4653
+ if (abilityHolder === source)
4654
+ return;
4655
+ if (!move.ruinedAtk)
4656
+ move.ruinedAtk = abilityHolder;
4657
+ if (move.ruinedAtk !== abilityHolder)
4637
4658
  return;
4638
4659
  this.debug('Tablets of Ruin Atk drop');
4639
4660
  // TODO Placeholder
@@ -4983,9 +5004,14 @@ export const Abilities = {
4983
5004
  this.add('-ability', pokemon, 'Vessel of Ruin');
4984
5005
  },
4985
5006
  onAnyModifySpA(spa, source, target, move) {
4986
- if (this.effectState.target === source)
5007
+ const abilityHolder = this.effectState.target;
5008
+ if (abilityHolder === source)
5009
+ return;
5010
+ if (!move.ruinedSpA)
5011
+ move.ruinedSpA = abilityHolder;
5012
+ if (move.ruinedSpA !== abilityHolder)
4987
5013
  return;
4988
- this.debug('Vessel of Ruin Spa drop');
5014
+ this.debug('Vessel of Ruin SpA drop');
4989
5015
  // TODO Placeholder
4990
5016
  return this.chainModify(0.75);
4991
5017
  },