@pkmn/engine 0.1.0-dev.02b7f810

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