Port weather, copying moves, held items and obedience (#28)
Checks / web (push) Canceled after 0s

Complete the weather, Substitute, Transform, called-move and forced-switch effects. Add held-item behavior, Exp. Share awards and badge-based traded Pokemon obedience, and persist trainer berry consumption.

Validated with 576 passing unit tests and 149 browser tests, native/reference builds, reference/vendor/release checks and 320 Metal Powder emulator comparisons per browser. Smart AI and special balls/battle types remain on #28.
This commit is contained in:
Sébastien QUEROL committed 2026-10-03 15:03:19 +02:00
1 parent 8f5b464efc
commit 32d736ecae
13 files changed
+1509 -75

No files matched your search

+764 -69
View File
File diff suppressed because it is too large. Load diff
+24
View File
@@ -105,6 +105,8 @@ export const C = {
SKULL_BASH: 130,
SKY_ATTACK: 143,
WHIRLPOOL: 250,
ROAR: 46,
TRANSFORM: 144,
MIRROR_MOVE: 119,
REST: 156,
ENCORE: 227,
@@ -131,11 +133,16 @@ export const C = {
NORMAL: 0,
FLYING: 2,
POISON: 3,
ROCK: 5,
GROUND: 4,
STEEL: 9,
BIRD: 6,
GHOST: 8,
GRASS: 22,
UNUSED_TYPES: 10,
UNUSED_TYPES_END: 20,
TYPES_END: 28,
CURSE_TYPE: 19,
FIRE: 20,
SPECIAL: 20,
ICE: 25,
@@ -156,6 +163,7 @@ export const C = {
POKE_BALL: 5,
LUCKY_PUNCH: 30,
METAL_POWDER: 35,
BERSERK_GENE: 0x98,
STICK: 105,
THICK_CLUB: 118,
EXP_SHARE: 57,
@@ -387,10 +395,13 @@ export const COMMAND = {
freezetarget: 24,
paralyzetarget: 25,
selfdestruct: 26,
mirrormove: 27,
payday: 30,
conversion: 31,
resetstats: 32,
storeenergy: 33,
unleashenergy: 34,
forceswitch: 35,
endloop: 36,
flinchtarget: 37,
ohko: 38,
@@ -400,10 +411,14 @@ export const COMMAND = {
confuse: 42,
confusetarget: 43,
heal: 44,
transform: 45,
screen: 46,
poison: 47,
paralyze: 48,
substitute: 49,
rechargenextturn: 50,
mimic: 51,
metronome: 52,
leechseed: 53,
splash: 54,
disable: 55,
@@ -417,7 +432,11 @@ export const COMMAND = {
counter: 64,
encore: 65,
painsplit: 66,
snore: 67,
conversion2: 68,
lockon: 69,
sketch: 70,
sleeptalk: 72,
destinybond: 73,
spite: 74,
falseswipe: 75,
@@ -434,6 +453,7 @@ export const COMMAND = {
spikes: 86,
foresight: 87,
perishsong: 88,
startsandstorm: 89,
endure: 90,
checkrollout: 91,
rolloutpower: 92,
@@ -446,12 +466,15 @@ export const COMMAND = {
safeguard: 100,
checksafeguard: 101,
getmagnitude: 102,
batonpass: 103,
pursuit: 104,
clearhazards: 105,
healmorn: 106,
healday: 107,
healnite: 108,
hiddenpower: 109,
startrain: 110,
startsun: 111,
attackup: 112,
defenseup: 113,
speedup: 114,
@@ -500,6 +523,7 @@ export const COMMAND = {
doubleminimizedamage: 157,
skipsuncharge: 158,
thunderaccuracy: 159,
teleport: 160,
beatup: 161,
ragedamage: 162,
resettypematchup: 163,
+36
View File
@@ -584,6 +584,33 @@ export const MENU = {
/** Battle engine tables and texts, keyed by their PRET labels so that
* \`npm run check:reference\` can verify each address by name. */
export const BATTLE = {
DownpourText: 0x817a3,
SunGotBrightText: 0x817b8,
SandstormBrewedText: 0x816e4,
BattleText_RainContinuesToFall: 0x8091f,
BattleText_TheSunlightIsStrong: 0x80938,
BattleText_TheSandstormRages: 0x80951,
BattleText_TheRainStopped: 0x80967,
BattleText_TheSunlightFaded: 0x8097a,
BattleText_TheSandstormSubsided: 0x8098f,
SandstormHitsText: 0x8084d,
MadeSubstituteText: 0x81362,
HasSubstituteText: 0x81378,
TooWeakSubText: 0x8138d,
SubTookDamageText: 0x813ad,
SubFadedText: 0x813d0,
TransformedText: 0x81499,
MimicLearnedMoveText: 0x813e6,
MirrorMoveFailedText: 0x815c1,
TransformedTypeText: 0x81452,
SketchedText: 0x81143,
FledFromBattleText: 0x812ac,
FledInFearText: 0x812c1,
BlownAwayText: 0x812d2,
DraggedOutText: 0x81544,
MetronomeExcepts: 0x37454,
WeatherTypeModifiers: 0xfbe13,
WeatherMoveModifiers: 0xfbe20,
WasSeededText: 0x813f8,
EvadedText: 0x81407,
LeechSeedSapsText: 0x8080e,
@@ -711,6 +738,15 @@ export const BATTLE = {
BattleText_MonFainted: 0x80a75,
BattleText_MonHasNoMovesLeft: 0x80c72,
BattleText_StringBuffer1GrewToLevel: 0x80c9c,
BattleText_UserRecoveredPPUsing: 0x80899,
BattleText_UserFledUsingAStringBuffer1: 0x80b89,
BattleText_UsersStringBuffer1Activated: 0x80bde,
LoafingAroundText: 0x80f19,
BeganToNapText: 0x80f31,
WontObeyText: 0x80f44,
TurnedAwayText: 0x80f54,
IgnoredOrdersText: 0x80f66,
IgnoredSleepingText: 0x80f7b,
BattleText_TargetRecoveredWithItem: 0x80880,
BattleText_TheMoveIsDisabled: 0x80c5b,
BattleText_TheresNoPPLeftForThisMove: 0x80c39,
+3
View File
@@ -2446,6 +2446,9 @@ export class GameWorld {
pokedex: draft.pokedex,
playerId: this.playerId,
playerName: this.name,
johtoBadges: Array.from({ length: 8 }, (_, bit) =>
draft.flags.has(OW.ENGINE_ZEPHYRBADGE + bit) ? 1 << bit : 0,
).reduce((bits, badge) => bits | badge, 0),
timeOfDay: this.clockTimeOfDay,
random: () => this.random() & 0xff,
wild: effect.wild,