@pkmn/mods 0.5.28 → 0.6.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.
Files changed (59) hide show
  1. package/build/gen1stadium/scripts.js +13 -8
  2. package/build/gen1stadium/scripts.js.map +1 -1
  3. package/build/index.d.ts +2 -2
  4. package/build/letsgo/formats-data.d.ts +4 -0
  5. package/build/letsgo/formats-data.js +982 -0
  6. package/build/letsgo/formats-data.js.map +1 -0
  7. package/build/letsgo/index.d.ts +5 -0
  8. package/build/letsgo/index.js +14 -0
  9. package/build/letsgo/index.js.map +1 -0
  10. package/build/letsgo/learnsets.d.ts +4 -0
  11. package/build/letsgo/learnsets.js +5403 -0
  12. package/build/letsgo/learnsets.js.map +1 -0
  13. package/build/letsgo/moves.d.ts +4 -0
  14. package/build/letsgo/moves.js +94 -0
  15. package/build/letsgo/moves.js.map +1 -0
  16. package/build/letsgo/pokedex.d.ts +4 -0
  17. package/build/letsgo/pokedex.js +179 -0
  18. package/build/letsgo/pokedex.js.map +1 -0
  19. package/build/letsgo/scripts.d.ts +2 -0
  20. package/build/letsgo/scripts.js +60 -0
  21. package/build/letsgo/scripts.js.map +1 -0
  22. package/build/stadium/conditions.d.ts +4 -0
  23. package/build/stadium/conditions.js +137 -0
  24. package/build/stadium/conditions.js.map +1 -0
  25. package/build/stadium/index.d.ts +4 -0
  26. package/build/stadium/index.js +12 -0
  27. package/build/stadium/index.js.map +1 -0
  28. package/build/stadium/moves.d.ts +4 -0
  29. package/build/stadium/moves.js +246 -0
  30. package/build/stadium/moves.js.map +1 -0
  31. package/build/stadium/rulesets.d.ts +4 -0
  32. package/build/stadium/rulesets.js +11 -0
  33. package/build/stadium/rulesets.js.map +1 -0
  34. package/build/stadium/scripts.d.ts +5 -0
  35. package/build/stadium/scripts.js +619 -0
  36. package/build/stadium/scripts.js.map +1 -0
  37. package/build/vgc17/formats-data.d.ts +4 -0
  38. package/build/vgc17/formats-data.js +58 -0
  39. package/build/vgc17/formats-data.js.map +1 -0
  40. package/build/vgc17/index.d.ts +6 -0
  41. package/build/vgc17/index.js +16 -0
  42. package/build/vgc17/index.js.map +1 -0
  43. package/build/vgc17/items.d.ts +4 -0
  44. package/build/vgc17/items.js +30 -0
  45. package/build/vgc17/items.js.map +1 -0
  46. package/build/vgc17/learnsets.d.ts +4 -0
  47. package/build/vgc17/learnsets.js +60478 -0
  48. package/build/vgc17/learnsets.js.map +1 -0
  49. package/build/vgc17/pokedex.d.ts +4 -0
  50. package/build/vgc17/pokedex.js +50 -0
  51. package/build/vgc17/pokedex.js.map +1 -0
  52. package/build/vgc17/rulesets.d.ts +4 -0
  53. package/build/vgc17/rulesets.js +22 -0
  54. package/build/vgc17/rulesets.js.map +1 -0
  55. package/build/vgc17/scripts.d.ts +2 -0
  56. package/build/vgc17/scripts.js +7 -0
  57. package/build/vgc17/scripts.js.map +1 -0
  58. package/package.json +4 -4
  59. package/src/gen1stadium/scripts.ts +12 -8
@@ -0,0 +1,179 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Pokedex = void 0;
4
+ exports.Pokedex = {
5
+ pichu: {
6
+ inherit: true,
7
+ evos: [],
8
+ },
9
+ pikachu: {
10
+ inherit: true,
11
+ prevo: '',
12
+ evos: ["raichu"],
13
+ evoLevel: undefined,
14
+ },
15
+ raichualola: {
16
+ inherit: true,
17
+ prevo: '',
18
+ evoLevel: undefined,
19
+ },
20
+ cleffa: {
21
+ inherit: true,
22
+ evos: [],
23
+ },
24
+ clefairy: {
25
+ inherit: true,
26
+ prevo: '',
27
+ evoLevel: undefined,
28
+ },
29
+ igglybuff: {
30
+ inherit: true,
31
+ evos: [],
32
+ },
33
+ jigglypuff: {
34
+ inherit: true,
35
+ prevo: '',
36
+ evoLevel: undefined,
37
+ },
38
+ golbat: {
39
+ inherit: true,
40
+ evos: [],
41
+ },
42
+ gloom: {
43
+ inherit: true,
44
+ evos: ["vileplume"],
45
+ },
46
+ poliwhirl: {
47
+ inherit: true,
48
+ evos: ["poliwrath"],
49
+ },
50
+ slowpoke: {
51
+ inherit: true,
52
+ evos: ["slowbro"],
53
+ },
54
+ magneton: {
55
+ inherit: true,
56
+ evos: [],
57
+ },
58
+ onix: {
59
+ inherit: true,
60
+ evos: [],
61
+ },
62
+ exeggcute: {
63
+ inherit: true,
64
+ evos: ["exeggutor"],
65
+ },
66
+ exeggutoralola: {
67
+ inherit: true,
68
+ prevo: '',
69
+ evoLevel: undefined,
70
+ },
71
+ cubone: {
72
+ inherit: true,
73
+ evos: ["marowak"],
74
+ },
75
+ marowakalola: {
76
+ inherit: true,
77
+ prevo: '',
78
+ evoLevel: undefined,
79
+ },
80
+ tyrogue: {
81
+ inherit: true,
82
+ evos: ["hitmontop"],
83
+ },
84
+ hitmonlee: {
85
+ inherit: true,
86
+ prevo: '',
87
+ },
88
+ hitmonchan: {
89
+ inherit: true,
90
+ prevo: '',
91
+ },
92
+ lickitung: {
93
+ inherit: true,
94
+ evos: [],
95
+ },
96
+ rhydon: {
97
+ inherit: true,
98
+ evos: [],
99
+ },
100
+ happiny: {
101
+ inherit: true,
102
+ evos: [],
103
+ },
104
+ chansey: {
105
+ inherit: true,
106
+ prevo: '',
107
+ evos: [],
108
+ evoLevel: undefined,
109
+ },
110
+ tangela: {
111
+ inherit: true,
112
+ evos: [],
113
+ },
114
+ seadra: {
115
+ inherit: true,
116
+ evos: [],
117
+ },
118
+ mimejr: {
119
+ inherit: true,
120
+ evos: [],
121
+ },
122
+ mrmime: {
123
+ inherit: true,
124
+ prevo: '',
125
+ evoLevel: undefined,
126
+ evoMove: '',
127
+ },
128
+ scyther: {
129
+ inherit: true,
130
+ evos: [],
131
+ },
132
+ smoochum: {
133
+ inherit: true,
134
+ evos: [],
135
+ },
136
+ jynx: {
137
+ inherit: true,
138
+ prevo: '',
139
+ evoLevel: undefined,
140
+ },
141
+ elekid: {
142
+ inherit: true,
143
+ evos: [],
144
+ },
145
+ electabuzz: {
146
+ inherit: true,
147
+ prevo: '',
148
+ evos: [],
149
+ evoLevel: undefined,
150
+ },
151
+ magby: {
152
+ inherit: true,
153
+ evos: [],
154
+ },
155
+ magmar: {
156
+ inherit: true,
157
+ prevo: '',
158
+ evos: [],
159
+ evoLevel: undefined,
160
+ },
161
+ eevee: {
162
+ inherit: true,
163
+ evos: ["jolteon", "flareon", "vaporeon"],
164
+ },
165
+ porygon: {
166
+ inherit: true,
167
+ evos: [],
168
+ },
169
+ munchlax: {
170
+ inherit: true,
171
+ evos: [],
172
+ },
173
+ snorlax: {
174
+ inherit: true,
175
+ prevo: '',
176
+ evoLevel: undefined,
177
+ },
178
+ };
179
+ //# sourceMappingURL=pokedex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pokedex.js","sourceRoot":"","sources":["../../src/letsgo/pokedex.ts"],"names":[],"mappings":";;;AAEa,QAAA,OAAO,GAAqC;IACxD,KAAK,EAAE;QACN,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,EAAE;KACR;IACD,OAAO,EAAE;QACR,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,EAAE;QACT,IAAI,EAAE,CAAC,QAAQ,CAAC;QAChB,QAAQ,EAAE,SAAS;KACnB;IACD,WAAW,EAAE;QACZ,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE,SAAS;KACnB;IACD,MAAM,EAAE;QACP,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,EAAE;KACR;IACD,QAAQ,EAAE;QACT,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE,SAAS;KACnB;IACD,SAAS,EAAE;QACV,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,EAAE;KACR;IACD,UAAU,EAAE;QACX,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE,SAAS;KACnB;IACD,MAAM,EAAE;QACP,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,EAAE;KACR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AAE,EAAE;QACT,QAAQ,EAAE,SAAS;KACnB;CACD,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { ModdedBattleScriptsData } from '@pkmn/sim';
2
+ export declare const Scripts: ModdedBattleScriptsData;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Scripts = void 0;
4
+ exports.Scripts = {
5
+ inherit: 'gen7',
6
+ init() {
7
+ this.modData('Abilities', 'noability').isNonstandard = null;
8
+ for (const i in this.data.Pokedex) {
9
+ this.modData('Pokedex', i).abilities = { 0: 'No Ability' };
10
+ }
11
+ },
12
+ /**
13
+ * Given a table of base stats and a pokemon set, return the actual stats.
14
+ */
15
+ spreadModify(baseStats, set) {
16
+ const modStats = { hp: 10, atk: 10, def: 10, spa: 10, spd: 10, spe: 10 };
17
+ let statName;
18
+ for (statName in modStats) {
19
+ const stat = baseStats[statName];
20
+ modStats[statName] = Math.floor((Math.floor(2 * stat + set.ivs[statName]) * set.level / 100 + 5));
21
+ }
22
+ if ('hp' in baseStats) {
23
+ const stat = baseStats['hp'];
24
+ modStats['hp'] = Math.floor(Math.floor(2 * stat + set.ivs['hp'] + 100) * set.level / 100 + 10);
25
+ }
26
+ return this.natureModify(modStats, set);
27
+ },
28
+ /**
29
+ * @param {StatsTable} stats
30
+ * @param {PokemonSet} set
31
+ * @return {StatsTable}
32
+ */
33
+ natureModify(stats, set) {
34
+ const nature = this.dex.natures.get(set.nature);
35
+ if (nature.plus)
36
+ stats[nature.plus] = Math.floor(stats[nature.plus] * 1.1);
37
+ if (nature.minus)
38
+ stats[nature.minus] = Math.floor(stats[nature.minus] * 0.9);
39
+ set.happiness = 70;
40
+ const friendshipValue = Math.floor((set.happiness / 255 / 10 + 1) * 100);
41
+ let stat;
42
+ for (stat in stats) {
43
+ if (stat !== 'hp') {
44
+ stats[stat] = Math.floor(stats[stat] * friendshipValue / 100);
45
+ }
46
+ stats[stat] += set.evs[stat];
47
+ }
48
+ return stats;
49
+ },
50
+ pokemon: {
51
+ getWeight() {
52
+ let weighthg = this.battle.runEvent('ModifyWeight', this, null, null, this.weighthg);
53
+ if (weighthg < 1)
54
+ weighthg = 1;
55
+ const weightModifierFinal = 20 * Math.random() * 0.01;
56
+ return weighthg + (weighthg * (this.battle.random(2) === 1 ? 1 : -1) * weightModifierFinal);
57
+ },
58
+ },
59
+ };
60
+ //# sourceMappingURL=scripts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scripts.js","sourceRoot":"","sources":["../../src/letsgo/scripts.ts"],"names":[],"mappings":";;;AAEa,QAAA,OAAO,GAA4B;IAC/C,OAAO,EAAE,MAAM;IACf,IAAI;QACH,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,aAAa,GAAG,IAAI,CAAC;QAC5D,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YAClC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS,GAAG,EAAC,CAAC,EAAE,YAAY,EAAC,CAAC;SACzD;IACF,CAAC;IACD;;OAEG;IACH,YAAY,CAAC,SAAS,EAAE,GAAG;QAC1B,MAAM,QAAQ,GAAe,EAAC,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAC,CAAC;QACnF,IAAI,QAAgB,CAAC;QACrB,KAAK,QAAQ,IAAI,QAAQ,EAAE;YAC1B,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;YACjC,QAAQ,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,G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,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,eAAe,GAAG,GAAG,CAAC,CAAC;aAC9D;YACD,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SAC7B;QACD,OAAO,KAAK,CAAC;IACd,CAAC;IAED,OAAO,EAAE;QACR,SAAS;YACR,IAAI,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YACrF,IAAI,QAAQ,GAAG,CAAC;gBAAE,QAAQ,GAAG,CAAC,CAAC;YAC/B,MAAM,mBAAmB,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC;YACtD,OAAO,QAAQ,GAAG,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,mBAAmB,CAAC,CAAC;QAC7F,CAAC;KACD;CACD,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { ModdedConditionData } from '@pkmn/sim';
2
+ export declare const Conditions: {
3
+ [k: string]: ModdedConditionData;
4
+ };
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Conditions = void 0;
4
+ exports.Conditions = {
5
+ brn: {
6
+ name: 'brn',
7
+ effectType: 'Status',
8
+ onStart(target) {
9
+ this.add('-status', target, 'brn');
10
+ },
11
+ onAfterMoveSelfPriority: 2,
12
+ onAfterMoveSelf(pokemon) {
13
+ this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
14
+ },
15
+ onAfterSwitchInSelf(pokemon) {
16
+ this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
17
+ },
18
+ },
19
+ par: {
20
+ name: 'par',
21
+ effectType: 'Status',
22
+ onStart(target) {
23
+ this.add('-status', target, 'par');
24
+ },
25
+ onBeforeMovePriority: 2,
26
+ onBeforeMove(pokemon) {
27
+ if (this.randomChance(63, 256)) {
28
+ this.add('cant', pokemon, 'par');
29
+ pokemon.removeVolatile('bide');
30
+ pokemon.removeVolatile('lockedmovee');
31
+ pokemon.removeVolatile('twoturnmove');
32
+ pokemon.removeVolatile('fly');
33
+ pokemon.removeVolatile('dig');
34
+ pokemon.removeVolatile('solarbeam');
35
+ pokemon.removeVolatile('skullbash');
36
+ pokemon.removeVolatile('partialtrappinglock');
37
+ return false;
38
+ }
39
+ },
40
+ },
41
+ slp: {
42
+ name: 'slp',
43
+ effectType: 'Status',
44
+ onStart(target, source, sourceEffect) {
45
+ if (sourceEffect && sourceEffect.effectType === 'Move') {
46
+ this.add('-status', target, 'slp', '[from] move: ' + sourceEffect.name);
47
+ }
48
+ else {
49
+ this.add('-status', target, 'slp');
50
+ }
51
+ // 1-3 turns
52
+ this.effectData.startTime = this.random(1, 4);
53
+ this.effectData.time = this.effectData.startTime;
54
+ },
55
+ onBeforeMovePriority: 2,
56
+ onBeforeMove(pokemon, target, move) {
57
+ pokemon.statusData.time--;
58
+ this.add('cant', pokemon, 'slp');
59
+ pokemon.lastMove = null;
60
+ return false;
61
+ },
62
+ onAfterMoveSelf(pokemon) {
63
+ if (pokemon.statusData.time <= 0)
64
+ pokemon.cureStatus();
65
+ },
66
+ },
67
+ frz: {
68
+ name: 'frz',
69
+ effectType: 'Status',
70
+ onStart(target) {
71
+ this.add('-status', target, 'frz');
72
+ },
73
+ onBeforeMovePriority: 2,
74
+ onBeforeMove(pokemon, target, move) {
75
+ this.add('cant', pokemon, 'frz');
76
+ pokemon.lastMove = null;
77
+ return false;
78
+ },
79
+ onHit(target, source, move) {
80
+ if (move.type === 'Fire' && move.category !== 'Status') {
81
+ target.cureStatus();
82
+ }
83
+ },
84
+ },
85
+ psn: {
86
+ name: 'psn',
87
+ effectType: 'Status',
88
+ onStart(target) {
89
+ this.add('-status', target, 'psn');
90
+ },
91
+ onAfterMoveSelfPriority: 2,
92
+ onAfterMoveSelf(pokemon) {
93
+ this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
94
+ },
95
+ onAfterSwitchInSelf(pokemon) {
96
+ this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
97
+ },
98
+ },
99
+ tox: {
100
+ name: 'tox',
101
+ effectType: 'Status',
102
+ onStart(target) {
103
+ this.add('-status', target, 'tox');
104
+ },
105
+ onAfterMoveSelfPriority: 2,
106
+ onAfterMoveSelf(pokemon) {
107
+ this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
108
+ },
109
+ onAfterSwitchInSelf(pokemon) {
110
+ // Regular poison status and damage after a switchout -> switchin.
111
+ pokemon.setStatus('psn');
112
+ pokemon.addVolatile('residualdmg');
113
+ pokemon.volatiles['residualdmg'].counter = 1;
114
+ this.damage(this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1));
115
+ },
116
+ },
117
+ partiallytrapped: {
118
+ name: 'partiallytrapped',
119
+ duration: 2,
120
+ onBeforeMovePriority: 1,
121
+ onStart(target, source, effect) {
122
+ this.add('-activate', target, 'move: ' + effect, '[of] ' + source);
123
+ },
124
+ onBeforeMove(pokemon) {
125
+ if (this.effectData.source && (!this.effectData.source.isActive || this.effectData.source.hp <= 0)) {
126
+ pokemon.removeVolatile('partiallytrapped');
127
+ return;
128
+ }
129
+ this.add('cant', pokemon, 'partiallytrapped');
130
+ return false;
131
+ },
132
+ onEnd(pokemon) {
133
+ this.add('-end', pokemon, this.effectData.sourceEffect, '[partiallytrapped]');
134
+ },
135
+ },
136
+ };
137
+ //# sourceMappingURL=conditions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditions.js","sourceRoot":"","sources":["../../src/stadium/conditions.ts"],"names":[],"mappings":";;;AAEa,QAAA,UA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,CAAC,OAAO;YACZ,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,oBAAoB,CAAC,CAAC;QAC/E,CAAC;KACD;CACD,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { Conditions } from './conditions';
2
+ export { Formats } from './rulesets';
3
+ export { Moves } from './moves';
4
+ export { Scripts } from './scripts';
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Scripts = exports.Moves = exports.Formats = exports.Conditions = void 0;
4
+ var conditions_1 = require("./conditions");
5
+ Object.defineProperty(exports, "Conditions", { enumerable: true, get: function () { return conditions_1.Conditions; } });
6
+ var rulesets_1 = require("./rulesets");
7
+ Object.defineProperty(exports, "Formats", { enumerable: true, get: function () { return rulesets_1.Formats; } });
8
+ var moves_1 = require("./moves");
9
+ Object.defineProperty(exports, "Moves", { enumerable: true, get: function () { return moves_1.Moves; } });
10
+ var scripts_1 = require("./scripts");
11
+ Object.defineProperty(exports, "Scripts", { enumerable: true, get: function () { return scripts_1.Scripts; } });
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/stadium/index.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AAAhC,wGAAA,UAAU,OAAA;AAClB,uCAAmC;AAA3B,mGAAA,OAAO,OAAA;AACf,iCAA8B;AAAtB,8FAAA,KAAK,OAAA;AACb,qCAAkC;AAA1B,kGAAA,OAAO,OAAA"}
@@ -0,0 +1,4 @@
1
+ import type { ModdedMoveData } from '@pkmn/sim';
2
+ export declare const Moves: {
3
+ [k: string]: ModdedMoveData;
4
+ };
@@ -0,0 +1,246 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Moves = void 0;
4
+ exports.Moves = {
5
+ bind: {
6
+ inherit: true,
7
+ },
8
+ clamp: {
9
+ inherit: true,
10
+ },
11
+ counter: {
12
+ inherit: true,
13
+ ignoreImmunity: true,
14
+ willCrit: false,
15
+ basePower: 1,
16
+ damageCallback(pokemon, target) {
17
+ // Counter mechanics in Stadium 1:
18
+ // - a move is Counterable if it is Normal or Fighting type, has nonzero Base Power, and is not Counter
19
+ // - Counter succeeds if the target used a Counterable move earlier this turn
20
+ const lastMoveThisTurn = target.side.lastMove && target.side.lastMove.id === target.side.lastSelectedMove &&
21
+ this.dex.getMove(target.side.lastMove.id);
22
+ const lastMoveThisTurnIsCounterable = lastMoveThisTurn && lastMoveThisTurn.basePower > 0 &&
23
+ ['Normal', 'Fighting'].includes(lastMoveThisTurn.type) && lastMoveThisTurn.id !== 'counter';
24
+ if (lastMoveThisTurnIsCounterable && !this.queue.willMove(target)) {
25
+ this.debug("Stadium 1 Counter: last move was not Counterable");
26
+ this.add('-fail', pokemon);
27
+ return false;
28
+ }
29
+ if (this.lastDamage <= 0) {
30
+ this.debug("Stadium 1 Counter: no previous damage exists");
31
+ this.add('-fail', pokemon);
32
+ return false;
33
+ }
34
+ return 2 * this.lastDamage;
35
+ },
36
+ },
37
+ firespin: {
38
+ inherit: true,
39
+ },
40
+ haze: {
41
+ inherit: true,
42
+ onHit(target, source) {
43
+ this.add('-clearallboost');
44
+ for (const pokemon of this.getAllActive()) {
45
+ pokemon.clearBoosts();
46
+ // This should cure the status of both Pokemon, and subsequently recalculate stats to remove the Paralysis/Burn Speed Drop.
47
+ pokemon.cureStatus();
48
+ for (const id of Object.keys(pokemon.volatiles)) {
49
+ pokemon.removeVolatile(id);
50
+ this.add('-end', pokemon, id);
51
+ }
52
+ pokemon.recalculateStats();
53
+ }
54
+ },
55
+ },
56
+ highjumpkick: {
57
+ inherit: true,
58
+ desc: "If this attack misses the target, the user takes 1 HP of damage.",
59
+ shortDesc: "User takes 1 HP damage it would have dealt if miss.",
60
+ onMoveFail(target, source, move) {
61
+ if (!target.types.includes('Ghost')) {
62
+ this.directDamage(1, source);
63
+ }
64
+ },
65
+ },
66
+ hyperbeam: {
67
+ inherit: true,
68
+ onMoveFail(target, source, move) {
69
+ source.addVolatile('mustrecharge');
70
+ },
71
+ },
72
+ jumpkick: {
73
+ inherit: true,
74
+ desc: "If this attack misses the target, the user 1HP of damage.",
75
+ shortDesc: "User takes 1 HP damage if miss.",
76
+ onMoveFail(target, source, move) {
77
+ this.damage(1, source);
78
+ },
79
+ },
80
+ leechseed: {
81
+ inherit: true,
82
+ onHit() { },
83
+ condition: {
84
+ onStart(target) {
85
+ this.add('-start', target, 'move: Leech Seed');
86
+ },
87
+ onAfterMoveSelfPriority: 1,
88
+ onAfterMoveSelf(pokemon) {
89
+ const leecher = pokemon.side.foe.active[pokemon.volatiles['leechseed'].sourcePosition];
90
+ if (!leecher || leecher.fainted || leecher.hp <= 0) {
91
+ this.debug('Nothing to leech into');
92
+ return;
93
+ }
94
+ const toLeech = this.clampIntRange(Math.floor(pokemon.maxhp / 16), 1);
95
+ const damage = this.damage(toLeech, pokemon, leecher);
96
+ if (damage)
97
+ this.heal(damage, leecher, pokemon);
98
+ },
99
+ },
100
+ },
101
+ psywave: {
102
+ inherit: true,
103
+ basePower: 1,
104
+ damageCallback(pokemon) {
105
+ return this.random(1, this.trunc(1.5 * pokemon.level));
106
+ },
107
+ },
108
+ rage: {
109
+ inherit: true,
110
+ self: {
111
+ volatileStatus: 'rage',
112
+ },
113
+ condition: {
114
+ // Rage lock
115
+ duration: 255,
116
+ onStart(target, source, effect) {
117
+ this.effectData.move = 'rage';
118
+ },
119
+ onLockMove: 'rage',
120
+ onTryHit(target, source, move) {
121
+ if (target.boosts.atk < 6 && move.id === 'disable') {
122
+ this.boost({ atk: 1 });
123
+ }
124
+ },
125
+ onHit(target, source, move) {
126
+ if (target.boosts.atk < 6 && move.category !== 'Status') {
127
+ this.boost({ atk: 1 });
128
+ }
129
+ },
130
+ },
131
+ },
132
+ recover: {
133
+ inherit: true,
134
+ heal: null,
135
+ onHit(target) {
136
+ if (target.hp === target.maxhp) {
137
+ return false;
138
+ }
139
+ this.heal(Math.floor(target.maxhp / 2), target, target);
140
+ },
141
+ },
142
+ rest: {
143
+ inherit: true,
144
+ onHit(target, source, move) {
145
+ // Fails if the difference between
146
+ // max HP and current HP is 0, 255, or 511
147
+ if (target.hp >= target.maxhp)
148
+ return false;
149
+ if (!target.setStatus('slp', source, move))
150
+ return false;
151
+ target.statusData.time = 2;
152
+ target.statusData.startTime = 2;
153
+ target.recalculateStats(); // Stadium Rest removes statdrops given by Major Status Conditions.
154
+ this.heal(target.maxhp); // Aesthetic only as the healing happens after you fall asleep in-game
155
+ },
156
+ },
157
+ softboiled: {
158
+ inherit: true,
159
+ heal: null,
160
+ onHit(target) {
161
+ // Fail when health is 255 or 511 less than max
162
+ if (target.hp === target.maxhp) {
163
+ return false;
164
+ }
165
+ this.heal(Math.floor(target.maxhp / 2), target, target);
166
+ },
167
+ },
168
+ substitute: {
169
+ inherit: true,
170
+ condition: {
171
+ onStart(target) {
172
+ this.add('-start', target, 'Substitute');
173
+ this.effectData.hp = Math.floor(target.maxhp / 4);
174
+ delete target.volatiles['partiallytrapped'];
175
+ },
176
+ onTryHitPriority: -1,
177
+ onTryHit(target, source, move) {
178
+ if (target === source) {
179
+ this.debug('sub bypass: self hit');
180
+ return;
181
+ }
182
+ if (move.drain) {
183
+ this.add('-miss', source);
184
+ return null;
185
+ }
186
+ if (move.category === 'Status') {
187
+ const SubBlocked = ['leechseed', 'lockon', 'mindreader', 'nightmare'];
188
+ if (move.status || move.boosts || move.volatileStatus === 'confusion' || SubBlocked.includes(move.id)) {
189
+ this.add('-activate', target, 'Substitute', '[block] ' + move.name);
190
+ return null;
191
+ }
192
+ return;
193
+ }
194
+ if (move.volatileStatus && target === source)
195
+ return;
196
+ let damage = this.getDamage(source, target, move);
197
+ if (!damage)
198
+ return null;
199
+ damage = this.runEvent('SubDamage', target, source, move, damage);
200
+ if (!damage)
201
+ return damage;
202
+ target.volatiles['substitute'].hp -= damage;
203
+ source.lastDamage = damage;
204
+ if (target.volatiles['substitute'].hp <= 0) {
205
+ this.debug('Substitute broke');
206
+ target.removeVolatile('substitute');
207
+ target.subFainted = true;
208
+ }
209
+ else {
210
+ this.add('-activate', target, 'Substitute', '[damage]');
211
+ }
212
+ // Drain/recoil does not happen if the substitute breaks
213
+ if (target.volatiles['substitute']) {
214
+ if (move.recoil) {
215
+ this.damage(Math.round(damage * move.recoil[0] / move.recoil[1]), source, target, 'recoil');
216
+ }
217
+ }
218
+ this.runEvent('AfterSubDamage', target, source, move, damage);
219
+ // Add here counter damage
220
+ const lastAttackedBy = target.getLastAttackedBy();
221
+ if (!lastAttackedBy) {
222
+ target.attackedBy.push({ source: source, move: move.id, damage: damage, thisTurn: true });
223
+ }
224
+ else {
225
+ lastAttackedBy.move = move.id;
226
+ lastAttackedBy.damage = damage;
227
+ }
228
+ return 0;
229
+ },
230
+ onEnd(target) {
231
+ this.add('-end', target, 'Substitute');
232
+ },
233
+ },
234
+ secondary: null,
235
+ target: "self",
236
+ type: "Normal",
237
+ },
238
+ struggle: {
239
+ inherit: true,
240
+ ignoreImmunity: { 'Normal': true },
241
+ },
242
+ wrap: {
243
+ inherit: true,
244
+ },
245
+ };
246
+ //# sourceMappingURL=moves.js.map