@pkmn/engine 0.1.0-dev.5ea92492 → 0.1.0-dev.5ec64ea5
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/build.zig +0 -2
- package/package.json +1 -1
- package/src/bin/pkmn-debug +3 -2
- package/src/lib/gen1/README.md +5 -12
- package/src/lib/gen1/data.zig +1 -2
- package/src/lib/gen1/mechanics.zig +2269 -2339
package/build.zig
CHANGED
|
@@ -27,7 +27,6 @@ pub fn build(b: *std.Build) !void {
|
|
|
27
27
|
const dynamic = b.option(bool, "dynamic", "Build a dynamic library") orelse false;
|
|
28
28
|
const strip = b.option(bool, "strip", "Strip debugging symbols from binary") orelse false;
|
|
29
29
|
const pic = b.option(bool, "pic", "Force position independent code") orelse false;
|
|
30
|
-
const emit_asm = b.option(bool, "emit-asm", "Output .s (assembly code)") orelse false;
|
|
31
30
|
|
|
32
31
|
const cmd = b.findProgram(&.{"strip"}, &.{}) catch null;
|
|
33
32
|
|
|
@@ -135,7 +134,6 @@ pub fn build(b: *std.Build) !void {
|
|
|
135
134
|
lib.bundle_compiler_rt = true;
|
|
136
135
|
maybeStrip(b, lib, b.getInstallStep(), strip, cmd);
|
|
137
136
|
if (pic) lib.force_pic = pic;
|
|
138
|
-
if (emit_asm) lib.emit_asm = .emit;
|
|
139
137
|
lib.install();
|
|
140
138
|
c = true;
|
|
141
139
|
}
|
package/package.json
CHANGED
package/src/bin/pkmn-debug
CHANGED
|
@@ -7,9 +7,9 @@ try {
|
|
|
7
7
|
if (err.code !== 'MODULE_NOT_FOUND') throw err;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
const {join, resolve} = require('path');
|
|
10
11
|
const {execFileSync} = require('child_process');
|
|
11
12
|
const {readFileSync} = require('fs');
|
|
12
|
-
const {join, resolve} = require('path');
|
|
13
13
|
|
|
14
14
|
const ROOT = resolve(__dirname, '..', '..');
|
|
15
15
|
const packageJSON = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf8'));
|
|
@@ -46,7 +46,8 @@ if (missing.length) {
|
|
|
46
46
|
execFileSync('npm', ['install', ...missing, '--global'], {encoding: 'utf8'});
|
|
47
47
|
|
|
48
48
|
const node_modules = execFileSync('npm', ['root', '--global'], {encoding: 'utf8'}).trim();
|
|
49
|
-
|
|
49
|
+
let NODE_PATH = process.env.NODE_PATH;
|
|
50
|
+
if (!NODE_PATH || !NODE_PATH.includes(node_modules)) {
|
|
50
51
|
console.error(`NODE_PATH must include npm's global node_modules directory: '${node_modules}'`);
|
|
51
52
|
process.exit(1);
|
|
52
53
|
}
|
package/src/lib/gen1/README.md
CHANGED
|
@@ -478,8 +478,7 @@ Smogon](https://www.smogon.com/forums/posts/5933177/show):
|
|
|
478
478
|
- Confusion self-hits use the wrong damage formula resulting in off-by-one errors (and also fail to
|
|
479
479
|
account for an opponent's Reflect). Furthermore, the confusion self-hit damage will erroneously be
|
|
480
480
|
inflicted to the confused user's substitute if the confused user had been attempting to use a
|
|
481
|
-
self-targeting move.
|
|
482
|
-
damage for the purposes of tracking the battle's last damage.
|
|
481
|
+
self-targeting move.
|
|
483
482
|
|
|
484
483
|
Beyond the general bugs listed above, several move effects are implemented incorrectly by Pokémon
|
|
485
484
|
Showdown. Some of these moves are [too fundamentally broken to be implemented](#unimplementable) by
|
|
@@ -489,8 +488,7 @@ the pkmn engine, but the following moves have their broken behavior preserved in
|
|
|
489
488
|
incorrectly still gets applied to Bide's user.
|
|
490
489
|
- **Leech Seed**: Leech Seed fails to heal its source side if a seeded target faints due to
|
|
491
490
|
recoil/crash damage on Pokémon Showdown. Pokémon Showdown also updates the battle's last damage
|
|
492
|
-
field with the uncapped Leech Seed damage
|
|
493
|
-
for Bide and Counter.
|
|
491
|
+
field with the uncapped Leech Seed damage which has consequences for Bide and Counter.
|
|
494
492
|
- **Pay Day**: Pay Day should still scatter coins if it hits (but doesn't break) and opponent's
|
|
495
493
|
Substitute but doesn't on Pokémon Showdown.
|
|
496
494
|
- **Flinch**: Flinching does not get cleared during move selection on Pokémon Showdown and is
|
|
@@ -500,14 +498,10 @@ the pkmn engine, but the following moves have their broken behavior preserved in
|
|
|
500
498
|
- **Rage**: Rage boosts should still result in burn/paralysis [stat modification
|
|
501
499
|
errors](https://pkmn.cc/bulba-glitch-1#Stat_modification_errors) but don't on Pokémon Showdown.
|
|
502
500
|
Furthermore, Pokémon Showdown only builds Rage for Disable/Explosion (hit/miss) when attacking
|
|
503
|
-
into a Substitute instead of all moves.
|
|
504
|
-
Petal Dance accuracy bug]( https://www.youtube.com/watch?v=NC5gbJeExbs) incorrectly, as the
|
|
505
|
-
accuracy only gets written when the volatile is present which can lead to incorrect accuracy
|
|
506
|
-
values on turns where Rage is used on the same turn as a move which modifies accuracy or evasion.
|
|
501
|
+
into a Substitute instead of all moves.
|
|
507
502
|
- **Thrash** / **Petal Dance**: once a Pokémon is locked into a thrashing move they will lose all
|
|
508
503
|
speed ties on Pokémon Showdown (due to the fact that if they win the speed tie their action will
|
|
509
|
-
then get "changed" and inserted back into the queue after their opponent's action).
|
|
510
|
-
Showdown also implements accuracy incorrectly, as covered above.
|
|
504
|
+
then get "changed" and inserted back into the queue after their opponent's action).
|
|
511
505
|
- **Freeze** / **Sleep**: Pokémon Showdown requires a move to be selected when a Pokémon is frozen
|
|
512
506
|
or sleeping and uses that in the event that the status is removed while on the cartridge no
|
|
513
507
|
selection is possible and no turn exists for the thawed/woken Pokémon to act except in the case of
|
|
@@ -532,8 +526,7 @@ the pkmn engine, but the following moves have their broken behavior preserved in
|
|
|
532
526
|
Pokémon Showdown implementing the health check based on floating point division instead of integer
|
|
533
527
|
divison like on the cartridge (meaning the Substitute 1/4 glitch will only occur if the Pokémon's
|
|
534
528
|
maximum HP is evenly divisible by 4). Finally, Substitute also incorrectly blocks Dream Eater on
|
|
535
|
-
Pokémon Showdown
|
|
536
|
-
damage.
|
|
529
|
+
Pokémon Showdown.
|
|
537
530
|
|
|
538
531
|
In addition to numerous cases where Pokémon Showdown uses the wrong type of message (e.g. `|-fail`
|
|
539
532
|
vs. `|-miss|` vs. `|-immune|`, e.g. in the case of Leech Seed) which are not documented here, Pokémon
|
package/src/lib/gen1/data.zig
CHANGED
|
@@ -78,8 +78,7 @@ pub fn Battle(comptime RNG: anytype) type {
|
|
|
78
78
|
/// Returns the result of applying Player 1's choice `c1` and Player 2's choice `c2` to the
|
|
79
79
|
/// battle, optionally writing protocol logs to `log` if `options.trace` is enabled.
|
|
80
80
|
pub fn update(self: *Self, c1: Choice, c2: Choice, log: anytype) !Result {
|
|
81
|
-
|
|
82
|
-
return m.update(c1, c2);
|
|
81
|
+
return mechanics.update(self, c1, c2, log);
|
|
83
82
|
}
|
|
84
83
|
|
|
85
84
|
/// Fills in at most `out.len` possible choices for the `player` given the previous `result`
|