@pkmn/engine 0.1.0-dev.028ab165

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 (62) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +343 -0
  3. package/build/pkg/addon.d.ts +7 -0
  4. package/build/pkg/addon.js +112 -0
  5. package/build/pkg/addon.js.map +1 -0
  6. package/build/pkg/data/ids.json +240 -0
  7. package/build/pkg/data/layout.json +108 -0
  8. package/build/pkg/data/protocol.json +230 -0
  9. package/build/pkg/data.d.ts +91 -0
  10. package/build/pkg/data.js +150 -0
  11. package/build/pkg/data.js.map +1 -0
  12. package/build/pkg/gen1.d.ts +110 -0
  13. package/build/pkg/gen1.js +684 -0
  14. package/build/pkg/gen1.js.map +1 -0
  15. package/build/pkg/index.d.ts +386 -0
  16. package/build/pkg/index.js +122 -0
  17. package/build/pkg/index.js.map +1 -0
  18. package/build/pkg/protocol.d.ts +73 -0
  19. package/build/pkg/protocol.js +473 -0
  20. package/build/pkg/protocol.js.map +1 -0
  21. package/build/test/display.js +400 -0
  22. package/build/test/display.js.map +1 -0
  23. package/build/tools/debug.js +135 -0
  24. package/build/tools/debug.js.map +1 -0
  25. package/build.zig +371 -0
  26. package/package.json +224 -0
  27. package/src/bin/install-pkmn-engine +396 -0
  28. package/src/bin/pkmn-debug +62 -0
  29. package/src/lib/binding/node.zig +134 -0
  30. package/src/lib/binding/wasm.zig +12 -0
  31. package/src/lib/common/battle.zig +17 -0
  32. package/src/lib/common/data.zig +117 -0
  33. package/src/lib/common/debug.zig +74 -0
  34. package/src/lib/common/js.zig +118 -0
  35. package/src/lib/common/optional.zig +67 -0
  36. package/src/lib/common/options.zig +49 -0
  37. package/src/lib/common/protocol.zig +1841 -0
  38. package/src/lib/common/rational.zig +353 -0
  39. package/src/lib/common/rng.zig +243 -0
  40. package/src/lib/common/util.zig +12 -0
  41. package/src/lib/gen1/README.md +894 -0
  42. package/src/lib/gen1/calc.zig +426 -0
  43. package/src/lib/gen1/chance.zig +1060 -0
  44. package/src/lib/gen1/data/moves.zig +1866 -0
  45. package/src/lib/gen1/data/species.zig +1105 -0
  46. package/src/lib/gen1/data/types.zig +131 -0
  47. package/src/lib/gen1/data.zig +634 -0
  48. package/src/lib/gen1/helpers.zig +779 -0
  49. package/src/lib/gen1/mechanics.zig +3128 -0
  50. package/src/lib/gen2/README.md +329 -0
  51. package/src/lib/gen2/calc.zig +143 -0
  52. package/src/lib/gen2/chance.zig +1314 -0
  53. package/src/lib/gen2/data/items.zig +230 -0
  54. package/src/lib/gen2/data/moves.zig +2878 -0
  55. package/src/lib/gen2/data/species.zig +1798 -0
  56. package/src/lib/gen2/data/types.zig +226 -0
  57. package/src/lib/gen2/data.zig +463 -0
  58. package/src/lib/gen2/generated.zig +808 -0
  59. package/src/lib/gen2/helpers.zig +219 -0
  60. package/src/lib/gen2/mechanics.zig +3551 -0
  61. package/src/lib/pkmn.zig +113 -0
  62. package/src/test/display/pkmn.html.tmpl +368 -0
@@ -0,0 +1,1866 @@
1
+ //! Code generated by `tools/generate` - manual edits will be overwritten.
2
+
3
+ const std = @import("std");
4
+
5
+ const rng = @import("../../common/rng.zig");
6
+ const gen1 = @import("../../gen1/data.zig");
7
+
8
+ const assert = std.debug.assert;
9
+
10
+ const percent = rng.Gen12.percent;
11
+ const Type = gen1.Type;
12
+
13
+ /// Representation of a Generation I Pokémon move.
14
+ pub const Move = enum(u8) {
15
+ None,
16
+ Pound,
17
+ KarateChop,
18
+ DoubleSlap,
19
+ CometPunch,
20
+ MegaPunch,
21
+ PayDay,
22
+ FirePunch,
23
+ IcePunch,
24
+ ThunderPunch,
25
+ Scratch,
26
+ ViseGrip,
27
+ Guillotine,
28
+ RazorWind,
29
+ SwordsDance,
30
+ Cut,
31
+ Gust,
32
+ WingAttack,
33
+ Whirlwind,
34
+ Fly,
35
+ Bind,
36
+ Slam,
37
+ VineWhip,
38
+ Stomp,
39
+ DoubleKick,
40
+ MegaKick,
41
+ JumpKick,
42
+ RollingKick,
43
+ SandAttack,
44
+ Headbutt,
45
+ HornAttack,
46
+ FuryAttack,
47
+ HornDrill,
48
+ Tackle,
49
+ BodySlam,
50
+ Wrap,
51
+ TakeDown,
52
+ Thrash,
53
+ DoubleEdge,
54
+ TailWhip,
55
+ PoisonSting,
56
+ Twineedle,
57
+ PinMissile,
58
+ Leer,
59
+ Bite,
60
+ Growl,
61
+ Roar,
62
+ Sing,
63
+ Supersonic,
64
+ SonicBoom,
65
+ Disable,
66
+ Acid,
67
+ Ember,
68
+ Flamethrower,
69
+ Mist,
70
+ WaterGun,
71
+ HydroPump,
72
+ Surf,
73
+ IceBeam,
74
+ Blizzard,
75
+ Psybeam,
76
+ BubbleBeam,
77
+ AuroraBeam,
78
+ HyperBeam,
79
+ Peck,
80
+ DrillPeck,
81
+ Submission,
82
+ LowKick,
83
+ Counter,
84
+ SeismicToss,
85
+ Strength,
86
+ Absorb,
87
+ MegaDrain,
88
+ LeechSeed,
89
+ Growth,
90
+ RazorLeaf,
91
+ SolarBeam,
92
+ PoisonPowder,
93
+ StunSpore,
94
+ SleepPowder,
95
+ PetalDance,
96
+ StringShot,
97
+ DragonRage,
98
+ FireSpin,
99
+ ThunderShock,
100
+ Thunderbolt,
101
+ ThunderWave,
102
+ Thunder,
103
+ RockThrow,
104
+ Earthquake,
105
+ Fissure,
106
+ Dig,
107
+ Toxic,
108
+ Confusion,
109
+ Psychic,
110
+ Hypnosis,
111
+ Meditate,
112
+ Agility,
113
+ QuickAttack,
114
+ Rage,
115
+ Teleport,
116
+ NightShade,
117
+ Mimic,
118
+ Screech,
119
+ DoubleTeam,
120
+ Recover,
121
+ Harden,
122
+ Minimize,
123
+ Smokescreen,
124
+ ConfuseRay,
125
+ Withdraw,
126
+ DefenseCurl,
127
+ Barrier,
128
+ LightScreen,
129
+ Haze,
130
+ Reflect,
131
+ FocusEnergy,
132
+ Bide,
133
+ Metronome,
134
+ MirrorMove,
135
+ SelfDestruct,
136
+ EggBomb,
137
+ Lick,
138
+ Smog,
139
+ Sludge,
140
+ BoneClub,
141
+ FireBlast,
142
+ Waterfall,
143
+ Clamp,
144
+ Swift,
145
+ SkullBash,
146
+ SpikeCannon,
147
+ Constrict,
148
+ Amnesia,
149
+ Kinesis,
150
+ SoftBoiled,
151
+ HighJumpKick,
152
+ Glare,
153
+ DreamEater,
154
+ PoisonGas,
155
+ Barrage,
156
+ LeechLife,
157
+ LovelyKiss,
158
+ SkyAttack,
159
+ Transform,
160
+ Bubble,
161
+ DizzyPunch,
162
+ Spore,
163
+ Flash,
164
+ Psywave,
165
+ Splash,
166
+ AcidArmor,
167
+ Crabhammer,
168
+ Explosion,
169
+ FurySwipes,
170
+ Bonemerang,
171
+ Rest,
172
+ RockSlide,
173
+ HyperFang,
174
+ Sharpen,
175
+ Conversion,
176
+ TriAttack,
177
+ SuperFang,
178
+ Slash,
179
+ Substitute,
180
+ Struggle,
181
+
182
+ // Sentinel used when Pokémon's turn should be skipped (e.g. bound)
183
+ SKIP_TURN = 0xFF,
184
+
185
+ /// Data associated with a Pokémon move.
186
+ pub const Data = packed struct(u32) {
187
+ effect: Effect,
188
+ /// The move's base PP.
189
+ bp: u8,
190
+ /// The move's accuracy percentage.
191
+ accuracy: u8,
192
+ /// The move's type.
193
+ type: Type,
194
+ /// The move's targeting behavior.
195
+ target: Target,
196
+ };
197
+
198
+ const DATA = [_]Data{
199
+ // Pound
200
+ .{
201
+ .effect = .None,
202
+ .bp = 40,
203
+ .type = .Normal,
204
+ .accuracy = percent(100),
205
+ .target = .Other,
206
+ },
207
+ // KarateChop
208
+ .{
209
+ .effect = .HighCritical,
210
+ .bp = 50,
211
+ .type = .Normal,
212
+ .accuracy = percent(100),
213
+ .target = .Other,
214
+ },
215
+ // DoubleSlap
216
+ .{
217
+ .effect = .MultiHit,
218
+ .bp = 15,
219
+ .type = .Normal,
220
+ .accuracy = percent(85),
221
+ .target = .Other,
222
+ },
223
+ // CometPunch
224
+ .{
225
+ .effect = .MultiHit,
226
+ .bp = 18,
227
+ .type = .Normal,
228
+ .accuracy = percent(85),
229
+ .target = .Other,
230
+ },
231
+ // MegaPunch
232
+ .{
233
+ .effect = .None,
234
+ .bp = 80,
235
+ .type = .Normal,
236
+ .accuracy = percent(85),
237
+ .target = .Other,
238
+ },
239
+ // PayDay
240
+ .{
241
+ .effect = .PayDay,
242
+ .bp = 40,
243
+ .type = .Normal,
244
+ .accuracy = percent(100),
245
+ .target = .Other,
246
+ },
247
+ // FirePunch
248
+ .{
249
+ .effect = .BurnChance1,
250
+ .bp = 75,
251
+ .type = .Fire,
252
+ .accuracy = percent(100),
253
+ .target = .Other,
254
+ },
255
+ // IcePunch
256
+ .{
257
+ .effect = .FreezeChance,
258
+ .bp = 75,
259
+ .type = .Ice,
260
+ .accuracy = percent(100),
261
+ .target = .Other,
262
+ },
263
+ // ThunderPunch
264
+ .{
265
+ .effect = .ParalyzeChance1,
266
+ .bp = 75,
267
+ .type = .Electric,
268
+ .accuracy = percent(100),
269
+ .target = .Other,
270
+ },
271
+ // Scratch
272
+ .{
273
+ .effect = .None,
274
+ .bp = 40,
275
+ .type = .Normal,
276
+ .accuracy = percent(100),
277
+ .target = .Other,
278
+ },
279
+ // ViseGrip
280
+ .{
281
+ .effect = .None,
282
+ .bp = 55,
283
+ .type = .Normal,
284
+ .accuracy = percent(100),
285
+ .target = .Other,
286
+ },
287
+ // Guillotine
288
+ .{
289
+ .effect = .OHKO,
290
+ .bp = 0,
291
+ .type = .Normal,
292
+ .accuracy = percent(30),
293
+ .target = .Other,
294
+ },
295
+ // RazorWind
296
+ .{
297
+ .effect = .Charge,
298
+ .bp = 80,
299
+ .type = .Normal,
300
+ .accuracy = percent(75),
301
+ .target = .Other,
302
+ },
303
+ // SwordsDance
304
+ .{
305
+ .effect = .AttackUp2,
306
+ .bp = 0,
307
+ .type = .Normal,
308
+ .accuracy = percent(100),
309
+ .target = .Self,
310
+ },
311
+ // Cut
312
+ .{
313
+ .effect = .None,
314
+ .bp = 50,
315
+ .type = .Normal,
316
+ .accuracy = percent(95),
317
+ .target = .Other,
318
+ },
319
+ // Gust
320
+ .{
321
+ .effect = .None,
322
+ .bp = 40,
323
+ .type = .Normal,
324
+ .accuracy = percent(100),
325
+ .target = .Any,
326
+ },
327
+ // WingAttack
328
+ .{
329
+ .effect = .None,
330
+ .bp = 35,
331
+ .type = .Flying,
332
+ .accuracy = percent(100),
333
+ .target = .Any,
334
+ },
335
+ // Whirlwind
336
+ .{
337
+ .effect = .SwitchAndTeleport,
338
+ .bp = 0,
339
+ .type = .Normal,
340
+ .accuracy = percent(85),
341
+ .target = .Other,
342
+ },
343
+ // Fly
344
+ .{
345
+ .effect = .Charge,
346
+ .bp = 70,
347
+ .type = .Flying,
348
+ .accuracy = percent(95),
349
+ .target = .Any,
350
+ },
351
+ // Bind
352
+ .{
353
+ .effect = .Binding,
354
+ .bp = 15,
355
+ .type = .Normal,
356
+ .accuracy = percent(75),
357
+ .target = .Other,
358
+ },
359
+ // Slam
360
+ .{
361
+ .effect = .None,
362
+ .bp = 80,
363
+ .type = .Normal,
364
+ .accuracy = percent(75),
365
+ .target = .Other,
366
+ },
367
+ // VineWhip
368
+ .{
369
+ .effect = .None,
370
+ .bp = 35,
371
+ .type = .Grass,
372
+ .accuracy = percent(100),
373
+ .target = .Other,
374
+ },
375
+ // Stomp
376
+ .{
377
+ .effect = .FlinchChance2,
378
+ .bp = 65,
379
+ .type = .Normal,
380
+ .accuracy = percent(100),
381
+ .target = .Other,
382
+ },
383
+ // DoubleKick
384
+ .{
385
+ .effect = .DoubleHit,
386
+ .bp = 30,
387
+ .type = .Fighting,
388
+ .accuracy = percent(100),
389
+ .target = .Other,
390
+ },
391
+ // MegaKick
392
+ .{
393
+ .effect = .None,
394
+ .bp = 120,
395
+ .type = .Normal,
396
+ .accuracy = percent(75),
397
+ .target = .Other,
398
+ },
399
+ // JumpKick
400
+ .{
401
+ .effect = .JumpKick,
402
+ .bp = 70,
403
+ .type = .Fighting,
404
+ .accuracy = percent(95),
405
+ .target = .Other,
406
+ },
407
+ // RollingKick
408
+ .{
409
+ .effect = .FlinchChance2,
410
+ .bp = 60,
411
+ .type = .Fighting,
412
+ .accuracy = percent(85),
413
+ .target = .Other,
414
+ },
415
+ // SandAttack
416
+ .{
417
+ .effect = .AccuracyDown1,
418
+ .bp = 0,
419
+ .type = .Normal,
420
+ .accuracy = percent(100),
421
+ .target = .Other,
422
+ },
423
+ // Headbutt
424
+ .{
425
+ .effect = .FlinchChance2,
426
+ .bp = 70,
427
+ .type = .Normal,
428
+ .accuracy = percent(100),
429
+ .target = .Other,
430
+ },
431
+ // HornAttack
432
+ .{
433
+ .effect = .None,
434
+ .bp = 65,
435
+ .type = .Normal,
436
+ .accuracy = percent(100),
437
+ .target = .Other,
438
+ },
439
+ // FuryAttack
440
+ .{
441
+ .effect = .MultiHit,
442
+ .bp = 15,
443
+ .type = .Normal,
444
+ .accuracy = percent(85),
445
+ .target = .Other,
446
+ },
447
+ // HornDrill
448
+ .{
449
+ .effect = .OHKO,
450
+ .bp = 0,
451
+ .type = .Normal,
452
+ .accuracy = percent(30),
453
+ .target = .Other,
454
+ },
455
+ // Tackle
456
+ .{
457
+ .effect = .None,
458
+ .bp = 35,
459
+ .type = .Normal,
460
+ .accuracy = percent(95),
461
+ .target = .Other,
462
+ },
463
+ // BodySlam
464
+ .{
465
+ .effect = .ParalyzeChance2,
466
+ .bp = 85,
467
+ .type = .Normal,
468
+ .accuracy = percent(100),
469
+ .target = .Other,
470
+ },
471
+ // Wrap
472
+ .{
473
+ .effect = .Binding,
474
+ .bp = 15,
475
+ .type = .Normal,
476
+ .accuracy = percent(85),
477
+ .target = .Other,
478
+ },
479
+ // TakeDown
480
+ .{
481
+ .effect = .Recoil,
482
+ .bp = 90,
483
+ .type = .Normal,
484
+ .accuracy = percent(85),
485
+ .target = .Other,
486
+ },
487
+ // Thrash
488
+ .{
489
+ .effect = .Thrashing,
490
+ .bp = 90,
491
+ .type = .Normal,
492
+ .accuracy = percent(100),
493
+ .target = .RandomFoe,
494
+ },
495
+ // DoubleEdge
496
+ .{
497
+ .effect = .Recoil,
498
+ .bp = 100,
499
+ .type = .Normal,
500
+ .accuracy = percent(100),
501
+ .target = .Other,
502
+ },
503
+ // TailWhip
504
+ .{
505
+ .effect = .DefenseDown1,
506
+ .bp = 0,
507
+ .type = .Normal,
508
+ .accuracy = percent(100),
509
+ .target = .Foes,
510
+ },
511
+ // PoisonSting
512
+ .{
513
+ .effect = .PoisonChance1,
514
+ .bp = 15,
515
+ .type = .Poison,
516
+ .accuracy = percent(100),
517
+ .target = .Other,
518
+ },
519
+ // Twineedle
520
+ .{
521
+ .effect = .Twineedle,
522
+ .bp = 25,
523
+ .type = .Bug,
524
+ .accuracy = percent(100),
525
+ .target = .Other,
526
+ },
527
+ // PinMissile
528
+ .{
529
+ .effect = .MultiHit,
530
+ .bp = 14,
531
+ .type = .Bug,
532
+ .accuracy = percent(85),
533
+ .target = .Other,
534
+ },
535
+ // Leer
536
+ .{
537
+ .effect = .DefenseDown1,
538
+ .bp = 0,
539
+ .type = .Normal,
540
+ .accuracy = percent(100),
541
+ .target = .Foes,
542
+ },
543
+ // Bite
544
+ .{
545
+ .effect = .FlinchChance1,
546
+ .bp = 60,
547
+ .type = .Normal,
548
+ .accuracy = percent(100),
549
+ .target = .Other,
550
+ },
551
+ // Growl
552
+ .{
553
+ .effect = .AttackDown1,
554
+ .bp = 0,
555
+ .type = .Normal,
556
+ .accuracy = percent(100),
557
+ .target = .Foes,
558
+ },
559
+ // Roar
560
+ .{
561
+ .effect = .SwitchAndTeleport,
562
+ .bp = 0,
563
+ .type = .Normal,
564
+ .accuracy = percent(100),
565
+ .target = .Other,
566
+ },
567
+ // Sing
568
+ .{
569
+ .effect = .Sleep,
570
+ .bp = 0,
571
+ .type = .Normal,
572
+ .accuracy = percent(55),
573
+ .target = .Other,
574
+ },
575
+ // Supersonic
576
+ .{
577
+ .effect = .Confusion,
578
+ .bp = 0,
579
+ .type = .Normal,
580
+ .accuracy = percent(55),
581
+ .target = .Other,
582
+ },
583
+ // SonicBoom
584
+ .{
585
+ .effect = .SpecialDamage,
586
+ .bp = 1,
587
+ .type = .Normal,
588
+ .accuracy = percent(90),
589
+ .target = .Other,
590
+ },
591
+ // Disable
592
+ .{
593
+ .effect = .Disable,
594
+ .bp = 0,
595
+ .type = .Normal,
596
+ .accuracy = percent(55),
597
+ .target = .Other,
598
+ },
599
+ // Acid
600
+ .{
601
+ .effect = .DefenseDownChance,
602
+ .bp = 40,
603
+ .type = .Poison,
604
+ .accuracy = percent(100),
605
+ .target = .Other,
606
+ },
607
+ // Ember
608
+ .{
609
+ .effect = .BurnChance1,
610
+ .bp = 40,
611
+ .type = .Fire,
612
+ .accuracy = percent(100),
613
+ .target = .Other,
614
+ },
615
+ // Flamethrower
616
+ .{
617
+ .effect = .BurnChance1,
618
+ .bp = 95,
619
+ .type = .Fire,
620
+ .accuracy = percent(100),
621
+ .target = .Other,
622
+ },
623
+ // Mist
624
+ .{
625
+ .effect = .Mist,
626
+ .bp = 0,
627
+ .type = .Ice,
628
+ .accuracy = percent(100),
629
+ .target = .Self,
630
+ },
631
+ // WaterGun
632
+ .{
633
+ .effect = .None,
634
+ .bp = 40,
635
+ .type = .Water,
636
+ .accuracy = percent(100),
637
+ .target = .Other,
638
+ },
639
+ // HydroPump
640
+ .{
641
+ .effect = .None,
642
+ .bp = 120,
643
+ .type = .Water,
644
+ .accuracy = percent(80),
645
+ .target = .Other,
646
+ },
647
+ // Surf
648
+ .{
649
+ .effect = .None,
650
+ .bp = 95,
651
+ .type = .Water,
652
+ .accuracy = percent(100),
653
+ .target = .Foes,
654
+ },
655
+ // IceBeam
656
+ .{
657
+ .effect = .FreezeChance,
658
+ .bp = 95,
659
+ .type = .Ice,
660
+ .accuracy = percent(100),
661
+ .target = .Other,
662
+ },
663
+ // Blizzard
664
+ .{
665
+ .effect = .FreezeChance,
666
+ .bp = 120,
667
+ .type = .Ice,
668
+ .accuracy = percent(90),
669
+ .target = .Other,
670
+ },
671
+ // Psybeam
672
+ .{
673
+ .effect = .ConfusionChance,
674
+ .bp = 65,
675
+ .type = .Psychic,
676
+ .accuracy = percent(100),
677
+ .target = .Other,
678
+ },
679
+ // BubbleBeam
680
+ .{
681
+ .effect = .SpeedDownChance,
682
+ .bp = 65,
683
+ .type = .Water,
684
+ .accuracy = percent(100),
685
+ .target = .Other,
686
+ },
687
+ // AuroraBeam
688
+ .{
689
+ .effect = .AttackDownChance,
690
+ .bp = 65,
691
+ .type = .Ice,
692
+ .accuracy = percent(100),
693
+ .target = .Other,
694
+ },
695
+ // HyperBeam
696
+ .{
697
+ .effect = .HyperBeam,
698
+ .bp = 150,
699
+ .type = .Normal,
700
+ .accuracy = percent(90),
701
+ .target = .Other,
702
+ },
703
+ // Peck
704
+ .{
705
+ .effect = .None,
706
+ .bp = 35,
707
+ .type = .Flying,
708
+ .accuracy = percent(100),
709
+ .target = .Any,
710
+ },
711
+ // DrillPeck
712
+ .{
713
+ .effect = .None,
714
+ .bp = 80,
715
+ .type = .Flying,
716
+ .accuracy = percent(100),
717
+ .target = .Any,
718
+ },
719
+ // Submission
720
+ .{
721
+ .effect = .Recoil,
722
+ .bp = 80,
723
+ .type = .Fighting,
724
+ .accuracy = percent(80),
725
+ .target = .Other,
726
+ },
727
+ // LowKick
728
+ .{
729
+ .effect = .FlinchChance2,
730
+ .bp = 50,
731
+ .type = .Fighting,
732
+ .accuracy = percent(90),
733
+ .target = .Other,
734
+ },
735
+ // Counter
736
+ .{
737
+ .effect = .None,
738
+ .bp = 1,
739
+ .type = .Fighting,
740
+ .accuracy = percent(100),
741
+ .target = .Depends,
742
+ },
743
+ // SeismicToss
744
+ .{
745
+ .effect = .SpecialDamage,
746
+ .bp = 1,
747
+ .type = .Fighting,
748
+ .accuracy = percent(100),
749
+ .target = .Other,
750
+ },
751
+ // Strength
752
+ .{
753
+ .effect = .None,
754
+ .bp = 80,
755
+ .type = .Normal,
756
+ .accuracy = percent(100),
757
+ .target = .Other,
758
+ },
759
+ // Absorb
760
+ .{
761
+ .effect = .DrainHP,
762
+ .bp = 20,
763
+ .type = .Grass,
764
+ .accuracy = percent(100),
765
+ .target = .Other,
766
+ },
767
+ // MegaDrain
768
+ .{
769
+ .effect = .DrainHP,
770
+ .bp = 40,
771
+ .type = .Grass,
772
+ .accuracy = percent(100),
773
+ .target = .Other,
774
+ },
775
+ // LeechSeed
776
+ .{
777
+ .effect = .LeechSeed,
778
+ .bp = 0,
779
+ .type = .Grass,
780
+ .accuracy = percent(90),
781
+ .target = .Other,
782
+ },
783
+ // Growth
784
+ .{
785
+ .effect = .SpecialUp1,
786
+ .bp = 0,
787
+ .type = .Normal,
788
+ .accuracy = percent(100),
789
+ .target = .Self,
790
+ },
791
+ // RazorLeaf
792
+ .{
793
+ .effect = .HighCritical,
794
+ .bp = 55,
795
+ .type = .Grass,
796
+ .accuracy = percent(95),
797
+ .target = .Other,
798
+ },
799
+ // SolarBeam
800
+ .{
801
+ .effect = .Charge,
802
+ .bp = 120,
803
+ .type = .Grass,
804
+ .accuracy = percent(100),
805
+ .target = .Other,
806
+ },
807
+ // PoisonPowder
808
+ .{
809
+ .effect = .Poison,
810
+ .bp = 0,
811
+ .type = .Poison,
812
+ .accuracy = percent(75),
813
+ .target = .Other,
814
+ },
815
+ // StunSpore
816
+ .{
817
+ .effect = .Paralyze,
818
+ .bp = 0,
819
+ .type = .Grass,
820
+ .accuracy = percent(75),
821
+ .target = .Other,
822
+ },
823
+ // SleepPowder
824
+ .{
825
+ .effect = .Sleep,
826
+ .bp = 0,
827
+ .type = .Grass,
828
+ .accuracy = percent(75),
829
+ .target = .Other,
830
+ },
831
+ // PetalDance
832
+ .{
833
+ .effect = .Thrashing,
834
+ .bp = 70,
835
+ .type = .Grass,
836
+ .accuracy = percent(100),
837
+ .target = .RandomFoe,
838
+ },
839
+ // StringShot
840
+ .{
841
+ .effect = .SpeedDown1,
842
+ .bp = 0,
843
+ .type = .Bug,
844
+ .accuracy = percent(95),
845
+ .target = .Foes,
846
+ },
847
+ // DragonRage
848
+ .{
849
+ .effect = .SpecialDamage,
850
+ .bp = 1,
851
+ .type = .Dragon,
852
+ .accuracy = percent(100),
853
+ .target = .Other,
854
+ },
855
+ // FireSpin
856
+ .{
857
+ .effect = .Binding,
858
+ .bp = 15,
859
+ .type = .Fire,
860
+ .accuracy = percent(70),
861
+ .target = .Other,
862
+ },
863
+ // ThunderShock
864
+ .{
865
+ .effect = .ParalyzeChance1,
866
+ .bp = 40,
867
+ .type = .Electric,
868
+ .accuracy = percent(100),
869
+ .target = .Other,
870
+ },
871
+ // Thunderbolt
872
+ .{
873
+ .effect = .ParalyzeChance1,
874
+ .bp = 95,
875
+ .type = .Electric,
876
+ .accuracy = percent(100),
877
+ .target = .Other,
878
+ },
879
+ // ThunderWave
880
+ .{
881
+ .effect = .Paralyze,
882
+ .bp = 0,
883
+ .type = .Electric,
884
+ .accuracy = percent(100),
885
+ .target = .Other,
886
+ },
887
+ // Thunder
888
+ .{
889
+ .effect = .ParalyzeChance1,
890
+ .bp = 120,
891
+ .type = .Electric,
892
+ .accuracy = percent(70),
893
+ .target = .Other,
894
+ },
895
+ // RockThrow
896
+ .{
897
+ .effect = .None,
898
+ .bp = 50,
899
+ .type = .Rock,
900
+ .accuracy = percent(65),
901
+ .target = .Other,
902
+ },
903
+ // Earthquake
904
+ .{
905
+ .effect = .None,
906
+ .bp = 100,
907
+ .type = .Ground,
908
+ .accuracy = percent(100),
909
+ .target = .AllOthers,
910
+ },
911
+ // Fissure
912
+ .{
913
+ .effect = .OHKO,
914
+ .bp = 0,
915
+ .type = .Ground,
916
+ .accuracy = percent(30),
917
+ .target = .Other,
918
+ },
919
+ // Dig
920
+ .{
921
+ .effect = .Charge,
922
+ .bp = 100,
923
+ .type = .Ground,
924
+ .accuracy = percent(100),
925
+ .target = .Other,
926
+ },
927
+ // Toxic
928
+ .{
929
+ .effect = .Poison,
930
+ .bp = 0,
931
+ .type = .Poison,
932
+ .accuracy = percent(85),
933
+ .target = .Other,
934
+ },
935
+ // Confusion
936
+ .{
937
+ .effect = .ConfusionChance,
938
+ .bp = 50,
939
+ .type = .Psychic,
940
+ .accuracy = percent(100),
941
+ .target = .Other,
942
+ },
943
+ // Psychic
944
+ .{
945
+ .effect = .SpecialDownChance,
946
+ .bp = 90,
947
+ .type = .Psychic,
948
+ .accuracy = percent(100),
949
+ .target = .Other,
950
+ },
951
+ // Hypnosis
952
+ .{
953
+ .effect = .Sleep,
954
+ .bp = 0,
955
+ .type = .Psychic,
956
+ .accuracy = percent(60),
957
+ .target = .Other,
958
+ },
959
+ // Meditate
960
+ .{
961
+ .effect = .AttackUp1,
962
+ .bp = 0,
963
+ .type = .Psychic,
964
+ .accuracy = percent(100),
965
+ .target = .Self,
966
+ },
967
+ // Agility
968
+ .{
969
+ .effect = .SpeedUp2,
970
+ .bp = 0,
971
+ .type = .Psychic,
972
+ .accuracy = percent(100),
973
+ .target = .Self,
974
+ },
975
+ // QuickAttack
976
+ .{
977
+ .effect = .None,
978
+ .bp = 40,
979
+ .type = .Normal,
980
+ .accuracy = percent(100),
981
+ .target = .Other,
982
+ },
983
+ // Rage
984
+ .{
985
+ .effect = .Rage,
986
+ .bp = 20,
987
+ .type = .Normal,
988
+ .accuracy = percent(100),
989
+ .target = .Other,
990
+ },
991
+ // Teleport
992
+ .{
993
+ .effect = .SwitchAndTeleport,
994
+ .bp = 0,
995
+ .type = .Psychic,
996
+ .accuracy = percent(100),
997
+ .target = .Self,
998
+ },
999
+ // NightShade
1000
+ .{
1001
+ .effect = .SpecialDamage,
1002
+ .bp = 1,
1003
+ .type = .Ghost,
1004
+ .accuracy = percent(100),
1005
+ .target = .Other,
1006
+ },
1007
+ // Mimic
1008
+ .{
1009
+ .effect = .Mimic,
1010
+ .bp = 0,
1011
+ .type = .Normal,
1012
+ .accuracy = percent(100),
1013
+ .target = .Other,
1014
+ },
1015
+ // Screech
1016
+ .{
1017
+ .effect = .DefenseDown2,
1018
+ .bp = 0,
1019
+ .type = .Normal,
1020
+ .accuracy = percent(85),
1021
+ .target = .Other,
1022
+ },
1023
+ // DoubleTeam
1024
+ .{
1025
+ .effect = .EvasionUp1,
1026
+ .bp = 0,
1027
+ .type = .Normal,
1028
+ .accuracy = percent(100),
1029
+ .target = .Self,
1030
+ },
1031
+ // Recover
1032
+ .{
1033
+ .effect = .Heal,
1034
+ .bp = 0,
1035
+ .type = .Normal,
1036
+ .accuracy = percent(100),
1037
+ .target = .Self,
1038
+ },
1039
+ // Harden
1040
+ .{
1041
+ .effect = .DefenseUp1,
1042
+ .bp = 0,
1043
+ .type = .Normal,
1044
+ .accuracy = percent(100),
1045
+ .target = .Self,
1046
+ },
1047
+ // Minimize
1048
+ .{
1049
+ .effect = .EvasionUp1,
1050
+ .bp = 0,
1051
+ .type = .Normal,
1052
+ .accuracy = percent(100),
1053
+ .target = .Self,
1054
+ },
1055
+ // Smokescreen
1056
+ .{
1057
+ .effect = .AccuracyDown1,
1058
+ .bp = 0,
1059
+ .type = .Normal,
1060
+ .accuracy = percent(100),
1061
+ .target = .Other,
1062
+ },
1063
+ // ConfuseRay
1064
+ .{
1065
+ .effect = .Confusion,
1066
+ .bp = 0,
1067
+ .type = .Ghost,
1068
+ .accuracy = percent(100),
1069
+ .target = .Other,
1070
+ },
1071
+ // Withdraw
1072
+ .{
1073
+ .effect = .DefenseUp1,
1074
+ .bp = 0,
1075
+ .type = .Water,
1076
+ .accuracy = percent(100),
1077
+ .target = .Self,
1078
+ },
1079
+ // DefenseCurl
1080
+ .{
1081
+ .effect = .DefenseUp1,
1082
+ .bp = 0,
1083
+ .type = .Normal,
1084
+ .accuracy = percent(100),
1085
+ .target = .Self,
1086
+ },
1087
+ // Barrier
1088
+ .{
1089
+ .effect = .DefenseUp2,
1090
+ .bp = 0,
1091
+ .type = .Psychic,
1092
+ .accuracy = percent(100),
1093
+ .target = .Self,
1094
+ },
1095
+ // LightScreen
1096
+ .{
1097
+ .effect = .LightScreen,
1098
+ .bp = 0,
1099
+ .type = .Psychic,
1100
+ .accuracy = percent(100),
1101
+ .target = .Self,
1102
+ },
1103
+ // Haze
1104
+ .{
1105
+ .effect = .Haze,
1106
+ .bp = 0,
1107
+ .type = .Ice,
1108
+ .accuracy = percent(100),
1109
+ .target = .Self,
1110
+ },
1111
+ // Reflect
1112
+ .{
1113
+ .effect = .Reflect,
1114
+ .bp = 0,
1115
+ .type = .Psychic,
1116
+ .accuracy = percent(100),
1117
+ .target = .Self,
1118
+ },
1119
+ // FocusEnergy
1120
+ .{
1121
+ .effect = .FocusEnergy,
1122
+ .bp = 0,
1123
+ .type = .Normal,
1124
+ .accuracy = percent(100),
1125
+ .target = .Self,
1126
+ },
1127
+ // Bide
1128
+ .{
1129
+ .effect = .Bide,
1130
+ .bp = 0,
1131
+ .type = .Normal,
1132
+ .accuracy = percent(100),
1133
+ .target = .Self,
1134
+ },
1135
+ // Metronome
1136
+ .{
1137
+ .effect = .Metronome,
1138
+ .bp = 0,
1139
+ .type = .Normal,
1140
+ .accuracy = percent(100),
1141
+ .target = .Self,
1142
+ },
1143
+ // MirrorMove
1144
+ .{
1145
+ .effect = .MirrorMove,
1146
+ .bp = 0,
1147
+ .type = .Flying,
1148
+ .accuracy = percent(100),
1149
+ .target = .Self,
1150
+ },
1151
+ // SelfDestruct
1152
+ .{
1153
+ .effect = .Explode,
1154
+ .bp = 130,
1155
+ .type = .Normal,
1156
+ .accuracy = percent(100),
1157
+ .target = .Other,
1158
+ },
1159
+ // EggBomb
1160
+ .{
1161
+ .effect = .None,
1162
+ .bp = 100,
1163
+ .type = .Normal,
1164
+ .accuracy = percent(75),
1165
+ .target = .Other,
1166
+ },
1167
+ // Lick
1168
+ .{
1169
+ .effect = .ParalyzeChance2,
1170
+ .bp = 20,
1171
+ .type = .Ghost,
1172
+ .accuracy = percent(100),
1173
+ .target = .Other,
1174
+ },
1175
+ // Smog
1176
+ .{
1177
+ .effect = .PoisonChance2,
1178
+ .bp = 20,
1179
+ .type = .Poison,
1180
+ .accuracy = percent(70),
1181
+ .target = .Other,
1182
+ },
1183
+ // Sludge
1184
+ .{
1185
+ .effect = .PoisonChance2,
1186
+ .bp = 65,
1187
+ .type = .Poison,
1188
+ .accuracy = percent(100),
1189
+ .target = .Other,
1190
+ },
1191
+ // BoneClub
1192
+ .{
1193
+ .effect = .FlinchChance1,
1194
+ .bp = 65,
1195
+ .type = .Ground,
1196
+ .accuracy = percent(85),
1197
+ .target = .Other,
1198
+ },
1199
+ // FireBlast
1200
+ .{
1201
+ .effect = .BurnChance2,
1202
+ .bp = 120,
1203
+ .type = .Fire,
1204
+ .accuracy = percent(85),
1205
+ .target = .Other,
1206
+ },
1207
+ // Waterfall
1208
+ .{
1209
+ .effect = .None,
1210
+ .bp = 80,
1211
+ .type = .Water,
1212
+ .accuracy = percent(100),
1213
+ .target = .Other,
1214
+ },
1215
+ // Clamp
1216
+ .{
1217
+ .effect = .Binding,
1218
+ .bp = 35,
1219
+ .type = .Water,
1220
+ .accuracy = percent(75),
1221
+ .target = .Other,
1222
+ },
1223
+ // Swift
1224
+ .{
1225
+ .effect = .Swift,
1226
+ .bp = 60,
1227
+ .type = .Normal,
1228
+ .accuracy = percent(100),
1229
+ .target = .Foes,
1230
+ },
1231
+ // SkullBash
1232
+ .{
1233
+ .effect = .Charge,
1234
+ .bp = 100,
1235
+ .type = .Normal,
1236
+ .accuracy = percent(100),
1237
+ .target = .Other,
1238
+ },
1239
+ // SpikeCannon
1240
+ .{
1241
+ .effect = .MultiHit,
1242
+ .bp = 20,
1243
+ .type = .Normal,
1244
+ .accuracy = percent(100),
1245
+ .target = .Other,
1246
+ },
1247
+ // Constrict
1248
+ .{
1249
+ .effect = .SpeedDownChance,
1250
+ .bp = 10,
1251
+ .type = .Normal,
1252
+ .accuracy = percent(100),
1253
+ .target = .Other,
1254
+ },
1255
+ // Amnesia
1256
+ .{
1257
+ .effect = .SpecialUp2,
1258
+ .bp = 0,
1259
+ .type = .Psychic,
1260
+ .accuracy = percent(100),
1261
+ .target = .Self,
1262
+ },
1263
+ // Kinesis
1264
+ .{
1265
+ .effect = .AccuracyDown1,
1266
+ .bp = 0,
1267
+ .type = .Psychic,
1268
+ .accuracy = percent(80),
1269
+ .target = .Other,
1270
+ },
1271
+ // SoftBoiled
1272
+ .{
1273
+ .effect = .Heal,
1274
+ .bp = 0,
1275
+ .type = .Normal,
1276
+ .accuracy = percent(100),
1277
+ .target = .Self,
1278
+ },
1279
+ // HighJumpKick
1280
+ .{
1281
+ .effect = .JumpKick,
1282
+ .bp = 85,
1283
+ .type = .Fighting,
1284
+ .accuracy = percent(90),
1285
+ .target = .Other,
1286
+ },
1287
+ // Glare
1288
+ .{
1289
+ .effect = .Paralyze,
1290
+ .bp = 0,
1291
+ .type = .Normal,
1292
+ .accuracy = percent(75),
1293
+ .target = .Other,
1294
+ },
1295
+ // DreamEater
1296
+ .{
1297
+ .effect = .DreamEater,
1298
+ .bp = 100,
1299
+ .type = .Psychic,
1300
+ .accuracy = percent(100),
1301
+ .target = .Other,
1302
+ },
1303
+ // PoisonGas
1304
+ .{
1305
+ .effect = .Poison,
1306
+ .bp = 0,
1307
+ .type = .Poison,
1308
+ .accuracy = percent(55),
1309
+ .target = .Other,
1310
+ },
1311
+ // Barrage
1312
+ .{
1313
+ .effect = .MultiHit,
1314
+ .bp = 15,
1315
+ .type = .Normal,
1316
+ .accuracy = percent(85),
1317
+ .target = .Other,
1318
+ },
1319
+ // LeechLife
1320
+ .{
1321
+ .effect = .DrainHP,
1322
+ .bp = 20,
1323
+ .type = .Bug,
1324
+ .accuracy = percent(100),
1325
+ .target = .Other,
1326
+ },
1327
+ // LovelyKiss
1328
+ .{
1329
+ .effect = .Sleep,
1330
+ .bp = 0,
1331
+ .type = .Normal,
1332
+ .accuracy = percent(75),
1333
+ .target = .Other,
1334
+ },
1335
+ // SkyAttack
1336
+ .{
1337
+ .effect = .Charge,
1338
+ .bp = 140,
1339
+ .type = .Flying,
1340
+ .accuracy = percent(90),
1341
+ .target = .Any,
1342
+ },
1343
+ // Transform
1344
+ .{
1345
+ .effect = .Transform,
1346
+ .bp = 0,
1347
+ .type = .Normal,
1348
+ .accuracy = percent(100),
1349
+ .target = .Other,
1350
+ },
1351
+ // Bubble
1352
+ .{
1353
+ .effect = .SpeedDownChance,
1354
+ .bp = 20,
1355
+ .type = .Water,
1356
+ .accuracy = percent(100),
1357
+ .target = .Other,
1358
+ },
1359
+ // DizzyPunch
1360
+ .{
1361
+ .effect = .None,
1362
+ .bp = 70,
1363
+ .type = .Normal,
1364
+ .accuracy = percent(100),
1365
+ .target = .Other,
1366
+ },
1367
+ // Spore
1368
+ .{
1369
+ .effect = .Sleep,
1370
+ .bp = 0,
1371
+ .type = .Grass,
1372
+ .accuracy = percent(100),
1373
+ .target = .Other,
1374
+ },
1375
+ // Flash
1376
+ .{
1377
+ .effect = .AccuracyDown1,
1378
+ .bp = 0,
1379
+ .type = .Normal,
1380
+ .accuracy = percent(70),
1381
+ .target = .Other,
1382
+ },
1383
+ // Psywave
1384
+ .{
1385
+ .effect = .SpecialDamage,
1386
+ .bp = 1,
1387
+ .type = .Psychic,
1388
+ .accuracy = percent(80),
1389
+ .target = .Other,
1390
+ },
1391
+ // Splash
1392
+ .{
1393
+ .effect = .Splash,
1394
+ .bp = 0,
1395
+ .type = .Normal,
1396
+ .accuracy = percent(100),
1397
+ .target = .Self,
1398
+ },
1399
+ // AcidArmor
1400
+ .{
1401
+ .effect = .DefenseUp2,
1402
+ .bp = 0,
1403
+ .type = .Poison,
1404
+ .accuracy = percent(100),
1405
+ .target = .Self,
1406
+ },
1407
+ // Crabhammer
1408
+ .{
1409
+ .effect = .HighCritical,
1410
+ .bp = 90,
1411
+ .type = .Water,
1412
+ .accuracy = percent(85),
1413
+ .target = .Other,
1414
+ },
1415
+ // Explosion
1416
+ .{
1417
+ .effect = .Explode,
1418
+ .bp = 170,
1419
+ .type = .Normal,
1420
+ .accuracy = percent(100),
1421
+ .target = .Other,
1422
+ },
1423
+ // FurySwipes
1424
+ .{
1425
+ .effect = .MultiHit,
1426
+ .bp = 18,
1427
+ .type = .Normal,
1428
+ .accuracy = percent(80),
1429
+ .target = .Other,
1430
+ },
1431
+ // Bonemerang
1432
+ .{
1433
+ .effect = .DoubleHit,
1434
+ .bp = 50,
1435
+ .type = .Ground,
1436
+ .accuracy = percent(90),
1437
+ .target = .Other,
1438
+ },
1439
+ // Rest
1440
+ .{
1441
+ .effect = .Heal,
1442
+ .bp = 0,
1443
+ .type = .Psychic,
1444
+ .accuracy = percent(100),
1445
+ .target = .Self,
1446
+ },
1447
+ // RockSlide
1448
+ .{
1449
+ .effect = .None,
1450
+ .bp = 75,
1451
+ .type = .Rock,
1452
+ .accuracy = percent(90),
1453
+ .target = .Other,
1454
+ },
1455
+ // HyperFang
1456
+ .{
1457
+ .effect = .FlinchChance1,
1458
+ .bp = 80,
1459
+ .type = .Normal,
1460
+ .accuracy = percent(90),
1461
+ .target = .Other,
1462
+ },
1463
+ // Sharpen
1464
+ .{
1465
+ .effect = .AttackUp1,
1466
+ .bp = 0,
1467
+ .type = .Normal,
1468
+ .accuracy = percent(100),
1469
+ .target = .Self,
1470
+ },
1471
+ // Conversion
1472
+ .{
1473
+ .effect = .Conversion,
1474
+ .bp = 0,
1475
+ .type = .Normal,
1476
+ .accuracy = percent(100),
1477
+ .target = .Other,
1478
+ },
1479
+ // TriAttack
1480
+ .{
1481
+ .effect = .None,
1482
+ .bp = 80,
1483
+ .type = .Normal,
1484
+ .accuracy = percent(100),
1485
+ .target = .Other,
1486
+ },
1487
+ // SuperFang
1488
+ .{
1489
+ .effect = .SuperFang,
1490
+ .bp = 1,
1491
+ .type = .Normal,
1492
+ .accuracy = percent(90),
1493
+ .target = .Other,
1494
+ },
1495
+ // Slash
1496
+ .{
1497
+ .effect = .HighCritical,
1498
+ .bp = 70,
1499
+ .type = .Normal,
1500
+ .accuracy = percent(100),
1501
+ .target = .Other,
1502
+ },
1503
+ // Substitute
1504
+ .{
1505
+ .effect = .Substitute,
1506
+ .bp = 0,
1507
+ .type = .Normal,
1508
+ .accuracy = percent(100),
1509
+ .target = .Self,
1510
+ },
1511
+ // Struggle
1512
+ .{
1513
+ .effect = .Recoil,
1514
+ .bp = 50,
1515
+ .type = .Normal,
1516
+ .accuracy = percent(100),
1517
+ .target = .RandomFoe,
1518
+ },
1519
+ };
1520
+
1521
+ /// Representation of a move's effect.
1522
+ pub const Effect = enum(u8) {
1523
+ None,
1524
+ // onBegin
1525
+ Confusion,
1526
+ Conversion,
1527
+ FocusEnergy,
1528
+ Haze,
1529
+ Heal,
1530
+ LeechSeed,
1531
+ LightScreen,
1532
+ Mimic,
1533
+ Mist,
1534
+ Paralyze,
1535
+ Poison,
1536
+ Reflect,
1537
+ Splash,
1538
+ Substitute,
1539
+ SwitchAndTeleport,
1540
+ Transform,
1541
+ // onEnd
1542
+ AccuracyDown1,
1543
+ AttackDown1,
1544
+ DefenseDown1,
1545
+ DefenseDown2,
1546
+ SpeedDown1,
1547
+ AttackUp1,
1548
+ AttackUp2,
1549
+ Bide,
1550
+ DefenseUp1,
1551
+ DefenseUp2,
1552
+ EvasionUp1,
1553
+ Sleep,
1554
+ SpecialUp1,
1555
+ SpecialUp2,
1556
+ SpeedUp2,
1557
+ // isSpecial
1558
+ DrainHP,
1559
+ DreamEater,
1560
+ Explode,
1561
+ JumpKick,
1562
+ PayDay,
1563
+ Rage,
1564
+ Recoil,
1565
+ Binding,
1566
+ Charge,
1567
+ SpecialDamage,
1568
+ SuperFang,
1569
+ Swift,
1570
+ Thrashing,
1571
+ // isMulti
1572
+ DoubleHit,
1573
+ MultiHit,
1574
+ Twineedle,
1575
+ // other
1576
+ AttackDownChance,
1577
+ DefenseDownChance,
1578
+ SpeedDownChance,
1579
+ SpecialDownChance,
1580
+ BurnChance1,
1581
+ BurnChance2,
1582
+ ConfusionChance,
1583
+ FlinchChance1,
1584
+ FlinchChance2,
1585
+ FreezeChance,
1586
+ ParalyzeChance1,
1587
+ ParalyzeChance2,
1588
+ PoisonChance1,
1589
+ PoisonChance2,
1590
+ Disable,
1591
+ HighCritical,
1592
+ HyperBeam,
1593
+ Metronome,
1594
+ MirrorMove,
1595
+ OHKO,
1596
+
1597
+ comptime {
1598
+ assert(@sizeOf(Effect) == 1);
1599
+ }
1600
+
1601
+ /// Whether this effect activates during the "begin" step of move execution.
1602
+ pub fn onBegin(effect: Effect) bool {
1603
+ return @intFromEnum(effect) > 0 and @intFromEnum(effect) <= 16;
1604
+ }
1605
+
1606
+ /// Whether this effect lowers stats.
1607
+ pub fn isStatDown(effect: Effect) bool {
1608
+ return @intFromEnum(effect) > 16 and @intFromEnum(effect) <= 21;
1609
+ }
1610
+
1611
+ /// Whether this effect activates during the "end" step of move execution.
1612
+ pub fn onEnd(effect: Effect) bool {
1613
+ return @intFromEnum(effect) > 16 and @intFromEnum(effect) <= 31;
1614
+ }
1615
+
1616
+ /// Whether this effect is considered to "always happen".
1617
+ pub fn alwaysHappens(effect: Effect) bool {
1618
+ return @intFromEnum(effect) > 31 and @intFromEnum(effect) <= 38;
1619
+ }
1620
+
1621
+ /// Whether this effect is handled specially by the engine.
1622
+ pub fn isSpecial(effect: Effect) bool {
1623
+ // NB: isSpecial includes isMulti up to Twineedle
1624
+ return @intFromEnum(effect) > 31 and @intFromEnum(effect) <= 46;
1625
+ }
1626
+
1627
+ /// Whether this effect is a multi-hit effect.
1628
+ pub fn isMulti(effect: Effect) bool {
1629
+ return @intFromEnum(effect) > 44 and @intFromEnum(effect) <= 47;
1630
+ }
1631
+
1632
+ /// Whether this effect is has chance of lowering stats.
1633
+ pub fn isStatDownChance(effect: Effect) bool {
1634
+ return @intFromEnum(effect) > 47 and @intFromEnum(effect) <= 51;
1635
+ }
1636
+
1637
+ /// Whether this effect has a secondary chance.
1638
+ pub fn isSecondaryChance(effect: Effect) bool {
1639
+ // NB: isSecondaryChance includes isStatDownChance as well as Twineedle
1640
+ return (@intFromEnum(effect) > 46 and @intFromEnum(effect) <= 61);
1641
+ }
1642
+ };
1643
+
1644
+ const Target = enum(u4) {
1645
+ // none
1646
+ All,
1647
+ AllySide,
1648
+ Field,
1649
+ Self,
1650
+ // resolve
1651
+ AllOthers,
1652
+ Depends,
1653
+ Other,
1654
+ Any,
1655
+ Allies,
1656
+ Ally,
1657
+ AllyOrSelf,
1658
+ Foe,
1659
+ // resolve + run
1660
+ Foes,
1661
+ FoeSide,
1662
+ RandomFoe,
1663
+ };
1664
+
1665
+ const PP = [_]u8{
1666
+ 35, // Pound
1667
+ 25, // KarateChop
1668
+ 10, // DoubleSlap
1669
+ 15, // CometPunch
1670
+ 20, // MegaPunch
1671
+ 20, // PayDay
1672
+ 15, // FirePunch
1673
+ 15, // IcePunch
1674
+ 15, // ThunderPunch
1675
+ 35, // Scratch
1676
+ 30, // ViseGrip
1677
+ 5, // Guillotine
1678
+ 10, // RazorWind
1679
+ 30, // SwordsDance
1680
+ 30, // Cut
1681
+ 35, // Gust
1682
+ 35, // WingAttack
1683
+ 20, // Whirlwind
1684
+ 15, // Fly
1685
+ 20, // Bind
1686
+ 20, // Slam
1687
+ 10, // VineWhip
1688
+ 20, // Stomp
1689
+ 30, // DoubleKick
1690
+ 5, // MegaKick
1691
+ 25, // JumpKick
1692
+ 15, // RollingKick
1693
+ 15, // SandAttack
1694
+ 15, // Headbutt
1695
+ 25, // HornAttack
1696
+ 20, // FuryAttack
1697
+ 5, // HornDrill
1698
+ 35, // Tackle
1699
+ 15, // BodySlam
1700
+ 20, // Wrap
1701
+ 20, // TakeDown
1702
+ 20, // Thrash
1703
+ 15, // DoubleEdge
1704
+ 30, // TailWhip
1705
+ 35, // PoisonSting
1706
+ 20, // Twineedle
1707
+ 20, // PinMissile
1708
+ 30, // Leer
1709
+ 25, // Bite
1710
+ 40, // Growl
1711
+ 20, // Roar
1712
+ 15, // Sing
1713
+ 20, // Supersonic
1714
+ 20, // SonicBoom
1715
+ 20, // Disable
1716
+ 30, // Acid
1717
+ 25, // Ember
1718
+ 15, // Flamethrower
1719
+ 30, // Mist
1720
+ 25, // WaterGun
1721
+ 5, // HydroPump
1722
+ 15, // Surf
1723
+ 10, // IceBeam
1724
+ 5, // Blizzard
1725
+ 20, // Psybeam
1726
+ 20, // BubbleBeam
1727
+ 20, // AuroraBeam
1728
+ 5, // HyperBeam
1729
+ 35, // Peck
1730
+ 20, // DrillPeck
1731
+ 25, // Submission
1732
+ 20, // LowKick
1733
+ 20, // Counter
1734
+ 20, // SeismicToss
1735
+ 15, // Strength
1736
+ 20, // Absorb
1737
+ 10, // MegaDrain
1738
+ 10, // LeechSeed
1739
+ 40, // Growth
1740
+ 25, // RazorLeaf
1741
+ 10, // SolarBeam
1742
+ 35, // PoisonPowder
1743
+ 30, // StunSpore
1744
+ 15, // SleepPowder
1745
+ 20, // PetalDance
1746
+ 40, // StringShot
1747
+ 10, // DragonRage
1748
+ 15, // FireSpin
1749
+ 30, // ThunderShock
1750
+ 15, // Thunderbolt
1751
+ 20, // ThunderWave
1752
+ 10, // Thunder
1753
+ 15, // RockThrow
1754
+ 10, // Earthquake
1755
+ 5, // Fissure
1756
+ 10, // Dig
1757
+ 10, // Toxic
1758
+ 25, // Confusion
1759
+ 10, // Psychic
1760
+ 20, // Hypnosis
1761
+ 40, // Meditate
1762
+ 30, // Agility
1763
+ 30, // QuickAttack
1764
+ 20, // Rage
1765
+ 20, // Teleport
1766
+ 15, // NightShade
1767
+ 10, // Mimic
1768
+ 40, // Screech
1769
+ 15, // DoubleTeam
1770
+ 20, // Recover
1771
+ 30, // Harden
1772
+ 20, // Minimize
1773
+ 20, // Smokescreen
1774
+ 10, // ConfuseRay
1775
+ 40, // Withdraw
1776
+ 40, // DefenseCurl
1777
+ 30, // Barrier
1778
+ 30, // LightScreen
1779
+ 30, // Haze
1780
+ 20, // Reflect
1781
+ 30, // FocusEnergy
1782
+ 10, // Bide
1783
+ 10, // Metronome
1784
+ 20, // MirrorMove
1785
+ 5, // SelfDestruct
1786
+ 10, // EggBomb
1787
+ 30, // Lick
1788
+ 20, // Smog
1789
+ 20, // Sludge
1790
+ 20, // BoneClub
1791
+ 5, // FireBlast
1792
+ 15, // Waterfall
1793
+ 10, // Clamp
1794
+ 20, // Swift
1795
+ 15, // SkullBash
1796
+ 15, // SpikeCannon
1797
+ 35, // Constrict
1798
+ 20, // Amnesia
1799
+ 15, // Kinesis
1800
+ 10, // SoftBoiled
1801
+ 20, // HighJumpKick
1802
+ 30, // Glare
1803
+ 15, // DreamEater
1804
+ 40, // PoisonGas
1805
+ 20, // Barrage
1806
+ 15, // LeechLife
1807
+ 10, // LovelyKiss
1808
+ 5, // SkyAttack
1809
+ 10, // Transform
1810
+ 30, // Bubble
1811
+ 10, // DizzyPunch
1812
+ 15, // Spore
1813
+ 20, // Flash
1814
+ 15, // Psywave
1815
+ 40, // Splash
1816
+ 40, // AcidArmor
1817
+ 10, // Crabhammer
1818
+ 5, // Explosion
1819
+ 15, // FurySwipes
1820
+ 10, // Bonemerang
1821
+ 10, // Rest
1822
+ 10, // RockSlide
1823
+ 15, // HyperFang
1824
+ 30, // Sharpen
1825
+ 30, // Conversion
1826
+ 10, // TriAttack
1827
+ 10, // SuperFang
1828
+ 20, // Slash
1829
+ 10, // Substitute
1830
+ 10, // Struggle,
1831
+ };
1832
+
1833
+ comptime {
1834
+ assert(@sizeOf(Move) == 1);
1835
+ assert(@sizeOf(@TypeOf(DATA)) == 660);
1836
+ }
1837
+
1838
+ /// The number of Pokémon moves in this generation.
1839
+ pub const size = 165;
1840
+
1841
+ /// Pokémon moves that can be called by Metronome in this generation.
1842
+ pub const METRONOME = init: {
1843
+ var num = 0;
1844
+ var moves: [163]Move = undefined;
1845
+ for (1..Move.size) |i| {
1846
+ if (i != @intFromEnum(Move.Metronome)) {
1847
+ moves[num] = @enumFromInt(i);
1848
+ num += 1;
1849
+ }
1850
+ }
1851
+ assert(num == moves.len);
1852
+ break :init moves;
1853
+ };
1854
+
1855
+ /// Returns the `Data` corresponding to the move.
1856
+ pub fn get(id: Move) Data {
1857
+ assert(id != .None and id != .SKIP_TURN);
1858
+ return DATA[@intFromEnum(id) - 1];
1859
+ }
1860
+
1861
+ /// Returns the base PP of the move.
1862
+ pub fn pp(id: Move) u8 {
1863
+ assert(id != .None);
1864
+ return PP[@intFromEnum(id) - 1];
1865
+ }
1866
+ };