@pkmn/engine 0.1.0-dev.6ef582f1 → 0.1.0-dev.736f7a8b

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.
@@ -350,47 +350,65 @@ pub const Rolls = struct {
350
350
  const U3_NONE = [_]u3{0};
351
351
  const U3_FORCED = [_]u3{1};
352
352
 
353
- /// Returns a slice with a range of values for sleep given the `action` state.
353
+ /// Returns a slice with a range of values for sleep given the `action` and `origin` states.
354
354
  pub inline fn sleep(action: Action, origin: Action) []const u3 {
355
- const turns = @field(action.durations, "sleep");
356
- _ = origin;
357
- return if (turns < 1 or turns >= 7) &U3_NONE else &[_]u3{ 0, turns };
355
+ const a = @field(action.durations, "sleep");
356
+ const o = @field(origin.durations, "sleep");
357
+ if (o == a) return if (o == 0) &U3_NONE else &[_]u3{o};
358
+ assert(a == 0 or a == o + 1);
359
+ return if (o >= 7) &U3_NONE else &[_]u3{ 0, o + 1 };
358
360
  }
359
361
 
360
362
  const DISABLE_NONE = [_]u4{0};
361
363
 
362
- /// Returns a slice with a range of values for disable given the `action` state
364
+ /// Returns a slice with a range of values for disable given the `action` and `origin` states
363
365
  /// and the state of the `parent` (the player's Pokémon's remaining sleep turns).
364
366
  pub inline fn disable(action: Action, origin: Action, parent: u4) []const u4 {
365
- const turns = @field(action.durations, "disable");
366
- _ = origin;
367
- return if (parent > 0 or turns < 1 or turns >= 8) &DISABLE_NONE else &[_]u4{ 0, turns };
367
+ if (parent > 0) return &DISABLE_NONE;
368
+ const a = @field(action.durations, "disable");
369
+ const o = @field(origin.durations, "disable");
370
+ if (o == a) return if (o == 0) &DISABLE_NONE else &[_]u4{o};
371
+ assert(a == 0 or a == o + 1);
372
+ return if (o >= 8) &DISABLE_NONE else &[_]u4{ 0, o + 1 };
368
373
  }
369
374
 
370
- /// Returns a slice with a range of values for confusion given the `action` state
375
+ /// Returns a slice with a range of values for confusion given the `action` and `origin` states
371
376
  /// and the state of the `parent` (the player's remaining sleep turns).
372
377
  pub inline fn confusion(action: Action, origin: Action, parent: u4) []const u3 {
373
- const turns = @field(action.durations, "confusion");
374
- _ = origin;
375
- if (parent > 0 or turns < 1 or turns >= 5) return &U3_NONE;
376
- return if (turns < 2) &U3_FORCED else &[_]u3{ 0, turns };
378
+ if (parent > 0) return &U3_NONE;
379
+ const a = @field(action.durations, "confusion");
380
+ const o = @field(origin.durations, "confusion");
381
+ if (o == a) return if (o == 0) &U3_NONE else &[_]u3{o};
382
+ assert(a == 0 or a == o + 1);
383
+ return if (o >= 5) &U3_NONE else if (o < 2)
384
+ if (a == 0) &U3_NONE else &U3_FORCED
385
+ else
386
+ &[_]u3{ 0, o + 1 };
377
387
  }
378
388
 
379
- /// Returns a slice with a range of values for attacking given the `action` state
389
+ /// Returns a slice with a range of values for attacking given the `action` and `origin` states
380
390
  /// and the state of the `parent` (whether the player's Pokémon was fully paralyzed).
381
391
  pub inline fn attacking(action: Action, origin: Action, parent: Optional(bool)) []const u3 {
382
- const turns = @field(action.durations, "attacking");
383
- _ = origin;
384
- if (parent == .true or turns < 1 or turns >= 3) return &U3_NONE;
385
- return if (turns < 2) &U3_FORCED else &[_]u3{ 0, turns };
392
+ if (parent == .true) return &U3_NONE;
393
+ const a = @field(action.durations, "attacking");
394
+ const o = @field(origin.durations, "attacking");
395
+ if (o == a) return if (o == 0) &U3_NONE else &[_]u3{o};
396
+ assert(a == 0 or a == o + 1);
397
+ return if (o >= 3) &U3_NONE else if (o < 2)
398
+ if (a == 0) &U3_NONE else &U3_FORCED
399
+ else
400
+ &[_]u3{ 0, o + 1 };
386
401
  }
387
402
 
388
- /// Returns a slice with a range of values for binding given the `action` state
403
+ /// Returns a slice with a range of values for binding given the `action` and `origin` states
389
404
  /// and the state of the `parent` (whether the player's Pokémon was fully paralyzed).
390
405
  pub inline fn binding(action: Action, origin: Action, parent: Optional(bool)) []const u3 {
391
- const turns = @field(action.durations, "binding");
392
- _ = origin;
393
- return if (parent == .true or turns < 1 or turns >= 4) &U3_NONE else &[_]u3{ 0, turns };
406
+ if (parent == .true) return &U3_NONE;
407
+ const a = @field(action.durations, "binding");
408
+ const o = @field(origin.durations, "binding");
409
+ if (o == a) return if (o == 0) &U3_NONE else &[_]u3{o};
410
+ assert(a == 0 or a == o + 1);
411
+ return if (o >= 4) &U3_NONE else &[_]u3{ 0, o + 1 };
394
412
  }
395
413
 
396
414
  const SLOT_NONE = [_]u4{0};
@@ -535,72 +553,207 @@ test "Rolls.duration" {
535
553
  try expectEqualSlices(u1, &.{0}, Rolls.duration(actions.p2, .false));
536
554
  }
537
555
 
538
- const FIXME: Action = .{};
539
-
540
556
  test "Rolls.sleep" {
541
- try expectEqualSlices(u3, &.{0}, Rolls.sleep(.{ .durations = .{ .sleep = 0 } }, FIXME));
542
- try expectEqualSlices(u3, &.{0}, Rolls.sleep(.{ .durations = .{ .sleep = 7 } }, FIXME));
543
- try expectEqualSlices(u3, &.{ 0, 4 }, Rolls.sleep(.{ .durations = .{ .sleep = 4 } }, FIXME));
557
+ try expectEqualSlices(u3, &.{0}, Rolls.sleep(
558
+ .{ .durations = .{ .sleep = 0 } },
559
+ .{ .durations = .{ .sleep = 0 } },
560
+ ));
561
+ try expectEqualSlices(u3, &.{ 0, 1 }, Rolls.sleep(
562
+ .{ .durations = .{ .sleep = 1 } },
563
+ .{ .durations = .{ .sleep = 0 } },
564
+ ));
565
+ try expectEqualSlices(u3, &.{ 0, 2 }, Rolls.sleep(
566
+ .{ .durations = .{ .sleep = 0 } },
567
+ .{ .durations = .{ .sleep = 1 } },
568
+ ));
569
+ try expectEqualSlices(u3, &.{1}, Rolls.sleep(
570
+ .{ .durations = .{ .sleep = 1 } },
571
+ .{ .durations = .{ .sleep = 1 } },
572
+ ));
573
+ try expectEqualSlices(u3, &.{ 0, 3 }, Rolls.sleep(
574
+ .{ .durations = .{ .sleep = 0 } },
575
+ .{ .durations = .{ .sleep = 2 } },
576
+ ));
577
+ try expectEqualSlices(u3, &.{ 0, 7 }, Rolls.sleep(
578
+ .{ .durations = .{ .sleep = 7 } },
579
+ .{ .durations = .{ .sleep = 6 } },
580
+ ));
581
+ try expectEqualSlices(u3, &.{0}, Rolls.sleep(
582
+ .{ .durations = .{ .sleep = 0 } },
583
+ .{ .durations = .{ .sleep = 7 } },
584
+ ));
544
585
  }
545
586
 
546
587
  test "Rolls.disable" {
547
- try expectEqualSlices(u4, &.{0}, Rolls.disable(.{ .durations = .{ .disable = 0 } }, FIXME, 0));
548
- try expectEqualSlices(u4, &.{0}, Rolls.disable(.{ .durations = .{ .disable = 8 } }, FIXME, 0));
549
- try expectEqualSlices(u4, &.{0}, Rolls.disable(.{ .durations = .{ .disable = 4 } }, FIXME, 1));
550
- try expectEqualSlices(u4, &.{ 0, 4 }, Rolls.disable(.{
551
- .durations = .{ .disable = 4 },
552
- }, FIXME, 0));
588
+ try expectEqualSlices(u4, &.{0}, Rolls.disable(
589
+ .{ .durations = .{ .disable = 0 } },
590
+ .{ .durations = .{ .disable = 0 } },
591
+ 0,
592
+ ));
593
+ try expectEqualSlices(u4, &.{ 0, 1 }, Rolls.disable(
594
+ .{ .durations = .{ .disable = 1 } },
595
+ .{ .durations = .{ .disable = 0 } },
596
+ 0,
597
+ ));
598
+ try expectEqualSlices(u4, &.{ 0, 2 }, Rolls.disable(
599
+ .{ .durations = .{ .disable = 0 } },
600
+ .{ .durations = .{ .disable = 1 } },
601
+ 0,
602
+ ));
603
+ try expectEqualSlices(u4, &.{1}, Rolls.disable(
604
+ .{ .durations = .{ .disable = 1 } },
605
+ .{ .durations = .{ .disable = 1 } },
606
+ 0,
607
+ ));
608
+ try expectEqualSlices(u4, &.{ 0, 3 }, Rolls.disable(
609
+ .{ .durations = .{ .disable = 0 } },
610
+ .{ .durations = .{ .disable = 2 } },
611
+ 0,
612
+ ));
613
+ try expectEqualSlices(u4, &.{0}, Rolls.disable(
614
+ .{ .durations = .{ .disable = 0 } },
615
+ .{ .durations = .{ .disable = 2 } },
616
+ 1,
617
+ ));
618
+ try expectEqualSlices(u4, &.{ 0, 8 }, Rolls.disable(
619
+ .{ .durations = .{ .disable = 8 } },
620
+ .{ .durations = .{ .disable = 7 } },
621
+ 0,
622
+ ));
623
+ try expectEqualSlices(u4, &.{0}, Rolls.disable(
624
+ .{ .durations = .{ .disable = 0 } },
625
+ .{ .durations = .{ .disable = 8 } },
626
+ 0,
627
+ ));
553
628
  }
554
629
 
555
630
  test "Rolls.confusion" {
556
- try expectEqualSlices(u3, &.{0}, Rolls.confusion(.{
557
- .durations = .{ .confusion = 0 },
558
- }, FIXME, 0));
559
- try expectEqualSlices(u3, &.{0}, Rolls.confusion(.{
560
- .durations = .{ .confusion = 5 },
561
- }, FIXME, 0));
562
- try expectEqualSlices(u3, &.{0}, Rolls.confusion(.{
563
- .durations = .{ .confusion = 3 },
564
- }, FIXME, 1));
565
- try expectEqualSlices(u3, &.{1}, Rolls.confusion(.{
566
- .durations = .{ .confusion = 1 },
567
- }, FIXME, 0));
568
- try expectEqualSlices(u3, &.{ 0, 3 }, Rolls.confusion(.{
569
- .durations = .{ .confusion = 3 },
570
- }, FIXME, 0));
631
+ try expectEqualSlices(u3, &.{0}, Rolls.confusion(
632
+ .{ .durations = .{ .confusion = 0 } },
633
+ .{ .durations = .{ .confusion = 0 } },
634
+ 0,
635
+ ));
636
+ try expectEqualSlices(u3, &.{1}, Rolls.confusion(
637
+ .{ .durations = .{ .confusion = 1 } },
638
+ .{ .durations = .{ .confusion = 0 } },
639
+ 0,
640
+ ));
641
+ try expectEqualSlices(u3, &.{0}, Rolls.confusion(
642
+ .{ .durations = .{ .confusion = 0 } },
643
+ .{ .durations = .{ .confusion = 1 } },
644
+ 0,
645
+ ));
646
+ try expectEqualSlices(u3, &.{1}, Rolls.confusion(
647
+ .{ .durations = .{ .confusion = 1 } },
648
+ .{ .durations = .{ .confusion = 1 } },
649
+ 0,
650
+ ));
651
+ try expectEqualSlices(u3, &.{ 0, 3 }, Rolls.confusion(
652
+ .{ .durations = .{ .confusion = 0 } },
653
+ .{ .durations = .{ .confusion = 2 } },
654
+ 0,
655
+ ));
656
+ try expectEqualSlices(u3, &.{0}, Rolls.confusion(
657
+ .{ .durations = .{ .confusion = 0 } },
658
+ .{ .durations = .{ .confusion = 2 } },
659
+ 1,
660
+ ));
661
+ try expectEqualSlices(u3, &.{ 0, 5 }, Rolls.confusion(
662
+ .{ .durations = .{ .confusion = 5 } },
663
+ .{ .durations = .{ .confusion = 4 } },
664
+ 0,
665
+ ));
666
+ try expectEqualSlices(u3, &.{0}, Rolls.confusion(
667
+ .{ .durations = .{ .confusion = 0 } },
668
+ .{ .durations = .{ .confusion = 5 } },
669
+ 0,
670
+ ));
571
671
  }
572
672
 
573
673
  test "Rolls.attacking" {
574
- try expectEqualSlices(u3, &.{0}, Rolls.attacking(.{
575
- .durations = .{ .attacking = 0 },
576
- }, FIXME, .false));
577
- try expectEqualSlices(u3, &.{0}, Rolls.attacking(.{
578
- .durations = .{ .attacking = 3 },
579
- }, FIXME, .false));
580
- try expectEqualSlices(u3, &.{0}, Rolls.attacking(.{
581
- .durations = .{ .attacking = 2 },
582
- }, FIXME, .true));
583
- try expectEqualSlices(u3, &.{1}, Rolls.attacking(.{
584
- .durations = .{ .attacking = 1 },
585
- }, FIXME, .false));
586
- try expectEqualSlices(u3, &.{ 0, 2 }, Rolls.attacking(.{
587
- .durations = .{ .attacking = 2 },
588
- }, FIXME, .false));
674
+ try expectEqualSlices(u3, &.{0}, Rolls.attacking(
675
+ .{ .durations = .{ .attacking = 0 } },
676
+ .{ .durations = .{ .attacking = 0 } },
677
+ .false,
678
+ ));
679
+ try expectEqualSlices(u3, &.{1}, Rolls.attacking(
680
+ .{ .durations = .{ .attacking = 1 } },
681
+ .{ .durations = .{ .attacking = 0 } },
682
+ .false,
683
+ ));
684
+ try expectEqualSlices(u3, &.{0}, Rolls.attacking(
685
+ .{ .durations = .{ .attacking = 0 } },
686
+ .{ .durations = .{ .attacking = 1 } },
687
+ .false,
688
+ ));
689
+ try expectEqualSlices(u3, &.{1}, Rolls.attacking(
690
+ .{ .durations = .{ .attacking = 1 } },
691
+ .{ .durations = .{ .attacking = 1 } },
692
+ .false,
693
+ ));
694
+ try expectEqualSlices(u3, &.{ 0, 3 }, Rolls.attacking(
695
+ .{ .durations = .{ .attacking = 0 } },
696
+ .{ .durations = .{ .attacking = 2 } },
697
+ .false,
698
+ ));
699
+ try expectEqualSlices(u3, &.{0}, Rolls.attacking(
700
+ .{ .durations = .{ .attacking = 0 } },
701
+ .{ .durations = .{ .attacking = 2 } },
702
+ .true,
703
+ ));
704
+ try expectEqualSlices(u3, &.{ 0, 3 }, Rolls.attacking(
705
+ .{ .durations = .{ .attacking = 3 } },
706
+ .{ .durations = .{ .attacking = 2 } },
707
+ .false,
708
+ ));
709
+ try expectEqualSlices(u3, &.{0}, Rolls.attacking(
710
+ .{ .durations = .{ .attacking = 0 } },
711
+ .{ .durations = .{ .attacking = 3 } },
712
+ .false,
713
+ ));
589
714
  }
590
715
 
591
716
  test "Rolls.binding" {
592
- try expectEqualSlices(u3, &.{0}, Rolls.binding(.{
593
- .durations = .{ .binding = 0 },
594
- }, FIXME, .false));
595
- try expectEqualSlices(u3, &.{0}, Rolls.binding(.{
596
- .durations = .{ .binding = 4 },
597
- }, FIXME, .false));
598
- try expectEqualSlices(u3, &.{0}, Rolls.binding(.{
599
- .durations = .{ .binding = 2 },
600
- }, FIXME, .true));
601
- try expectEqualSlices(u3, &.{ 0, 2 }, Rolls.binding(.{
602
- .durations = .{ .binding = 2 },
603
- }, FIXME, .false));
717
+ try expectEqualSlices(u3, &.{0}, Rolls.binding(
718
+ .{ .durations = .{ .binding = 0 } },
719
+ .{ .durations = .{ .binding = 0 } },
720
+ .false,
721
+ ));
722
+ try expectEqualSlices(u3, &.{ 0, 1 }, Rolls.binding(
723
+ .{ .durations = .{ .binding = 1 } },
724
+ .{ .durations = .{ .binding = 0 } },
725
+ .false,
726
+ ));
727
+ try expectEqualSlices(u3, &.{ 0, 2 }, Rolls.binding(
728
+ .{ .durations = .{ .binding = 0 } },
729
+ .{ .durations = .{ .binding = 1 } },
730
+ .false,
731
+ ));
732
+ try expectEqualSlices(u3, &.{1}, Rolls.binding(
733
+ .{ .durations = .{ .binding = 1 } },
734
+ .{ .durations = .{ .binding = 1 } },
735
+ .false,
736
+ ));
737
+ try expectEqualSlices(u3, &.{ 0, 3 }, Rolls.binding(
738
+ .{ .durations = .{ .binding = 0 } },
739
+ .{ .durations = .{ .binding = 2 } },
740
+ .false,
741
+ ));
742
+ try expectEqualSlices(u3, &.{0}, Rolls.binding(
743
+ .{ .durations = .{ .binding = 0 } },
744
+ .{ .durations = .{ .binding = 2 } },
745
+ .true,
746
+ ));
747
+ try expectEqualSlices(u3, &.{ 0, 4 }, Rolls.binding(
748
+ .{ .durations = .{ .binding = 4 } },
749
+ .{ .durations = .{ .binding = 3 } },
750
+ .false,
751
+ ));
752
+ try expectEqualSlices(u3, &.{0}, Rolls.binding(
753
+ .{ .durations = .{ .binding = 0 } },
754
+ .{ .durations = .{ .binding = 4 } },
755
+ .false,
756
+ ));
604
757
  }
605
758
 
606
759
  test "Rolls.moveSlot" {
@@ -2771,6 +2771,7 @@ pub const Rolls = struct {
2771
2771
  }
2772
2772
  };
2773
2773
 
2774
+ assert(roll >= 217 and roll <= 255);
2774
2775
  try options.chance.damage(player, roll);
2775
2776
  return roll;
2776
2777
  }
@@ -2895,6 +2896,7 @@ pub const Rolls = struct {
2895
2896
  }
2896
2897
  };
2897
2898
 
2899
+ assert(power < max);
2898
2900
  try options.chance.psywave(player, power, max);
2899
2901
  return power;
2900
2902
  }
@@ -2911,6 +2913,7 @@ pub const Rolls = struct {
2911
2913
  }
2912
2914
  };
2913
2915
 
2916
+ assert(duration >= 1 and duration <= 7);
2914
2917
  options.chance.duration(.sleep, player, player.foe(), duration);
2915
2918
  return duration;
2916
2919
  }
@@ -2923,6 +2926,7 @@ pub const Rolls = struct {
2923
2926
  else
2924
2927
  @intCast((battle.rng.next() & 7) + 1);
2925
2928
 
2929
+ assert(duration >= 1 and duration <= 8);
2926
2930
  options.chance.duration(.disable, player, player.foe(), duration);
2927
2931
  return duration;
2928
2932
  }
@@ -2935,6 +2939,7 @@ pub const Rolls = struct {
2935
2939
  else
2936
2940
  @intCast((battle.rng.next() & 3) + 2);
2937
2941
 
2942
+ assert(duration >= 2 and duration <= 5);
2938
2943
  options.chance.duration(.confusion, player, if (self) player else player.foe(), duration);
2939
2944
  return duration;
2940
2945
  }
@@ -2947,6 +2952,7 @@ pub const Rolls = struct {
2947
2952
  else
2948
2953
  @intCast((battle.rng.next() & 1) + 2);
2949
2954
 
2955
+ assert(duration >= 2 and duration <= 3);
2950
2956
  options.chance.duration(.attacking, player, player, duration);
2951
2957
  return duration;
2952
2958
  }
@@ -2967,6 +2973,7 @@ pub const Rolls = struct {
2967
2973
  break :n @intCast((if (r < 2) r else battle.rng.next() & 3) + 2);
2968
2974
  };
2969
2975
 
2976
+ assert(n >= 2 and n <= 5);
2970
2977
  if (effect == .Binding) {
2971
2978
  options.chance.duration(.binding, player, player, n);
2972
2979
  } else {
@@ -219,6 +219,81 @@ much overhead the preceding representations have after taking into consideration
219
219
  padding](https://en.wikipedia.org/wiki/Data_structure_alignment) and
220
220
  [denormalization](https://en.wikipedia.org/wiki/Denormalization):
221
221
 
222
+ ## Details
223
+
224
+ | pkmn | Pokémon Crystal (pret) |
225
+ | ------------------------- | ------------------------------------------------- |
226
+ | `start` | `DoBattle` |
227
+ | `update` | `BattleTurn` |
228
+ | `selectMove` / `saveMove` | `CheckPlayerLockedIn` / `ParsePlayerAction` |
229
+ | `switchIn` | `SwitchPlayerMon` / `SendOutPlayerMon` |
230
+ | `turnOrder` | `DetermineMoveOrder` |
231
+ | `doTurn` | `DoTurn` |
232
+ | `executeMove` | `DoMove` |
233
+ | `beforeMove` | `CheckTurn` |
234
+ | `canMove` | |
235
+ | `decrementPP` | |
236
+ | `doMove` | |
237
+ | `checkCriticalHit` | `BattleCommand_Critical` |
238
+ | `calcDamage` | `BattleCommand_DamageCalc` / `PlayerAttackDamage` |
239
+ | `adjustDamage` | `BattleCommand_Stab` |
240
+ | `randomizeDamage` | `BattleCommand_DamageVariation` |
241
+ | `specialDamage` | `BattleCommand_ConstantDamage` |
242
+ | `applyDamage` | `BattleCommand_ApplyDamage` |
243
+ | `checkHit` | `BattleCommand_CheckHit` |
244
+ | `checkFaint` | `CheckFaint` |
245
+ | `handleResidual` | `ResidualDamage` |
246
+ | `endTurn` | `EndTurn` |
247
+
248
+ DoBattle
249
+ BattleTurn
250
+ - HandleBerserkGene
251
+ - CheckPlayerLockedIn
252
+ - BattleMenu
253
+ - ParsePlayerAction
254
+ - DetermineMoveOrder
255
+ - CompareMovePriority
256
+ - GetMovePriority
257
+ - Battle_*
258
+ - Handle*Switch
259
+ - SwitchPlayerMon
260
+ - BreakAttraction
261
+ - SendOutPlayerMon
262
+ - SpikesDamage
263
+ - *Turn_EndOpponentProtectEndureDestinyBond
264
+ - EndUserDestinyBond
265
+ - Do*Turn
266
+ - EndOpponentProtectEndureDestinyBond
267
+ - ResidualDamage
268
+ - CheckFaint_*
269
+ - HandleBetweenTurnEffects
270
+ - HandleFutureSight
271
+ - HandleWeather
272
+ - HandleWrap
273
+ - HandlePerishSong
274
+ - HandleLeftovers
275
+ - HandleMysteryBerry
276
+ - HandleDefrost
277
+ - HandleSafeguard
278
+ - HandleScreens
279
+ - HandleStatBoostingHeldItems
280
+ - HandleHealingItems
281
+ - HandleEncore
282
+
283
+ DoTurn
284
+ DoMove = executeMove
285
+ CheckTurn = beforeMove
286
+ BattleCommand_Critical = checkCriticalHit
287
+ BattleCommand_Stab = adjustDamage
288
+ BattleCommand_DamageVariation = randomizeDamage
289
+ BattleCommand_CheckHit = checkHit
290
+ BattleCommand_ApplyDamage = applyDamage
291
+ BattleCommand_CheckFaint
292
+ BattleCommand_BuildOpponentRage = buildRage
293
+ BattleCommand_DamageCalc (PlayerAttackDamage / EnemyAttackDamage) = calcDamage
294
+ BattleCommand_ConstantDamage = specialDamage
295
+ DoEnemyDamage / DoPlayerDamage / DoSubstituteDamage
296
+
222
297
  ==**TODO**==
223
298
 
224
299
  ## Protocol
@@ -279,9 +279,11 @@ pub const Move = enum(u8) {
279
279
  target: Target,
280
280
  /// The chance of the move's secondary effect occurring.
281
281
  chance: u8 = 0,
282
+ /// The priority of the move
283
+ priority: i8 = 0,
282
284
 
283
285
  comptime {
284
- assert(@sizeOf(Data) == 7);
286
+ assert(@sizeOf(Data) == 8);
285
287
  }
286
288
  };
287
289
 
@@ -450,6 +452,7 @@ pub const Move = enum(u8) {
450
452
  .pp = 20,
451
453
  .accuracy = 100,
452
454
  .target = .Other,
455
+ .priority = -1,
453
456
  },
454
457
  // Fly
455
458
  .{
@@ -709,6 +712,7 @@ pub const Move = enum(u8) {
709
712
  .pp = 20,
710
713
  .accuracy = 100,
711
714
  .target = .Other,
715
+ .priority = -1,
712
716
  },
713
717
  // Sing
714
718
  .{
@@ -916,6 +920,7 @@ pub const Move = enum(u8) {
916
920
  .pp = 20,
917
921
  .accuracy = 100,
918
922
  .target = .Depends,
923
+ .priority = -1,
919
924
  },
920
925
  // SeismicToss
921
926
  .{
@@ -1191,6 +1196,7 @@ pub const Move = enum(u8) {
1191
1196
  .pp = 30,
1192
1197
  .accuracy = 100,
1193
1198
  .target = .Other,
1199
+ .priority = 1,
1194
1200
  },
1195
1201
  // Rage
1196
1202
  .{
@@ -1962,6 +1968,7 @@ pub const Move = enum(u8) {
1962
1968
  .pp = 10,
1963
1969
  .accuracy = 100,
1964
1970
  .target = .Self,
1971
+ .priority = 2,
1965
1972
  },
1966
1973
  // MachPunch
1967
1974
  .{
@@ -1971,6 +1978,7 @@ pub const Move = enum(u8) {
1971
1978
  .pp = 30,
1972
1979
  .accuracy = 100,
1973
1980
  .target = .Other,
1981
+ .priority = 1,
1974
1982
  },
1975
1983
  // ScaryFace
1976
1984
  .{
@@ -2102,6 +2110,7 @@ pub const Move = enum(u8) {
2102
2110
  .pp = 5,
2103
2111
  .accuracy = 100,
2104
2112
  .target = .Self,
2113
+ .priority = 2,
2105
2114
  },
2106
2115
  // BoneRush
2107
2116
  .{
@@ -2156,6 +2165,7 @@ pub const Move = enum(u8) {
2156
2165
  .pp = 10,
2157
2166
  .accuracy = 100,
2158
2167
  .target = .Self,
2168
+ .priority = 2,
2159
2169
  },
2160
2170
  // Charm
2161
2171
  .{
@@ -2433,6 +2443,7 @@ pub const Move = enum(u8) {
2433
2443
  .pp = 10,
2434
2444
  .accuracy = 100,
2435
2445
  .target = .Other,
2446
+ .priority = -1,
2436
2447
  },
2437
2448
  // MorningSun
2438
2449
  .{
@@ -2525,6 +2536,7 @@ pub const Move = enum(u8) {
2525
2536
  .pp = 20,
2526
2537
  .accuracy = 100,
2527
2538
  .target = .Depends,
2539
+ .priority = -1,
2528
2540
  },
2529
2541
  // PsychUp
2530
2542
  .{
@@ -2543,6 +2555,7 @@ pub const Move = enum(u8) {
2543
2555
  .pp = 5,
2544
2556
  .accuracy = 100,
2545
2557
  .target = .Other,
2558
+ .priority = 1,
2546
2559
  },
2547
2560
  // AncientPower
2548
2561
  .{
@@ -2770,7 +2783,7 @@ pub const Move = enum(u8) {
2770
2783
 
2771
2784
  comptime {
2772
2785
  assert(@sizeOf(Move) == 1);
2773
- assert(@sizeOf(@TypeOf(DATA)) == 1757);
2786
+ assert(@sizeOf(@TypeOf(DATA)) == 2008);
2774
2787
  }
2775
2788
 
2776
2789
  /// The number of Pokémon moves in this generation.