@pkmn/engine 0.1.0-dev.47feedd9 → 0.1.0-dev.4c173f03
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/README.md +55 -44
- package/build/pkg/addon.js +3 -2
- package/build/pkg/addon.js.map +1 -1
- package/build/pkg/data/ids.json +12 -12
- package/build/pkg/data/layout.json +27 -5
- package/build/pkg/data/protocol.json +69 -12
- package/build/pkg/data.d.ts +2 -2
- package/build/pkg/gen1.d.ts +2 -1
- package/build/pkg/gen1.js +38 -20
- package/build/pkg/gen1.js.map +1 -1
- package/build/pkg/index.d.ts +4 -2
- package/build/pkg/index.js.map +1 -1
- package/build/pkg/protocol.d.ts +4 -2
- package/build/pkg/protocol.js +60 -39
- package/build/pkg/protocol.js.map +1 -1
- package/build/test/display.js +7 -3
- package/build/test/display.js.map +1 -1
- package/build.zig +89 -65
- package/package.json +41 -20
- package/src/bin/install-pkmn-engine +10 -5
- package/src/lib/binding/node.zig +46 -141
- package/src/lib/binding/wasm.zig +4 -2
- package/src/lib/common/battle.zig +17 -0
- package/src/lib/common/data.zig +15 -27
- package/src/lib/common/debug.zig +20 -11
- package/src/lib/common/js.zig +118 -0
- package/src/lib/common/optional.zig +67 -0
- package/src/lib/common/options.zig +9 -0
- package/src/lib/common/protocol.zig +750 -208
- package/src/lib/common/rational.zig +353 -0
- package/src/lib/common/rng.zig +15 -15
- package/src/lib/common/util.zig +12 -0
- package/src/lib/gen1/README.md +277 -180
- package/src/lib/gen1/calc.zig +426 -0
- package/src/lib/gen1/chance.zig +1060 -0
- package/src/lib/gen1/data/moves.zig +193 -181
- package/src/lib/gen1/data/species.zig +3 -3
- package/src/lib/gen1/data/types.zig +6 -6
- package/src/lib/gen1/data.zig +79 -65
- package/src/lib/gen1/helpers.zig +577 -35
- package/src/lib/gen1/mechanics.zig +869 -590
- package/src/lib/gen2/README.md +106 -85
- package/src/lib/gen2/calc.zig +143 -0
- package/src/lib/gen2/chance.zig +1314 -0
- package/src/lib/gen2/data/items.zig +13 -19
- package/src/lib/gen2/data/moves.zig +661 -567
- package/src/lib/gen2/data/species.zig +2 -2
- package/src/lib/gen2/data/types.zig +132 -29
- package/src/lib/gen2/data.zig +134 -84
- package/src/lib/gen2/generated.zig +1023 -0
- package/src/lib/gen2/helpers.zig +16 -22
- package/src/lib/gen2/mechanics.zig +2910 -12
- package/src/lib/pkmn.zig +61 -2
|
@@ -0,0 +1,1023 @@
|
|
|
1
|
+
//! Code generated by `tools/generate` - manual edits will be overwritten.
|
|
2
|
+
|
|
3
|
+
const std = @import("std");
|
|
4
|
+
|
|
5
|
+
const common = @import("../common/data.zig");
|
|
6
|
+
|
|
7
|
+
const data = @import("data.zig");
|
|
8
|
+
const mechanics = @import("mechanics.zig");
|
|
9
|
+
|
|
10
|
+
const assert = std.debug.assert;
|
|
11
|
+
|
|
12
|
+
const Player = common.Player;
|
|
13
|
+
const Result = common.Result;
|
|
14
|
+
|
|
15
|
+
const Effectiveness = data.Effectiveness;
|
|
16
|
+
const Move = data.Move;
|
|
17
|
+
|
|
18
|
+
const Effects = mechanics.Effects;
|
|
19
|
+
const State = mechanics.State;
|
|
20
|
+
|
|
21
|
+
const canMove = mechanics.canMove;
|
|
22
|
+
const canCharge = mechanics.canCharge;
|
|
23
|
+
const decrementPP = mechanics.decrementPP;
|
|
24
|
+
const checkHit = mechanics.checkHit;
|
|
25
|
+
const checkCriticalHit = mechanics.checkCriticalHit;
|
|
26
|
+
const calcDamage = mechanics.calcDamage;
|
|
27
|
+
const adjustDamage = mechanics.adjustDamage;
|
|
28
|
+
const randomizeDamage = mechanics.randomizeDamage;
|
|
29
|
+
const applyDamage = mechanics.applyDamage;
|
|
30
|
+
const reportOutcome = mechanics.reportOutcome;
|
|
31
|
+
const buildRage = mechanics.buildRage;
|
|
32
|
+
const kingsRock = mechanics.kingsRock;
|
|
33
|
+
const destinyBond = mechanics.destinyBond;
|
|
34
|
+
|
|
35
|
+
pub fn doMove(battle: anytype, player: Player, state: *State, options: anytype) !?Result {
|
|
36
|
+
var log = options.log;
|
|
37
|
+
|
|
38
|
+
var side = battle.side(player);
|
|
39
|
+
var volatiles = &side.active.volatiles;
|
|
40
|
+
|
|
41
|
+
const ident = battle.active(player);
|
|
42
|
+
const foe_ident = battle.active(player.foe());
|
|
43
|
+
|
|
44
|
+
const effect = Move.get(state.move).effect;
|
|
45
|
+
switch (effect) {
|
|
46
|
+
.AlwaysHit, .HighCritical, .Priority, .JumpKick, .None => {
|
|
47
|
+
_ = try canMove(battle, player, state, options);
|
|
48
|
+
try checkCriticalHit(battle, player, state, options);
|
|
49
|
+
try calcDamage(battle, player, state, options);
|
|
50
|
+
try adjustDamage(battle, player, state, options);
|
|
51
|
+
try randomizeDamage(battle, player, state, options);
|
|
52
|
+
try checkHit(battle, player, state, options);
|
|
53
|
+
try applyDamage(battle, player, state, options);
|
|
54
|
+
try reportOutcome(battle, player, state, options);
|
|
55
|
+
_ = try destinyBond(battle, player, state, options);
|
|
56
|
+
try buildRage(battle, player, state, options);
|
|
57
|
+
try kingsRock(battle, player, state, options);
|
|
58
|
+
},
|
|
59
|
+
.DoubleHit, .MultiHit => {
|
|
60
|
+
_ = try canMove(battle, player, state, options);
|
|
61
|
+
// TODO startloop
|
|
62
|
+
try checkHit(battle, player, state, options);
|
|
63
|
+
try checkCriticalHit(battle, player, state, options);
|
|
64
|
+
try calcDamage(battle, player, state, options);
|
|
65
|
+
try adjustDamage(battle, player, state, options);
|
|
66
|
+
try randomizeDamage(battle, player, state, options);
|
|
67
|
+
// TODO clearmissdamage
|
|
68
|
+
try applyDamage(battle, player, state, options);
|
|
69
|
+
// TODO critsupereffectivelooptext
|
|
70
|
+
_ = try destinyBond(battle, player, state, options);
|
|
71
|
+
try buildRage(battle, player, state, options);
|
|
72
|
+
// TODO endloop
|
|
73
|
+
try kingsRock(battle, player, state, options);
|
|
74
|
+
},
|
|
75
|
+
.PayDay => {
|
|
76
|
+
_ = try canMove(battle, player, state, options);
|
|
77
|
+
try checkCriticalHit(battle, player, state, options);
|
|
78
|
+
try calcDamage(battle, player, state, options);
|
|
79
|
+
try adjustDamage(battle, player, state, options);
|
|
80
|
+
try randomizeDamage(battle, player, state, options);
|
|
81
|
+
try checkHit(battle, player, state, options);
|
|
82
|
+
try applyDamage(battle, player, state, options);
|
|
83
|
+
try reportOutcome(battle, player, state, options);
|
|
84
|
+
try Effects.payDay(battle, player, state, options);
|
|
85
|
+
_ = try destinyBond(battle, player, state, options);
|
|
86
|
+
try buildRage(battle, player, state, options);
|
|
87
|
+
try kingsRock(battle, player, state, options);
|
|
88
|
+
},
|
|
89
|
+
.BurnChance => {
|
|
90
|
+
_ = try canMove(battle, player, state, options);
|
|
91
|
+
try checkCriticalHit(battle, player, state, options);
|
|
92
|
+
try calcDamage(battle, player, state, options);
|
|
93
|
+
try adjustDamage(battle, player, state, options);
|
|
94
|
+
try randomizeDamage(battle, player, state, options);
|
|
95
|
+
try checkHit(battle, player, state, options);
|
|
96
|
+
// TODO effectchance
|
|
97
|
+
try applyDamage(battle, player, state, options);
|
|
98
|
+
try reportOutcome(battle, player, state, options);
|
|
99
|
+
_ = try destinyBond(battle, player, state, options);
|
|
100
|
+
try buildRage(battle, player, state, options);
|
|
101
|
+
try Effects.burnChance(battle, player, state, options);
|
|
102
|
+
},
|
|
103
|
+
.FreezeChance => {
|
|
104
|
+
_ = try canMove(battle, player, state, options);
|
|
105
|
+
try checkCriticalHit(battle, player, state, options);
|
|
106
|
+
try calcDamage(battle, player, state, options);
|
|
107
|
+
try adjustDamage(battle, player, state, options);
|
|
108
|
+
try randomizeDamage(battle, player, state, options);
|
|
109
|
+
try checkHit(battle, player, state, options);
|
|
110
|
+
// TODO effectchance
|
|
111
|
+
try applyDamage(battle, player, state, options);
|
|
112
|
+
try reportOutcome(battle, player, state, options);
|
|
113
|
+
_ = try destinyBond(battle, player, state, options);
|
|
114
|
+
try buildRage(battle, player, state, options);
|
|
115
|
+
try Effects.freezeChance(battle, player, state, options);
|
|
116
|
+
},
|
|
117
|
+
.ParalyzeChance => {
|
|
118
|
+
_ = try canMove(battle, player, state, options);
|
|
119
|
+
try checkCriticalHit(battle, player, state, options);
|
|
120
|
+
try calcDamage(battle, player, state, options);
|
|
121
|
+
try adjustDamage(battle, player, state, options);
|
|
122
|
+
try randomizeDamage(battle, player, state, options);
|
|
123
|
+
try checkHit(battle, player, state, options);
|
|
124
|
+
// TODO effectchance
|
|
125
|
+
try applyDamage(battle, player, state, options);
|
|
126
|
+
try reportOutcome(battle, player, state, options);
|
|
127
|
+
_ = try destinyBond(battle, player, state, options);
|
|
128
|
+
try buildRage(battle, player, state, options);
|
|
129
|
+
try Effects.paralyzeChance(battle, player, state, options);
|
|
130
|
+
},
|
|
131
|
+
.OHKO => {
|
|
132
|
+
_ = try canMove(battle, player, state, options);
|
|
133
|
+
try adjustDamage(battle, player, state, options);
|
|
134
|
+
try Effects.ohko(battle, player, state, options);
|
|
135
|
+
try applyDamage(battle, player, state, options);
|
|
136
|
+
try reportOutcome(battle, player, state, options);
|
|
137
|
+
_ = try destinyBond(battle, player, state, options);
|
|
138
|
+
try buildRage(battle, player, state, options);
|
|
139
|
+
},
|
|
140
|
+
.RazorWind => {
|
|
141
|
+
_ = try canCharge(battle, player, state, options);
|
|
142
|
+
try checkCriticalHit(battle, player, state, options);
|
|
143
|
+
try calcDamage(battle, player, state, options);
|
|
144
|
+
try adjustDamage(battle, player, state, options);
|
|
145
|
+
try randomizeDamage(battle, player, state, options);
|
|
146
|
+
try checkHit(battle, player, state, options);
|
|
147
|
+
try applyDamage(battle, player, state, options);
|
|
148
|
+
try reportOutcome(battle, player, state, options);
|
|
149
|
+
_ = try destinyBond(battle, player, state, options);
|
|
150
|
+
try buildRage(battle, player, state, options);
|
|
151
|
+
try kingsRock(battle, player, state, options);
|
|
152
|
+
},
|
|
153
|
+
.Gust => {
|
|
154
|
+
_ = try canMove(battle, player, state, options);
|
|
155
|
+
try checkCriticalHit(battle, player, state, options);
|
|
156
|
+
try calcDamage(battle, player, state, options);
|
|
157
|
+
try adjustDamage(battle, player, state, options);
|
|
158
|
+
try randomizeDamage(battle, player, state, options);
|
|
159
|
+
// TODO doubleflyingdamage
|
|
160
|
+
try checkHit(battle, player, state, options);
|
|
161
|
+
try applyDamage(battle, player, state, options);
|
|
162
|
+
try reportOutcome(battle, player, state, options);
|
|
163
|
+
_ = try destinyBond(battle, player, state, options);
|
|
164
|
+
try buildRage(battle, player, state, options);
|
|
165
|
+
},
|
|
166
|
+
.ForceSwitch => {
|
|
167
|
+
_ = try canMove(battle, player, state, options);
|
|
168
|
+
try checkHit(battle, player, state, options);
|
|
169
|
+
try Effects.forceSwitch(battle, player, state, options);
|
|
170
|
+
},
|
|
171
|
+
.FlyDig => {
|
|
172
|
+
_ = try canCharge(battle, player, state, options);
|
|
173
|
+
try checkCriticalHit(battle, player, state, options);
|
|
174
|
+
try calcDamage(battle, player, state, options);
|
|
175
|
+
try adjustDamage(battle, player, state, options);
|
|
176
|
+
try randomizeDamage(battle, player, state, options);
|
|
177
|
+
try checkHit(battle, player, state, options);
|
|
178
|
+
try applyDamage(battle, player, state, options);
|
|
179
|
+
try reportOutcome(battle, player, state, options);
|
|
180
|
+
_ = try destinyBond(battle, player, state, options);
|
|
181
|
+
try buildRage(battle, player, state, options);
|
|
182
|
+
try kingsRock(battle, player, state, options);
|
|
183
|
+
},
|
|
184
|
+
.Binding => {
|
|
185
|
+
_ = try canMove(battle, player, state, options);
|
|
186
|
+
try checkHit(battle, player, state, options);
|
|
187
|
+
try checkCriticalHit(battle, player, state, options);
|
|
188
|
+
try calcDamage(battle, player, state, options);
|
|
189
|
+
try adjustDamage(battle, player, state, options);
|
|
190
|
+
try randomizeDamage(battle, player, state, options);
|
|
191
|
+
// TODO clearmissdamage
|
|
192
|
+
try applyDamage(battle, player, state, options);
|
|
193
|
+
try reportOutcome(battle, player, state, options);
|
|
194
|
+
_ = try destinyBond(battle, player, state, options);
|
|
195
|
+
try buildRage(battle, player, state, options);
|
|
196
|
+
try Effects.binding(battle, player, state, options);
|
|
197
|
+
},
|
|
198
|
+
.Stomp => {
|
|
199
|
+
_ = try canMove(battle, player, state, options);
|
|
200
|
+
try checkCriticalHit(battle, player, state, options);
|
|
201
|
+
try calcDamage(battle, player, state, options);
|
|
202
|
+
try adjustDamage(battle, player, state, options);
|
|
203
|
+
try randomizeDamage(battle, player, state, options);
|
|
204
|
+
// TODO doubleminimizedamage
|
|
205
|
+
try checkHit(battle, player, state, options);
|
|
206
|
+
// TODO effectchance
|
|
207
|
+
try applyDamage(battle, player, state, options);
|
|
208
|
+
try reportOutcome(battle, player, state, options);
|
|
209
|
+
_ = try destinyBond(battle, player, state, options);
|
|
210
|
+
try buildRage(battle, player, state, options);
|
|
211
|
+
try Effects.flinchChance(battle, player, state, options);
|
|
212
|
+
},
|
|
213
|
+
.FlinchChance => {
|
|
214
|
+
_ = try canMove(battle, player, state, options);
|
|
215
|
+
try checkCriticalHit(battle, player, state, options);
|
|
216
|
+
try calcDamage(battle, player, state, options);
|
|
217
|
+
try adjustDamage(battle, player, state, options);
|
|
218
|
+
try randomizeDamage(battle, player, state, options);
|
|
219
|
+
try checkHit(battle, player, state, options);
|
|
220
|
+
// TODO effectchance
|
|
221
|
+
try applyDamage(battle, player, state, options);
|
|
222
|
+
try reportOutcome(battle, player, state, options);
|
|
223
|
+
_ = try destinyBond(battle, player, state, options);
|
|
224
|
+
try buildRage(battle, player, state, options);
|
|
225
|
+
try Effects.flinchChance(battle, player, state, options);
|
|
226
|
+
},
|
|
227
|
+
.Recoil => {
|
|
228
|
+
_ = try canMove(battle, player, state, options);
|
|
229
|
+
try checkCriticalHit(battle, player, state, options);
|
|
230
|
+
try calcDamage(battle, player, state, options);
|
|
231
|
+
try adjustDamage(battle, player, state, options);
|
|
232
|
+
try randomizeDamage(battle, player, state, options);
|
|
233
|
+
try checkHit(battle, player, state, options);
|
|
234
|
+
try applyDamage(battle, player, state, options);
|
|
235
|
+
try reportOutcome(battle, player, state, options);
|
|
236
|
+
try Effects.recoil(battle, player, state, options);
|
|
237
|
+
_ = try destinyBond(battle, player, state, options);
|
|
238
|
+
try buildRage(battle, player, state, options);
|
|
239
|
+
try kingsRock(battle, player, state, options);
|
|
240
|
+
},
|
|
241
|
+
.Thrashing => {
|
|
242
|
+
// TODO checkrampage
|
|
243
|
+
// doturn
|
|
244
|
+
const charging = false; // TODO
|
|
245
|
+
const skip_pp = charging or state.move == .Struggle or
|
|
246
|
+
(volatiles.BeatUp or volatiles.Thrashing or volatiles.Bide);
|
|
247
|
+
if (!skip_pp) _ = decrementPP(side, state.move, state.mslot); // TODO if no pp return
|
|
248
|
+
// TODO rampage
|
|
249
|
+
// usedmovetext
|
|
250
|
+
try log.move(ident, state.move, foe_ident); // FIXME self? from?
|
|
251
|
+
try checkHit(battle, player, state, options);
|
|
252
|
+
try checkCriticalHit(battle, player, state, options);
|
|
253
|
+
try calcDamage(battle, player, state, options);
|
|
254
|
+
try adjustDamage(battle, player, state, options);
|
|
255
|
+
try randomizeDamage(battle, player, state, options);
|
|
256
|
+
// TODO clearmissdamage
|
|
257
|
+
try applyDamage(battle, player, state, options);
|
|
258
|
+
try reportOutcome(battle, player, state, options);
|
|
259
|
+
_ = try destinyBond(battle, player, state, options);
|
|
260
|
+
try buildRage(battle, player, state, options);
|
|
261
|
+
try kingsRock(battle, player, state, options);
|
|
262
|
+
},
|
|
263
|
+
.PoisonChance => {
|
|
264
|
+
_ = try canMove(battle, player, state, options);
|
|
265
|
+
try checkCriticalHit(battle, player, state, options);
|
|
266
|
+
try calcDamage(battle, player, state, options);
|
|
267
|
+
try adjustDamage(battle, player, state, options);
|
|
268
|
+
try randomizeDamage(battle, player, state, options);
|
|
269
|
+
try checkHit(battle, player, state, options);
|
|
270
|
+
// TODO effectchance
|
|
271
|
+
try applyDamage(battle, player, state, options);
|
|
272
|
+
try reportOutcome(battle, player, state, options);
|
|
273
|
+
_ = try destinyBond(battle, player, state, options);
|
|
274
|
+
try buildRage(battle, player, state, options);
|
|
275
|
+
try Effects.poisonChance(battle, player, state, options);
|
|
276
|
+
},
|
|
277
|
+
.Twineedle => {
|
|
278
|
+
_ = try canMove(battle, player, state, options);
|
|
279
|
+
// TODO startloop
|
|
280
|
+
try checkHit(battle, player, state, options);
|
|
281
|
+
// TODO effectchance
|
|
282
|
+
try checkCriticalHit(battle, player, state, options);
|
|
283
|
+
try calcDamage(battle, player, state, options);
|
|
284
|
+
try adjustDamage(battle, player, state, options);
|
|
285
|
+
try randomizeDamage(battle, player, state, options);
|
|
286
|
+
// TODO clearmissdamage
|
|
287
|
+
try applyDamage(battle, player, state, options);
|
|
288
|
+
// TODO critsupereffectivelooptext
|
|
289
|
+
_ = try destinyBond(battle, player, state, options);
|
|
290
|
+
try buildRage(battle, player, state, options);
|
|
291
|
+
// TODO endloop
|
|
292
|
+
try kingsRock(battle, player, state, options);
|
|
293
|
+
try Effects.poisonChance(battle, player, state, options);
|
|
294
|
+
},
|
|
295
|
+
.Sleep => {
|
|
296
|
+
_ = try canMove(battle, player, state, options);
|
|
297
|
+
try checkHit(battle, player, state, options);
|
|
298
|
+
// TODO checksafeguard
|
|
299
|
+
try Effects.sleep(battle, player, state, options);
|
|
300
|
+
},
|
|
301
|
+
.Confusion => {
|
|
302
|
+
_ = try canMove(battle, player, state, options);
|
|
303
|
+
try checkHit(battle, player, state, options);
|
|
304
|
+
// TODO checksafeguard
|
|
305
|
+
try Effects.confusion(battle, player, state, options);
|
|
306
|
+
},
|
|
307
|
+
.SuperFang, .LevelDamage, .Psywave, .FixedDamage => {
|
|
308
|
+
_ = try canMove(battle, player, state, options);
|
|
309
|
+
try Effects.fixedDamage(battle, player, state, options);
|
|
310
|
+
try checkHit(battle, player, state, options);
|
|
311
|
+
// TODO resettypematchup
|
|
312
|
+
try applyDamage(battle, player, state, options);
|
|
313
|
+
_ = try destinyBond(battle, player, state, options);
|
|
314
|
+
try buildRage(battle, player, state, options);
|
|
315
|
+
try kingsRock(battle, player, state, options);
|
|
316
|
+
},
|
|
317
|
+
.Disable => {
|
|
318
|
+
_ = try canMove(battle, player, state, options);
|
|
319
|
+
try checkHit(battle, player, state, options);
|
|
320
|
+
try Effects.disable(battle, player, state, options);
|
|
321
|
+
},
|
|
322
|
+
.Mist => {
|
|
323
|
+
_ = try canMove(battle, player, state, options);
|
|
324
|
+
try Effects.mist(battle, player, state, options);
|
|
325
|
+
},
|
|
326
|
+
.ConfusionChance => {
|
|
327
|
+
_ = try canMove(battle, player, state, options);
|
|
328
|
+
try checkCriticalHit(battle, player, state, options);
|
|
329
|
+
try calcDamage(battle, player, state, options);
|
|
330
|
+
try adjustDamage(battle, player, state, options);
|
|
331
|
+
try randomizeDamage(battle, player, state, options);
|
|
332
|
+
try checkHit(battle, player, state, options);
|
|
333
|
+
// TODO effectchance
|
|
334
|
+
try applyDamage(battle, player, state, options);
|
|
335
|
+
try reportOutcome(battle, player, state, options);
|
|
336
|
+
_ = try destinyBond(battle, player, state, options);
|
|
337
|
+
try buildRage(battle, player, state, options);
|
|
338
|
+
try Effects.confusionChance(battle, player, state, options);
|
|
339
|
+
},
|
|
340
|
+
.HyperBeam => {
|
|
341
|
+
_ = try canMove(battle, player, state, options);
|
|
342
|
+
try checkCriticalHit(battle, player, state, options);
|
|
343
|
+
try calcDamage(battle, player, state, options);
|
|
344
|
+
try adjustDamage(battle, player, state, options);
|
|
345
|
+
try randomizeDamage(battle, player, state, options);
|
|
346
|
+
try checkHit(battle, player, state, options);
|
|
347
|
+
try applyDamage(battle, player, state, options);
|
|
348
|
+
try reportOutcome(battle, player, state, options);
|
|
349
|
+
try Effects.hyperBeam(battle, player, state, options);
|
|
350
|
+
_ = try destinyBond(battle, player, state, options);
|
|
351
|
+
try buildRage(battle, player, state, options);
|
|
352
|
+
},
|
|
353
|
+
.Counter => {
|
|
354
|
+
_ = try canMove(battle, player, state, options);
|
|
355
|
+
try Effects.counter(battle, player, state, options);
|
|
356
|
+
try applyDamage(battle, player, state, options);
|
|
357
|
+
_ = try destinyBond(battle, player, state, options);
|
|
358
|
+
try buildRage(battle, player, state, options);
|
|
359
|
+
try kingsRock(battle, player, state, options);
|
|
360
|
+
},
|
|
361
|
+
.DreamEater, .DrainHP => {
|
|
362
|
+
_ = try canMove(battle, player, state, options);
|
|
363
|
+
try checkCriticalHit(battle, player, state, options);
|
|
364
|
+
try calcDamage(battle, player, state, options);
|
|
365
|
+
try adjustDamage(battle, player, state, options);
|
|
366
|
+
try randomizeDamage(battle, player, state, options);
|
|
367
|
+
try checkHit(battle, player, state, options);
|
|
368
|
+
try applyDamage(battle, player, state, options);
|
|
369
|
+
try reportOutcome(battle, player, state, options);
|
|
370
|
+
try Effects.drainHP(battle, player, state, options);
|
|
371
|
+
_ = try destinyBond(battle, player, state, options);
|
|
372
|
+
try buildRage(battle, player, state, options);
|
|
373
|
+
if (state.move != .DreamEater) try kingsRock(battle, player, state, options);
|
|
374
|
+
},
|
|
375
|
+
.LeechSeed => {
|
|
376
|
+
_ = try canMove(battle, player, state, options);
|
|
377
|
+
try checkHit(battle, player, state, options);
|
|
378
|
+
try Effects.leechSeed(battle, player, state, options);
|
|
379
|
+
},
|
|
380
|
+
.Solarbeam => {
|
|
381
|
+
_ = try canCharge(battle, player, state, options);
|
|
382
|
+
try checkCriticalHit(battle, player, state, options);
|
|
383
|
+
try calcDamage(battle, player, state, options);
|
|
384
|
+
try adjustDamage(battle, player, state, options);
|
|
385
|
+
try randomizeDamage(battle, player, state, options);
|
|
386
|
+
try checkHit(battle, player, state, options);
|
|
387
|
+
try applyDamage(battle, player, state, options);
|
|
388
|
+
try reportOutcome(battle, player, state, options);
|
|
389
|
+
_ = try destinyBond(battle, player, state, options);
|
|
390
|
+
try buildRage(battle, player, state, options);
|
|
391
|
+
try kingsRock(battle, player, state, options);
|
|
392
|
+
},
|
|
393
|
+
.Toxic, .Poison => {
|
|
394
|
+
_ = try canMove(battle, player, state, options);
|
|
395
|
+
try checkHit(battle, player, state, options);
|
|
396
|
+
try adjustDamage(battle, player, state, options);
|
|
397
|
+
// TODO checksafeguard
|
|
398
|
+
try Effects.poison(battle, player, state, options);
|
|
399
|
+
},
|
|
400
|
+
.Paralyze => {
|
|
401
|
+
_ = try canMove(battle, player, state, options);
|
|
402
|
+
try adjustDamage(battle, player, state, options);
|
|
403
|
+
try checkHit(battle, player, state, options);
|
|
404
|
+
// TODO checksafeguard
|
|
405
|
+
try Effects.paralyze(battle, player, state, options);
|
|
406
|
+
},
|
|
407
|
+
.Thunder => {
|
|
408
|
+
_ = try canMove(battle, player, state, options);
|
|
409
|
+
try checkCriticalHit(battle, player, state, options);
|
|
410
|
+
try calcDamage(battle, player, state, options);
|
|
411
|
+
// TODO thunderaccuracy
|
|
412
|
+
try checkHit(battle, player, state, options);
|
|
413
|
+
// TODO effectchance
|
|
414
|
+
try adjustDamage(battle, player, state, options);
|
|
415
|
+
try randomizeDamage(battle, player, state, options);
|
|
416
|
+
try applyDamage(battle, player, state, options);
|
|
417
|
+
try reportOutcome(battle, player, state, options);
|
|
418
|
+
_ = try destinyBond(battle, player, state, options);
|
|
419
|
+
try buildRage(battle, player, state, options);
|
|
420
|
+
try Effects.paralyzeChance(battle, player, state, options);
|
|
421
|
+
},
|
|
422
|
+
.Earthquake => {
|
|
423
|
+
_ = try canMove(battle, player, state, options);
|
|
424
|
+
try checkCriticalHit(battle, player, state, options);
|
|
425
|
+
try calcDamage(battle, player, state, options);
|
|
426
|
+
try adjustDamage(battle, player, state, options);
|
|
427
|
+
try randomizeDamage(battle, player, state, options);
|
|
428
|
+
// TODO doubleundergrounddamage
|
|
429
|
+
try checkHit(battle, player, state, options);
|
|
430
|
+
// TODO effectchance
|
|
431
|
+
try applyDamage(battle, player, state, options);
|
|
432
|
+
try reportOutcome(battle, player, state, options);
|
|
433
|
+
_ = try destinyBond(battle, player, state, options);
|
|
434
|
+
try buildRage(battle, player, state, options);
|
|
435
|
+
},
|
|
436
|
+
.Rage => {
|
|
437
|
+
_ = try canMove(battle, player, state, options);
|
|
438
|
+
try checkCriticalHit(battle, player, state, options);
|
|
439
|
+
try calcDamage(battle, player, state, options);
|
|
440
|
+
try adjustDamage(battle, player, state, options);
|
|
441
|
+
try checkHit(battle, player, state, options);
|
|
442
|
+
|
|
443
|
+
// ragedamage
|
|
444
|
+
assert(volatiles.Rage);
|
|
445
|
+
state.damage *|= (volatiles.rage +| 1);
|
|
446
|
+
|
|
447
|
+
try randomizeDamage(battle, player, state, options);
|
|
448
|
+
// TODO failuretext
|
|
449
|
+
try Effects.rage(battle, player, state, options);
|
|
450
|
+
try applyDamage(battle, player, state, options);
|
|
451
|
+
try reportOutcome(battle, player, state, options);
|
|
452
|
+
_ = try destinyBond(battle, player, state, options);
|
|
453
|
+
try buildRage(battle, player, state, options);
|
|
454
|
+
try kingsRock(battle, player, state, options);
|
|
455
|
+
},
|
|
456
|
+
.Teleport => {
|
|
457
|
+
_ = try canMove(battle, player, state, options);
|
|
458
|
+
try Effects.teleport(battle, player, state, options);
|
|
459
|
+
},
|
|
460
|
+
.Mimic => {
|
|
461
|
+
_ = try canMove(battle, player, state, options);
|
|
462
|
+
try checkHit(battle, player, state, options);
|
|
463
|
+
try Effects.mimic(battle, player, state, options);
|
|
464
|
+
},
|
|
465
|
+
.Heal => {
|
|
466
|
+
_ = try canMove(battle, player, state, options);
|
|
467
|
+
try Effects.heal(battle, player, state, options);
|
|
468
|
+
},
|
|
469
|
+
.Haze => {
|
|
470
|
+
_ = try canMove(battle, player, state, options);
|
|
471
|
+
try Effects.haze(battle, player, state, options);
|
|
472
|
+
},
|
|
473
|
+
.LightScreen, .Reflect => {
|
|
474
|
+
_ = try canMove(battle, player, state, options);
|
|
475
|
+
try Effects.screens(battle, player, state, options);
|
|
476
|
+
},
|
|
477
|
+
.FocusEnergy => {
|
|
478
|
+
_ = try canMove(battle, player, state, options);
|
|
479
|
+
try Effects.focusEnergy(battle, player, state, options);
|
|
480
|
+
},
|
|
481
|
+
.Bide => {
|
|
482
|
+
// TODO storeenergy
|
|
483
|
+
// doturn
|
|
484
|
+
const charging = false; // TODO
|
|
485
|
+
const skip_pp = charging or state.move == .Struggle or
|
|
486
|
+
(volatiles.BeatUp or volatiles.Thrashing or volatiles.Bide);
|
|
487
|
+
if (!skip_pp) _ = decrementPP(side, state.move, state.mslot); // TODO if no pp return
|
|
488
|
+
// usedmovetext
|
|
489
|
+
try log.move(ident, state.move, foe_ident); // FIXME self? from?
|
|
490
|
+
// TODO unleashenergy
|
|
491
|
+
// TODO resettypematchup
|
|
492
|
+
try checkHit(battle, player, state, options);
|
|
493
|
+
// TODO bidefailtext
|
|
494
|
+
try applyDamage(battle, player, state, options);
|
|
495
|
+
_ = try destinyBond(battle, player, state, options);
|
|
496
|
+
try buildRage(battle, player, state, options);
|
|
497
|
+
try kingsRock(battle, player, state, options);
|
|
498
|
+
},
|
|
499
|
+
.Metronome => {
|
|
500
|
+
_ = try canMove(battle, player, state, options);
|
|
501
|
+
try Effects.metronome(battle, player, state, options);
|
|
502
|
+
},
|
|
503
|
+
.MirrorMove => {
|
|
504
|
+
_ = try canMove(battle, player, state, options);
|
|
505
|
+
try Effects.mirrorMove(battle, player, state, options);
|
|
506
|
+
},
|
|
507
|
+
.Explode => {
|
|
508
|
+
_ = try canMove(battle, player, state, options);
|
|
509
|
+
try checkCriticalHit(battle, player, state, options);
|
|
510
|
+
try calcDamage(battle, player, state, options);
|
|
511
|
+
try adjustDamage(battle, player, state, options);
|
|
512
|
+
try randomizeDamage(battle, player, state, options);
|
|
513
|
+
try checkHit(battle, player, state, options);
|
|
514
|
+
try Effects.explode(battle, player, state, options);
|
|
515
|
+
try applyDamage(battle, player, state, options);
|
|
516
|
+
try reportOutcome(battle, player, state, options);
|
|
517
|
+
_ = try destinyBond(battle, player, state, options);
|
|
518
|
+
try buildRage(battle, player, state, options);
|
|
519
|
+
try kingsRock(battle, player, state, options);
|
|
520
|
+
},
|
|
521
|
+
.SkullBash => {
|
|
522
|
+
_ = try canCharge(battle, player, state, options);
|
|
523
|
+
try checkCriticalHit(battle, player, state, options);
|
|
524
|
+
try calcDamage(battle, player, state, options);
|
|
525
|
+
try adjustDamage(battle, player, state, options);
|
|
526
|
+
try randomizeDamage(battle, player, state, options);
|
|
527
|
+
try checkHit(battle, player, state, options);
|
|
528
|
+
try applyDamage(battle, player, state, options);
|
|
529
|
+
try reportOutcome(battle, player, state, options);
|
|
530
|
+
_ = try destinyBond(battle, player, state, options);
|
|
531
|
+
try buildRage(battle, player, state, options);
|
|
532
|
+
try kingsRock(battle, player, state, options);
|
|
533
|
+
// TODO endturn
|
|
534
|
+
try Effects.boost(battle, player, state, options);
|
|
535
|
+
},
|
|
536
|
+
.SkyAttack => {
|
|
537
|
+
_ = try canCharge(battle, player, state, options);
|
|
538
|
+
try checkCriticalHit(battle, player, state, options);
|
|
539
|
+
try calcDamage(battle, player, state, options);
|
|
540
|
+
try adjustDamage(battle, player, state, options);
|
|
541
|
+
try randomizeDamage(battle, player, state, options);
|
|
542
|
+
try checkHit(battle, player, state, options);
|
|
543
|
+
// TODO effectchance
|
|
544
|
+
try applyDamage(battle, player, state, options);
|
|
545
|
+
try reportOutcome(battle, player, state, options);
|
|
546
|
+
_ = try destinyBond(battle, player, state, options);
|
|
547
|
+
try buildRage(battle, player, state, options);
|
|
548
|
+
try Effects.flinchChance(battle, player, state, options);
|
|
549
|
+
try kingsRock(battle, player, state, options);
|
|
550
|
+
},
|
|
551
|
+
.Transform => {
|
|
552
|
+
_ = try canMove(battle, player, state, options);
|
|
553
|
+
try Effects.transform(battle, player, state, options);
|
|
554
|
+
},
|
|
555
|
+
.Splash => {
|
|
556
|
+
_ = try canMove(battle, player, state, options);
|
|
557
|
+
try Effects.splash(battle, player, state, options);
|
|
558
|
+
},
|
|
559
|
+
.Conversion => {
|
|
560
|
+
_ = try canMove(battle, player, state, options);
|
|
561
|
+
try Effects.conversion(battle, player, state, options);
|
|
562
|
+
},
|
|
563
|
+
.TriAttack => {
|
|
564
|
+
_ = try canMove(battle, player, state, options);
|
|
565
|
+
try checkCriticalHit(battle, player, state, options);
|
|
566
|
+
try calcDamage(battle, player, state, options);
|
|
567
|
+
try adjustDamage(battle, player, state, options);
|
|
568
|
+
try randomizeDamage(battle, player, state, options);
|
|
569
|
+
try checkHit(battle, player, state, options);
|
|
570
|
+
try applyDamage(battle, player, state, options);
|
|
571
|
+
try reportOutcome(battle, player, state, options);
|
|
572
|
+
_ = try destinyBond(battle, player, state, options);
|
|
573
|
+
try buildRage(battle, player, state, options);
|
|
574
|
+
try Effects.triAttack(battle, player, state, options);
|
|
575
|
+
},
|
|
576
|
+
.Substitute => {
|
|
577
|
+
_ = try canMove(battle, player, state, options);
|
|
578
|
+
try Effects.substitute(battle, player, state, options);
|
|
579
|
+
},
|
|
580
|
+
.Sketch => {
|
|
581
|
+
_ = try canMove(battle, player, state, options);
|
|
582
|
+
try Effects.sketch(battle, player, state, options);
|
|
583
|
+
},
|
|
584
|
+
.TripleKick => {
|
|
585
|
+
_ = try canMove(battle, player, state, options);
|
|
586
|
+
// TODO startloop
|
|
587
|
+
try checkHit(battle, player, state, options);
|
|
588
|
+
try checkCriticalHit(battle, player, state, options);
|
|
589
|
+
try calcDamage(battle, player, state, options);
|
|
590
|
+
try Effects.tripleKick(battle, player, state, options);
|
|
591
|
+
try adjustDamage(battle, player, state, options);
|
|
592
|
+
try randomizeDamage(battle, player, state, options);
|
|
593
|
+
// TODO clearmissdamage
|
|
594
|
+
try applyDamage(battle, player, state, options);
|
|
595
|
+
// TODO critsupereffectivelooptext
|
|
596
|
+
_ = try destinyBond(battle, player, state, options);
|
|
597
|
+
try buildRage(battle, player, state, options);
|
|
598
|
+
// TODO kickcounter
|
|
599
|
+
// TODO endloop
|
|
600
|
+
try kingsRock(battle, player, state, options);
|
|
601
|
+
},
|
|
602
|
+
.Thief => {
|
|
603
|
+
_ = try canMove(battle, player, state, options);
|
|
604
|
+
try checkCriticalHit(battle, player, state, options);
|
|
605
|
+
try calcDamage(battle, player, state, options);
|
|
606
|
+
try adjustDamage(battle, player, state, options);
|
|
607
|
+
try randomizeDamage(battle, player, state, options);
|
|
608
|
+
try checkHit(battle, player, state, options);
|
|
609
|
+
// TODO effectchance
|
|
610
|
+
try applyDamage(battle, player, state, options);
|
|
611
|
+
try reportOutcome(battle, player, state, options);
|
|
612
|
+
try Effects.thief(battle, player, state, options);
|
|
613
|
+
_ = try destinyBond(battle, player, state, options);
|
|
614
|
+
try buildRage(battle, player, state, options);
|
|
615
|
+
try kingsRock(battle, player, state, options);
|
|
616
|
+
},
|
|
617
|
+
.MeanLook => {
|
|
618
|
+
_ = try canMove(battle, player, state, options);
|
|
619
|
+
try Effects.meanLook(battle, player, state, options);
|
|
620
|
+
},
|
|
621
|
+
.LockOn => {
|
|
622
|
+
_ = try canMove(battle, player, state, options);
|
|
623
|
+
try checkHit(battle, player, state, options);
|
|
624
|
+
try Effects.lockOn(battle, player, state, options);
|
|
625
|
+
},
|
|
626
|
+
.Nightmare => {
|
|
627
|
+
_ = try canMove(battle, player, state, options);
|
|
628
|
+
try Effects.nightmare(battle, player, state, options);
|
|
629
|
+
},
|
|
630
|
+
.Snore => {
|
|
631
|
+
_ = try canMove(battle, player, state, options);
|
|
632
|
+
try checkCriticalHit(battle, player, state, options);
|
|
633
|
+
try calcDamage(battle, player, state, options);
|
|
634
|
+
try adjustDamage(battle, player, state, options);
|
|
635
|
+
try randomizeDamage(battle, player, state, options);
|
|
636
|
+
try checkHit(battle, player, state, options);
|
|
637
|
+
// TODO effectchance
|
|
638
|
+
try Effects.snore(battle, player, state, options);
|
|
639
|
+
try applyDamage(battle, player, state, options);
|
|
640
|
+
try reportOutcome(battle, player, state, options);
|
|
641
|
+
_ = try destinyBond(battle, player, state, options);
|
|
642
|
+
try buildRage(battle, player, state, options);
|
|
643
|
+
try Effects.flinchChance(battle, player, state, options);
|
|
644
|
+
try kingsRock(battle, player, state, options);
|
|
645
|
+
},
|
|
646
|
+
.Curse => {
|
|
647
|
+
_ = try canMove(battle, player, state, options);
|
|
648
|
+
try Effects.curse(battle, player, state, options);
|
|
649
|
+
},
|
|
650
|
+
.Reversal => {
|
|
651
|
+
_ = try canMove(battle, player, state, options);
|
|
652
|
+
try Effects.reversal(battle, player, state, options);
|
|
653
|
+
try adjustDamage(battle, player, state, options);
|
|
654
|
+
try checkHit(battle, player, state, options);
|
|
655
|
+
try applyDamage(battle, player, state, options);
|
|
656
|
+
// TODO reversalsupereffectivetext
|
|
657
|
+
_ = try destinyBond(battle, player, state, options);
|
|
658
|
+
try buildRage(battle, player, state, options);
|
|
659
|
+
try kingsRock(battle, player, state, options);
|
|
660
|
+
},
|
|
661
|
+
.Conversion2 => {
|
|
662
|
+
_ = try canMove(battle, player, state, options);
|
|
663
|
+
try checkHit(battle, player, state, options);
|
|
664
|
+
try Effects.conversion2(battle, player, state, options);
|
|
665
|
+
},
|
|
666
|
+
.Spite => {
|
|
667
|
+
_ = try canMove(battle, player, state, options);
|
|
668
|
+
try checkHit(battle, player, state, options);
|
|
669
|
+
try Effects.spite(battle, player, state, options);
|
|
670
|
+
},
|
|
671
|
+
.Endure, .Protect => {
|
|
672
|
+
_ = try canMove(battle, player, state, options);
|
|
673
|
+
try Effects.protect(battle, player, state, options);
|
|
674
|
+
},
|
|
675
|
+
.BellyDrum => {
|
|
676
|
+
_ = try canMove(battle, player, state, options);
|
|
677
|
+
try Effects.bellyDrum(battle, player, state, options);
|
|
678
|
+
},
|
|
679
|
+
.Spikes => {
|
|
680
|
+
_ = try canMove(battle, player, state, options);
|
|
681
|
+
try Effects.spikes(battle, player, state, options);
|
|
682
|
+
},
|
|
683
|
+
.Foresight => {
|
|
684
|
+
_ = try canMove(battle, player, state, options);
|
|
685
|
+
try checkHit(battle, player, state, options);
|
|
686
|
+
try Effects.foresight(battle, player, state, options);
|
|
687
|
+
},
|
|
688
|
+
.DestinyBond => {
|
|
689
|
+
_ = try canMove(battle, player, state, options);
|
|
690
|
+
try Effects.destinyBond(battle, player, state, options);
|
|
691
|
+
},
|
|
692
|
+
.PerishSong => {
|
|
693
|
+
_ = try canMove(battle, player, state, options);
|
|
694
|
+
try Effects.perishSong(battle, player, state, options);
|
|
695
|
+
},
|
|
696
|
+
.Sandstorm => {
|
|
697
|
+
_ = try canMove(battle, player, state, options);
|
|
698
|
+
try Effects.sandstorm(battle, player, state, options);
|
|
699
|
+
},
|
|
700
|
+
.Rollout => {
|
|
701
|
+
// TODO checkcurl
|
|
702
|
+
// doturn
|
|
703
|
+
const charging = false; // TODO
|
|
704
|
+
const skip_pp = charging or state.move == .Struggle or
|
|
705
|
+
(volatiles.BeatUp or volatiles.Thrashing or volatiles.Bide);
|
|
706
|
+
if (!skip_pp) _ = decrementPP(side, state.move, state.mslot); // TODO if no pp return
|
|
707
|
+
// usedmovetext
|
|
708
|
+
try log.move(ident, state.move, foe_ident); // FIXME self? from?
|
|
709
|
+
try checkCriticalHit(battle, player, state, options);
|
|
710
|
+
try calcDamage(battle, player, state, options);
|
|
711
|
+
try adjustDamage(battle, player, state, options);
|
|
712
|
+
try checkHit(battle, player, state, options);
|
|
713
|
+
// TODO rolloutpower
|
|
714
|
+
try randomizeDamage(battle, player, state, options);
|
|
715
|
+
try applyDamage(battle, player, state, options);
|
|
716
|
+
try reportOutcome(battle, player, state, options);
|
|
717
|
+
_ = try destinyBond(battle, player, state, options);
|
|
718
|
+
try buildRage(battle, player, state, options);
|
|
719
|
+
try kingsRock(battle, player, state, options);
|
|
720
|
+
},
|
|
721
|
+
.FalseSwipe => {
|
|
722
|
+
_ = try canMove(battle, player, state, options);
|
|
723
|
+
try checkCriticalHit(battle, player, state, options);
|
|
724
|
+
try calcDamage(battle, player, state, options);
|
|
725
|
+
try adjustDamage(battle, player, state, options);
|
|
726
|
+
try randomizeDamage(battle, player, state, options);
|
|
727
|
+
try Effects.falseSwipe(battle, player, state, options);
|
|
728
|
+
try checkHit(battle, player, state, options);
|
|
729
|
+
try applyDamage(battle, player, state, options);
|
|
730
|
+
try reportOutcome(battle, player, state, options);
|
|
731
|
+
_ = try destinyBond(battle, player, state, options);
|
|
732
|
+
try buildRage(battle, player, state, options);
|
|
733
|
+
try kingsRock(battle, player, state, options);
|
|
734
|
+
},
|
|
735
|
+
.Swagger => {
|
|
736
|
+
_ = try canMove(battle, player, state, options);
|
|
737
|
+
try checkHit(battle, player, state, options);
|
|
738
|
+
// TODO switchturn
|
|
739
|
+
// TODO attackup2
|
|
740
|
+
// TODO switchturn
|
|
741
|
+
// TODO failuretext
|
|
742
|
+
// TODO switchturn
|
|
743
|
+
// TODO switchturn
|
|
744
|
+
try Effects.confusionChance(battle, player, state, options);
|
|
745
|
+
},
|
|
746
|
+
.FuryCutter => {
|
|
747
|
+
_ = try canMove(battle, player, state, options);
|
|
748
|
+
try checkCriticalHit(battle, player, state, options);
|
|
749
|
+
try calcDamage(battle, player, state, options);
|
|
750
|
+
try adjustDamage(battle, player, state, options);
|
|
751
|
+
try checkHit(battle, player, state, options);
|
|
752
|
+
try Effects.furyCutter(battle, player, state, options);
|
|
753
|
+
try randomizeDamage(battle, player, state, options);
|
|
754
|
+
try applyDamage(battle, player, state, options);
|
|
755
|
+
try reportOutcome(battle, player, state, options);
|
|
756
|
+
_ = try destinyBond(battle, player, state, options);
|
|
757
|
+
try buildRage(battle, player, state, options);
|
|
758
|
+
try kingsRock(battle, player, state, options);
|
|
759
|
+
},
|
|
760
|
+
.Attract => {
|
|
761
|
+
_ = try canMove(battle, player, state, options);
|
|
762
|
+
try checkHit(battle, player, state, options);
|
|
763
|
+
try Effects.attract(battle, player, state, options);
|
|
764
|
+
},
|
|
765
|
+
.SleepTalk => {
|
|
766
|
+
_ = try canMove(battle, player, state, options);
|
|
767
|
+
try Effects.sleepTalk(battle, player, state, options);
|
|
768
|
+
},
|
|
769
|
+
.HealBell => {
|
|
770
|
+
_ = try canMove(battle, player, state, options);
|
|
771
|
+
try Effects.healBell(battle, player, state, options);
|
|
772
|
+
},
|
|
773
|
+
.Frustration, .Return => {
|
|
774
|
+
_ = try canMove(battle, player, state, options);
|
|
775
|
+
try checkCriticalHit(battle, player, state, options);
|
|
776
|
+
try Effects.happiness(battle, player, state, options);
|
|
777
|
+
try calcDamage(battle, player, state, options);
|
|
778
|
+
try adjustDamage(battle, player, state, options);
|
|
779
|
+
try randomizeDamage(battle, player, state, options);
|
|
780
|
+
try checkHit(battle, player, state, options);
|
|
781
|
+
try applyDamage(battle, player, state, options);
|
|
782
|
+
try reportOutcome(battle, player, state, options);
|
|
783
|
+
_ = try destinyBond(battle, player, state, options);
|
|
784
|
+
try buildRage(battle, player, state, options);
|
|
785
|
+
try kingsRock(battle, player, state, options);
|
|
786
|
+
},
|
|
787
|
+
.Present => {
|
|
788
|
+
_ = try canMove(battle, player, state, options);
|
|
789
|
+
try checkHit(battle, player, state, options);
|
|
790
|
+
try checkCriticalHit(battle, player, state, options);
|
|
791
|
+
try Effects.present(battle, player, state, options);
|
|
792
|
+
try calcDamage(battle, player, state, options);
|
|
793
|
+
try adjustDamage(battle, player, state, options);
|
|
794
|
+
try randomizeDamage(battle, player, state, options);
|
|
795
|
+
// TODO clearmissdamage
|
|
796
|
+
try applyDamage(battle, player, state, options);
|
|
797
|
+
try reportOutcome(battle, player, state, options);
|
|
798
|
+
_ = try destinyBond(battle, player, state, options);
|
|
799
|
+
try buildRage(battle, player, state, options);
|
|
800
|
+
try kingsRock(battle, player, state, options);
|
|
801
|
+
},
|
|
802
|
+
.Safeguard => {
|
|
803
|
+
_ = try canMove(battle, player, state, options);
|
|
804
|
+
try Effects.safeguard(battle, player, state, options);
|
|
805
|
+
},
|
|
806
|
+
.PainSplit => {
|
|
807
|
+
_ = try canMove(battle, player, state, options);
|
|
808
|
+
try checkHit(battle, player, state, options);
|
|
809
|
+
try Effects.painSplit(battle, player, state, options);
|
|
810
|
+
},
|
|
811
|
+
.FlameWheel, .SacredFire => {
|
|
812
|
+
_ = try canMove(battle, player, state, options);
|
|
813
|
+
try checkCriticalHit(battle, player, state, options);
|
|
814
|
+
try calcDamage(battle, player, state, options);
|
|
815
|
+
try adjustDamage(battle, player, state, options);
|
|
816
|
+
try randomizeDamage(battle, player, state, options);
|
|
817
|
+
try checkHit(battle, player, state, options);
|
|
818
|
+
// TODO effectchance
|
|
819
|
+
try applyDamage(battle, player, state, options);
|
|
820
|
+
try reportOutcome(battle, player, state, options);
|
|
821
|
+
try Effects.defrost(battle, player, state, options);
|
|
822
|
+
_ = try destinyBond(battle, player, state, options);
|
|
823
|
+
try buildRage(battle, player, state, options);
|
|
824
|
+
try Effects.burnChance(battle, player, state, options);
|
|
825
|
+
},
|
|
826
|
+
.Magnitude => {
|
|
827
|
+
_ = try canMove(battle, player, state, options);
|
|
828
|
+
try checkCriticalHit(battle, player, state, options);
|
|
829
|
+
// TODO getmagnitude
|
|
830
|
+
try calcDamage(battle, player, state, options);
|
|
831
|
+
try adjustDamage(battle, player, state, options);
|
|
832
|
+
try randomizeDamage(battle, player, state, options);
|
|
833
|
+
try checkHit(battle, player, state, options);
|
|
834
|
+
// TODO doubleundergrounddamage
|
|
835
|
+
try applyDamage(battle, player, state, options);
|
|
836
|
+
try reportOutcome(battle, player, state, options);
|
|
837
|
+
_ = try destinyBond(battle, player, state, options);
|
|
838
|
+
try buildRage(battle, player, state, options);
|
|
839
|
+
try kingsRock(battle, player, state, options);
|
|
840
|
+
},
|
|
841
|
+
.BatonPass => {
|
|
842
|
+
_ = try canMove(battle, player, state, options);
|
|
843
|
+
try Effects.batonPass(battle, player, state, options);
|
|
844
|
+
},
|
|
845
|
+
.Encore => {
|
|
846
|
+
_ = try canMove(battle, player, state, options);
|
|
847
|
+
try checkHit(battle, player, state, options);
|
|
848
|
+
try Effects.encore(battle, player, state, options);
|
|
849
|
+
},
|
|
850
|
+
.Pursuit => {
|
|
851
|
+
_ = try canMove(battle, player, state, options);
|
|
852
|
+
try checkCriticalHit(battle, player, state, options);
|
|
853
|
+
try calcDamage(battle, player, state, options);
|
|
854
|
+
try adjustDamage(battle, player, state, options);
|
|
855
|
+
try randomizeDamage(battle, player, state, options);
|
|
856
|
+
try Effects.pursuit(battle, player, state, options);
|
|
857
|
+
try checkHit(battle, player, state, options);
|
|
858
|
+
try applyDamage(battle, player, state, options);
|
|
859
|
+
try reportOutcome(battle, player, state, options);
|
|
860
|
+
_ = try destinyBond(battle, player, state, options);
|
|
861
|
+
try buildRage(battle, player, state, options);
|
|
862
|
+
try kingsRock(battle, player, state, options);
|
|
863
|
+
},
|
|
864
|
+
.RapidSpin => {
|
|
865
|
+
_ = try canMove(battle, player, state, options);
|
|
866
|
+
try checkCriticalHit(battle, player, state, options);
|
|
867
|
+
try calcDamage(battle, player, state, options);
|
|
868
|
+
try adjustDamage(battle, player, state, options);
|
|
869
|
+
try randomizeDamage(battle, player, state, options);
|
|
870
|
+
try checkHit(battle, player, state, options);
|
|
871
|
+
try applyDamage(battle, player, state, options);
|
|
872
|
+
try reportOutcome(battle, player, state, options);
|
|
873
|
+
try Effects.rapidSpin(battle, player, state, options);
|
|
874
|
+
_ = try destinyBond(battle, player, state, options);
|
|
875
|
+
try buildRage(battle, player, state, options);
|
|
876
|
+
try kingsRock(battle, player, state, options);
|
|
877
|
+
},
|
|
878
|
+
.MorningSun, .Synthesis, .Moonlight => {
|
|
879
|
+
_ = try canMove(battle, player, state, options);
|
|
880
|
+
try Effects.weatherHeal(battle, player, state, options);
|
|
881
|
+
},
|
|
882
|
+
.HiddenPower => {
|
|
883
|
+
_ = try canMove(battle, player, state, options);
|
|
884
|
+
try checkCriticalHit(battle, player, state, options);
|
|
885
|
+
try Effects.hiddenPower(battle, player, state, options);
|
|
886
|
+
try calcDamage(battle, player, state, options);
|
|
887
|
+
try adjustDamage(battle, player, state, options);
|
|
888
|
+
try randomizeDamage(battle, player, state, options);
|
|
889
|
+
try checkHit(battle, player, state, options);
|
|
890
|
+
try applyDamage(battle, player, state, options);
|
|
891
|
+
try reportOutcome(battle, player, state, options);
|
|
892
|
+
_ = try destinyBond(battle, player, state, options);
|
|
893
|
+
try buildRage(battle, player, state, options);
|
|
894
|
+
try kingsRock(battle, player, state, options);
|
|
895
|
+
},
|
|
896
|
+
.Twister => {
|
|
897
|
+
_ = try canMove(battle, player, state, options);
|
|
898
|
+
try checkCriticalHit(battle, player, state, options);
|
|
899
|
+
try calcDamage(battle, player, state, options);
|
|
900
|
+
try adjustDamage(battle, player, state, options);
|
|
901
|
+
try randomizeDamage(battle, player, state, options);
|
|
902
|
+
// TODO doubleflyingdamage
|
|
903
|
+
try checkHit(battle, player, state, options);
|
|
904
|
+
// TODO effectchance
|
|
905
|
+
try applyDamage(battle, player, state, options);
|
|
906
|
+
try reportOutcome(battle, player, state, options);
|
|
907
|
+
_ = try destinyBond(battle, player, state, options);
|
|
908
|
+
try buildRage(battle, player, state, options);
|
|
909
|
+
try Effects.flinchChance(battle, player, state, options);
|
|
910
|
+
},
|
|
911
|
+
.RainDance => {
|
|
912
|
+
_ = try canMove(battle, player, state, options);
|
|
913
|
+
try Effects.rainDance(battle, player, state, options);
|
|
914
|
+
},
|
|
915
|
+
.SunnyDay => {
|
|
916
|
+
_ = try canMove(battle, player, state, options);
|
|
917
|
+
try Effects.sunnyDay(battle, player, state, options);
|
|
918
|
+
},
|
|
919
|
+
.MirrorCoat => {
|
|
920
|
+
_ = try canMove(battle, player, state, options);
|
|
921
|
+
try Effects.mirrorCoat(battle, player, state, options);
|
|
922
|
+
try applyDamage(battle, player, state, options);
|
|
923
|
+
_ = try destinyBond(battle, player, state, options);
|
|
924
|
+
try buildRage(battle, player, state, options);
|
|
925
|
+
try kingsRock(battle, player, state, options);
|
|
926
|
+
},
|
|
927
|
+
.PsychUp => {
|
|
928
|
+
_ = try canMove(battle, player, state, options);
|
|
929
|
+
try Effects.psychUp(battle, player, state, options);
|
|
930
|
+
},
|
|
931
|
+
.AllStatUpChance => {
|
|
932
|
+
_ = try canMove(battle, player, state, options);
|
|
933
|
+
try checkCriticalHit(battle, player, state, options);
|
|
934
|
+
try calcDamage(battle, player, state, options);
|
|
935
|
+
try adjustDamage(battle, player, state, options);
|
|
936
|
+
try randomizeDamage(battle, player, state, options);
|
|
937
|
+
try checkHit(battle, player, state, options);
|
|
938
|
+
// TODO effectchance
|
|
939
|
+
try applyDamage(battle, player, state, options);
|
|
940
|
+
try reportOutcome(battle, player, state, options);
|
|
941
|
+
_ = try destinyBond(battle, player, state, options);
|
|
942
|
+
try buildRage(battle, player, state, options);
|
|
943
|
+
try Effects.allStatUpChance(battle, player, state, options);
|
|
944
|
+
},
|
|
945
|
+
.FutureSight => {
|
|
946
|
+
// TODO checkfuturesight
|
|
947
|
+
_ = try canMove(battle, player, state, options);
|
|
948
|
+
try calcDamage(battle, player, state, options);
|
|
949
|
+
try Effects.futureSight(battle, player, state, options);
|
|
950
|
+
try randomizeDamage(battle, player, state, options);
|
|
951
|
+
try checkHit(battle, player, state, options);
|
|
952
|
+
try applyDamage(battle, player, state, options);
|
|
953
|
+
_ = try destinyBond(battle, player, state, options);
|
|
954
|
+
try buildRage(battle, player, state, options);
|
|
955
|
+
},
|
|
956
|
+
.BeatUp => {
|
|
957
|
+
_ = try canMove(battle, player, state, options);
|
|
958
|
+
// TODO startloop
|
|
959
|
+
try checkHit(battle, player, state, options);
|
|
960
|
+
try checkCriticalHit(battle, player, state, options);
|
|
961
|
+
try Effects.beatUp(battle, player, state, options);
|
|
962
|
+
try randomizeDamage(battle, player, state, options);
|
|
963
|
+
// TODO clearmissdamage
|
|
964
|
+
try applyDamage(battle, player, state, options);
|
|
965
|
+
try reportOutcome(battle, player, state, options);
|
|
966
|
+
_ = try destinyBond(battle, player, state, options);
|
|
967
|
+
try buildRage(battle, player, state, options);
|
|
968
|
+
// TODO endloop
|
|
969
|
+
// TODO beatupfailtext
|
|
970
|
+
try kingsRock(battle, player, state, options);
|
|
971
|
+
},
|
|
972
|
+
// zig fmt: off
|
|
973
|
+
.AttackUp1, .AttackUp2, .DefenseCurl, .DefenseUp1, .DefenseUp2,
|
|
974
|
+
.EvasionUp1, .SpAtkUp1, .SpDefUp2, .SpeedUp2 => {
|
|
975
|
+
// zig fmt: on
|
|
976
|
+
_ = try canMove(battle, player, state, options);
|
|
977
|
+
try Effects.boost(battle, player, state, options);
|
|
978
|
+
if (effect == .DefenseCurl) try Effects.defenseCurl(battle, player, state, options);
|
|
979
|
+
},
|
|
980
|
+
.AttackUpChance, .DefenseUpChance => {
|
|
981
|
+
_ = try canMove(battle, player, state, options);
|
|
982
|
+
try checkCriticalHit(battle, player, state, options);
|
|
983
|
+
try calcDamage(battle, player, state, options);
|
|
984
|
+
try adjustDamage(battle, player, state, options);
|
|
985
|
+
try randomizeDamage(battle, player, state, options);
|
|
986
|
+
try checkHit(battle, player, state, options);
|
|
987
|
+
// TODO effectchance
|
|
988
|
+
try applyDamage(battle, player, state, options);
|
|
989
|
+
try reportOutcome(battle, player, state, options);
|
|
990
|
+
_ = try destinyBond(battle, player, state, options);
|
|
991
|
+
try buildRage(battle, player, state, options);
|
|
992
|
+
try Effects.boost(battle, player, state, options);
|
|
993
|
+
},
|
|
994
|
+
// zig fmt: off
|
|
995
|
+
.AccuracyDown1, .AttackDown1, .AttackDown2, .DefenseDown1,
|
|
996
|
+
.DefenseDown2, .EvasionDown1, .SpeedDown1, .SpeedDown2 => {
|
|
997
|
+
// zig fmt: on
|
|
998
|
+
_ = try canMove(battle, player, state, options);
|
|
999
|
+
try checkHit(battle, player, state, options);
|
|
1000
|
+
try Effects.unboost(battle, player, state, options);
|
|
1001
|
+
},
|
|
1002
|
+
// zig fmt: off
|
|
1003
|
+
.AccuracyDownChance, .AttackDownChance, .DefenseDownChance,
|
|
1004
|
+
.SpDefDownChance, .SpeedDownChance => {
|
|
1005
|
+
// zig fmt: on
|
|
1006
|
+
_ = try canMove(battle, player, state, options);
|
|
1007
|
+
try checkCriticalHit(battle, player, state, options);
|
|
1008
|
+
try calcDamage(battle, player, state, options);
|
|
1009
|
+
try adjustDamage(battle, player, state, options);
|
|
1010
|
+
try randomizeDamage(battle, player, state, options);
|
|
1011
|
+
try checkHit(battle, player, state, options);
|
|
1012
|
+
// TODO effectchance
|
|
1013
|
+
try applyDamage(battle, player, state, options);
|
|
1014
|
+
try reportOutcome(battle, player, state, options);
|
|
1015
|
+
_ = try destinyBond(battle, player, state, options);
|
|
1016
|
+
try buildRage(battle, player, state, options);
|
|
1017
|
+
// TODO if (effect == .DefenseDownChance) effectchance
|
|
1018
|
+
try Effects.unboost(battle, player, state, options);
|
|
1019
|
+
},
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
return null;
|
|
1023
|
+
}
|