@pkmn/engine 0.1.0-dev.dfd46bbb → 0.1.0-dev.e0e37c1b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/build/tools/debug.js +3 -1
- package/build/tools/debug.js.map +1 -1
- package/package.json +3 -3
- package/src/lib/common/protocol.zig +331 -331
- package/src/lib/gen1/mechanics.zig +199 -199
- package/src/lib/gen2/README.md +0 -1
- package/src/lib/gen2/data.zig +1 -1
- package/src/lib/gen2/generated.zig +5 -11
- package/src/lib/gen2/mechanics.zig +522 -308
package/src/lib/gen2/README.md
CHANGED
|
@@ -49,7 +49,6 @@ The following information is required to simulate a Generation II Pokémon battl
|
|
|
49
49
|
| `volatiles.bind` | `PlayerWrapCount` | `volatiles.partiallytrapped.duration` |
|
|
50
50
|
| `volatiles.bind_reason` | `PlayerTrappingMove` | `volatiles.effectState.sourceEffect` |
|
|
51
51
|
| | `PlayerCharging` | |
|
|
52
|
-
| `volatiles.trapped FIXME` | `FIXME` | `pokemon.trapped` |
|
|
53
52
|
| `volatiles.switched` | `TODO` | `pokemon.switchFlag` |
|
|
54
53
|
| `volatiles.switching` | `PlayerIsSwitching` | `pokemon.switchFlag` |
|
|
55
54
|
| `volatiles.frozen` | `PlayerJustGotFrozen` | `volatiles.frozen` |
|
package/src/lib/gen2/data.zig
CHANGED
|
@@ -314,8 +314,8 @@ pub const Volatiles = packed struct(u128) {
|
|
|
314
314
|
Encore: bool = false,
|
|
315
315
|
LockOn: bool = false,
|
|
316
316
|
DestinyBond: bool = false,
|
|
317
|
+
Trapped: bool = false,
|
|
317
318
|
|
|
318
|
-
trapped: bool = false,
|
|
319
319
|
switched: bool = false,
|
|
320
320
|
// TODO: replace with simply looking at Choice on Battle
|
|
321
321
|
switching: bool = false,
|
|
@@ -175,7 +175,7 @@ pub fn runMove(battle: anytype, player: Player, state: *State, options: anytype)
|
|
|
175
175
|
if (!skip_pp) _ = decrementPP(side, state.move, state.mslot); // TODO if no pp return
|
|
176
176
|
// TODO rampage
|
|
177
177
|
// usedmovetext
|
|
178
|
-
try log.move(ident, state.move, foe_ident); // FIXME self? from?
|
|
178
|
+
try log.move(.{ ident, state.move, foe_ident }); // FIXME self? from?
|
|
179
179
|
try checkHit(battle, player, state, options);
|
|
180
180
|
try checkCriticalHit(battle, player, state, options);
|
|
181
181
|
try calcDamage(battle, player, state, options);
|
|
@@ -260,7 +260,7 @@ pub fn runMove(battle: anytype, player: Player, state: *State, options: anytype)
|
|
|
260
260
|
try Effects.hyperBeam(battle, player, state, options);
|
|
261
261
|
_ = try afterMove(!KINGS, battle, player, state, options);
|
|
262
262
|
},
|
|
263
|
-
.Counter => {
|
|
263
|
+
.MirrorCoat, .Counter => {
|
|
264
264
|
if (!try canMove(battle, player, state, options)) return;
|
|
265
265
|
try Effects.counter(battle, player, state, options);
|
|
266
266
|
try applyDamage(battle, player, state, options);
|
|
@@ -368,7 +368,7 @@ pub fn runMove(battle: anytype, player: Player, state: *State, options: anytype)
|
|
|
368
368
|
(volatiles.BeatUp or volatiles.Thrashing or volatiles.Bide);
|
|
369
369
|
if (!skip_pp) _ = decrementPP(side, state.move, state.mslot); // TODO if no pp return
|
|
370
370
|
// usedmovetext
|
|
371
|
-
try log.move(ident, state.move, foe_ident); // FIXME self? from?
|
|
371
|
+
try log.move(.{ ident, state.move, foe_ident }); // FIXME self? from?
|
|
372
372
|
try Effects.bide.unleash(battle, player, state, options);
|
|
373
373
|
|
|
374
374
|
if (state.immune()) {
|
|
@@ -555,7 +555,7 @@ pub fn runMove(battle: anytype, player: Player, state: *State, options: anytype)
|
|
|
555
555
|
(volatiles.BeatUp or volatiles.Thrashing or volatiles.Bide);
|
|
556
556
|
if (!skip_pp) _ = decrementPP(side, state.move, state.mslot); // TODO if no pp return
|
|
557
557
|
// usedmovetext
|
|
558
|
-
try log.move(ident, state.move, foe_ident); // FIXME self? from?
|
|
558
|
+
try log.move(.{ ident, state.move, foe_ident }); // FIXME self? from?
|
|
559
559
|
try checkCriticalHit(battle, player, state, options);
|
|
560
560
|
try calcDamage(battle, player, state, options);
|
|
561
561
|
try adjustDamage(battle, player, state, options);
|
|
@@ -655,7 +655,7 @@ pub fn runMove(battle: anytype, player: Player, state: *State, options: anytype)
|
|
|
655
655
|
.Magnitude => {
|
|
656
656
|
if (!try canMove(battle, player, state, options)) return;
|
|
657
657
|
try checkCriticalHit(battle, player, state, options);
|
|
658
|
-
|
|
658
|
+
try Effects.magnitude(battle, player, state, options);
|
|
659
659
|
try calcDamage(battle, player, state, options);
|
|
660
660
|
try adjustDamage(battle, player, state, options);
|
|
661
661
|
try randomizeDamage(battle, player, state, options);
|
|
@@ -730,12 +730,6 @@ pub fn runMove(battle: anytype, player: Player, state: *State, options: anytype)
|
|
|
730
730
|
if (!try canMove(battle, player, state, options)) return;
|
|
731
731
|
try Effects.sunnyDay(battle, player, state, options);
|
|
732
732
|
},
|
|
733
|
-
.MirrorCoat => {
|
|
734
|
-
if (!try canMove(battle, player, state, options)) return;
|
|
735
|
-
try Effects.mirrorCoat(battle, player, state, options);
|
|
736
|
-
try applyDamage(battle, player, state, options);
|
|
737
|
-
_ = try afterMove(KINGS, battle, player, state, options);
|
|
738
|
-
},
|
|
739
733
|
.PsychUp => {
|
|
740
734
|
if (!try canMove(battle, player, state, options)) return;
|
|
741
735
|
try Effects.psychUp(battle, player, state, options);
|