5 commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
dfc9a2d227 |
rewards: damage, adapter v8 with a v7 migration
The operator's decision of 2026-09-29, chosen over a pad rule that would have withheld a stat move once used: pay the fly for the HP its own attack removes from the Pokemon it is fighting, so the move that deals damage is worth more than the one that does not. Row 67: the live fly lost the Pewter Gym's Jr. Trainer 29 times running with TAIL WHIP 155, BUBBLE 23, TACKLE 0, and nothing in the catalog paid for anything inside a battle it did not win. `damage`, the twelfth kind, 80 ms. 0.20 per whole enemy Pokemon's max HP, paid in proportion on the sample the HP drops; +0.05 when the fly's hit knocks out a trainer's Pokemon; at most 0.50 a battle (the trainer rule's own value, which two Pokemon reach exactly). A wild battle pays at the wild-KO rule's scale, 1, 1/2, 1/3, for its first three battles per (map, species, level) that paid any damage, then nothing, and a rollback blocks every key that has paid (damageCounts, replay-blocked damage:<key>). Trainer battles keep no lifetime ledger: a trainer is fought again only after losing to it. The fly's attack is a drop in wEnemyMonHP on a sample where hWhoseTurn ($FFF3, counted from the hJoyLast anchor to the end of HRAM) reads 0 and wPlayerMoveNum is not STRUGGLE. ApplyDamageToEnemyPokemon runs in ExecutePlayerMove with it 0; the enemy's poison, burn and Leech Seed ticks (HandlePoisonBurnLeechSeed picks the enemy's HP because it is 1), its recoil, confusion self-hit, Explosion and Substitute all land with it 1. Every drop moves the target's mark, so a tick is never paid later as part of a hit. A target is (wEnemyMonPartyPos, species, level) and keeps its lowest HP for the battle, so a heal is never paid twice and a switch back keeps its mark; it is marked when it first reads full HP, because InitBattleVariables leaves the last battle's wEnemyMon in place -- in the row 67 ring that is the same trainer's Diglett at the HP it won with. v7 -> v8. STATE_VERSION stays 4: damageCounts and battle.damage are optional and absent in a v7 state, which restores with no wild key paid and a battle in flight marked where it stands, so nothing lost before the restore is paid. MIGRATES_FROM is [v7, v6]: the chain composes, since v7's own migration (the item seed) still runs in this build on the first sample without items:seeded. Feed: `damage` has no counter (RewardKind::from_adapter -> None). On `wildwin` the stage would fold every hit into "N wild wins", false of a trainer battle and of one the fly goes on to lose. A hit reaches the page as a reward event with its own label, HIT #<species> FOR <n> HP[ KO]; the feed's closed kind set does not move. The compatibility string differs from main's in exactly one segment: pokered-unique8-v7 -> pokered-unique8-v8. Tests: the rule (fly's turn vs the enemy's, Struggle, heal, switch, twin slots, stale enemy, restored battle, cap, knockout, wild scale, round trip); the adapter (proportional pay, TAIL WHIP nothing, poison then hit, the ring's second battle, wild scale and rollback, one read per address, checkpoint round trip, a v7 state mid-battle); compat_migration (v7 and v6 FLYSIM01 envelopes refused without their own opt-in and restored with it; the v7 one mid-battle pays only what follows); rom_damage (FLY_ROW67_CHECKPOINT: the live v7 string and ledger migrate; from the live state BUBBLE and TACKLE are paid on every drop they cause and TAIL WHIP never, the fly's hits land with hWhoseTurn 0 and the enemy's with 1). |
||
|
|
2e7eed0a78 |
rewards: talk and item, boundary indoors pays nothing, adapter v7 with a v6 migration
The operator's decision of 2026-09-23: pay the fly for engaging with what is inside a building, and stop paying it for walking back out of one. Chosen over a pad rule and over weighting the choice, and like v0.5.0's catch reward it is a catalog change, not a loop-review fix. Indoors. engage::indoor is two of the cartridge's own tables: not outside by CheckIfInOutsideMap (tileset OVERWORLD or PLATEAU; WarpFound2 labels the other branch .indoorMaps) and not a place BikeRidingTilesets lets the bike be ridden (OVERWORLD, FOREST, UNDERGROUND, SHIP_PORT, CAVERN). That is every house, mart, center, gym, gate, lab, museum, ship, tower, mansion and hideout, and not Viridian Forest, a cave, the Underground Path or the dock. `talk`, +0.10, 100 ms, the catalog's tenth kind. Paid when the text box closes on a conversation that (1) opened on the sample after one where the fly had the joypad (state::controllable) and was standing still (wWalkCounter zero, the only state the overworld reads A in) on the same tile; (2) is with the thing in front: DisplayTextID copies its argument into wSpriteIndex, a sprite slot up to wNumSprites whose sprite stands on the tile the player faces (or one further across a counter, on a tileset with counter tiles), or a text id matching the sign on that tile; an item ball is not a person; (3) opened indoors; (4) closed on the same map. Keyed talk:<map>:sprite:<slot> / talk:<map>:sign:<id> in the lifetime `seen` ledger, which is checkpointed and survives a rollback -- not the macros' session `talked` ledger. `item`, +0.15, 120 ms, the eleventh. An item ball is a toggleable sprite of this map (wToggleableObjectList) whose wMapSpriteExtraData is (item id, 0), the shape LoadMapHeader writes for an ITEM object_event and nothing else; PickUpItem sets its global bit in wToggleableObjectFlags after GiveItem succeeds. A hidden item is a bit of wObtainedHiddenItemsFlags, set by FoundHiddenItemText after GiveItem and by nothing else. Either pays when its bit rises between two playable samples, once per item (item:<global> / hidden:<index>) for the ledger's life. `boundary` still writes every key indoors, so exit_visited answers what it did and the macros see no change, but emits nothing on an indoor map. Outdoor, forest and cave exits pay as before. v6 -> v7. STATE_VERSION stays 4 and no field is added: the new ledgers are keys in `seen`. A v6 state restores with no talk: keys, and the first playable sample that finds `items:seeded` absent writes one key per item the game already shows as taken, pays for none, and marks the seed -- so a rollback that un-takes a v6 pickup cannot pay for it. The two item balls a script reveals (the Rocket Hideout's Silph Scope and Lift Key, toggles $87 and $88, the only ITEM entries toggleable_objects.asm starts OFF) are left out of the seed. MIGRATES_FROM is ["pokered-unique8-v6"]; v5 is no longer migrated. Feed kinds: both publish on `explore`, the family of new ground and a door found, at the same quiet scale; not `area` (maps, notable), `story` or `wildwin`. No feed-protocol change. The compatibility string differs from main's in exactly one segment: pokered-unique8-v6 -> pokered-unique8-v7. Tests: catalog values and order; indoor over all 24 tilesets; a talk pays once per (map, object), not while the box is open, not re-talked, not outdoors/in the forest/in a cave, not for text opened with the joypad taken, simulated, scripted, mid-step, about someone not in front, or the start menu; not across a warp or a rollback; counter reach only with counter tiles; item balls, people, trainers, hidden items, the seed and the script-shown balls; boundary indoors records and pays nothing; a v6 state and a v6 FLYSIM01 envelope migrate with the new ledgers empty and the items seeded. rom.rs's bedroom walk now proves the stairs are recorded and unpaid on the cartridge. |
||
|
|
23a4d7379b |
rewards: a catch reward, adapter v6 with a v5 migration, and a rung restart
The operator's decision of 2026-09-22: pay the fly for keeping a wild Pokemon, bump the adapter properly, and restart the live run from an early checkpoint rather than from scratch. The rule. `catch` is the catalog's ninth kind, appended so the key order `counts` serializes in does not move. 0.30 for a species this run had never owned, 0.10 for a repeat, three payouts per species for the lifetime of the ledger; the `species` rule is untouched, so a first catch of a new species pays 0.80 across two kinds. The catch is read from `wCapturedMonSpecies` ($d11c), whose comment in ram/wram.asm is "0 if no mon was captured": ItemUseBall zeroes it before every throw and writes wEnemyMonSpecies into it only on the branch that keeps the Pokemon, and UseBagItem's `.returnAfterCapturingMon` zeroes it again and sets wBattleResult to 2 -- a value written on exactly two paths in the game, that one and a link battle whose opponent ran. Both are required, so a byte read out of a half-initialised battle cannot pay. Not wPartyCount: a catch with a full party raises wBoxCount instead, and wPartyCount also rises for a gift, a trade and a PC withdrawal. "Never owned this run" is the `species` payout inside the same battle, because nothing else can set a Pokedex bit during one. It is not read off the captured species byte: that is the cartridge's internal index while the owned bitset is by Pokedex number, and nothing in WRAM converts between them. The address was resolved by tools/resolve_wram.py, not written by hand. The tool needed NUM_TMS and NUM_HMS, which the decomp defines through its `const` enumeration, so it now counts them from the file's own add_tm/add_hm definitions and cross-checks NUM_TMS against the literal the same file declares. The feed's kinds are closed, so `catch` publishes on `wildwin` and nothing in packages/feed or apps/stage changed. Deliberately not `pokedex`: the `species` rule already pays for the bit the same catch sets. The stage's ticker copy is keyed on the feed kind, so a catch row reads "wild win" -- stated in docs/rewards-learning.md rather than left to be discovered. v5 -> v6. STATE_VERSION stays 4: the rule adds one counter, `catchCounts`, and changes nothing else, so a v5 state restores with it empty. That migration is opt-in and needs all three of: the adapter segment being the only difference between the two compatibility strings, the running adapter listing the checkpoint's adapter in `migrates_from()`, and the deploy naming it in FLY_ACCEPT_ADAPTERS. flysim applies the rule at restore and 05-deploy's gate applies the same rule before it flips the symlink, writing the variable into fly.env so the two cannot disagree. The restart. infra/bin/fly-reset-to-milestone <N> archives both stores to a dated directory, rewrites milestone-<N>.checkpoint with the ratchet's attempts and recoveries at zero, installs it as the newest generation of both stores, clears the milestone archives above N and the event log, and prints what it did. It refuses while flysim is running and refuses a rung the run never reached. The envelope work is in flysim::reset (`flysim --reset-to-milestone N`); the shell script is the operator's wrapper. Tests: catalog values and order; a synthetic WRAM trace of a catch (new, repeat, cap, already-owned species, trainer/Safari/old-man/missed-ball negatives, rollback replay); a v5 state restoring with the counter at zero; a v5 checkpoint fixture accepted with the opt-in and refused without it; the reset tool against copies of a state dir in temp directories; and a ROM-gated catch from a rung-9 forest checkpoint, driven by the shipping THROW BALL macro. The compatibility string differs from main's in exactly one segment, checked by splitting both on `/`: pokered-unique8-v5 -> pokered-unique8-v6. |
||
|
|
68228ef2a1 |
gb: decode the whole current map into a walkability grid
The walkable predicate answered for the ten-by-nine screen window and Unknown everywhere else. MapGrid is the same rule over every tile of the loaded map: block ids out of wOverworldMap, a blocks-to-tiles read of the tileset header s blockset through the new bank-aware ROM read, the tileset s collision list as before, and the TilePairCollisionsLand values as directed walls both ways. The reader checks itself before it answers: the decode is compared against the window predicate over the player s own neighbourhood, and a frame where the window can answer for none of it -- a battle, a text box, a frame mid-warp -- is refused, because wOverworldMap shares its bytes with the picture buffer. Every refusal is named (GridRefusal) and leaves the window predicate in charge. Cached per map id and size, so a map is decoded once on arrival rather than once per question, and owned beside the session ledgers: never checkpointed. |
||
|
|
660c3cf00d |
flybrain v0.4.0: public tree (history retained privately)
Some checks failed
|