Breed at the Day-Care, hatch Eggs, draw MAIL stationery and browse the Hall of Fame (Closes #29)
- Day-Care and breeding: deposits, withdrawal pricing and growth, compatibility, egg species, DVs and moves, DayCareStep, egg collection and the Odd Egg, compared with the cartridge's routines. - CountStep: walking happiness, DoEggStep, DayCareStep and DoBikeStep in the original's order; HatchEggs with the ROM's hatch animation, compared frame by frame with the original. - MAIL: all ten stationery types and the Portrait MAIL picture, compared with the cartridge's tilemaps, graphics and palettes. - Printing: Bill's PC boxes, Pokedex PRNT, MAIL and the Photo Studio take the original's absent-printer path. - Hall of Fame records (saved apart from the League flag, ready for the League to call) and the Hall of Fame PC, compared with the cartridge's _HallOfFamePC on 255 pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7d03f5c5ca
commit
e49bc6de9a
49 files changed
+6028
-88
No files matched your search
@@ -0,0 +1,42 @@
|
||||
import type { PartyMon } from "./pokemon";
|
||||
|
||||
/** The happiness a Pokémon has just after hatching (HatchEggs: `ld [hl], $78`),
|
||||
* which replaces the Egg's remaining cycles. */
|
||||
export const HATCHED_HAPPINESS = 0x78;
|
||||
|
||||
/** The counters CountStep keeps in work RAM (wStepCount,
|
||||
* wPoisonStepCount) and StepHappiness's toggle (wHappinessStepCount). */
|
||||
export interface StepCounters {
|
||||
stepCount: number;
|
||||
poisonStepCount: number;
|
||||
happinessStepCount: number;
|
||||
}
|
||||
|
||||
/** StepHappiness (engine/events/happiness_egg.asm): called each time
|
||||
* wStepCount wraps (every 256 steps), it raises the happiness of every
|
||||
* Pokémon that is not an Egg by one on every other call, so once per 512
|
||||
* steps, up to 255. It does not go through ChangeHappiness: no bonus and
|
||||
* no cap other than the byte's, and a Pokémon already at 255 stays there. */
|
||||
export function stepHappiness(
|
||||
counters: Pick<StepCounters, "happinessStepCount">,
|
||||
party: PartyMon[],
|
||||
) {
|
||||
counters.happinessStepCount = (counters.happinessStepCount + 1) & 1;
|
||||
if (counters.happinessStepCount) return;
|
||||
for (const mon of party)
|
||||
if (!mon.egg) mon.happiness = Math.min(0xff, mon.happiness + 1);
|
||||
}
|
||||
|
||||
/** DoEggStep (engine/pokemon/breeding.asm): from the first slot, each Egg's
|
||||
* cycles (kept in its happiness byte) drop by one until one reaches zero,
|
||||
* which ends the loop and reports that an Egg is ready to hatch; the Eggs
|
||||
* after it are not counted down on that step. A byte already at zero
|
||||
* wraps to 255 (`dec [hl]` has no floor) and does not hatch. */
|
||||
export function doEggStep(party: PartyMon[]): boolean {
|
||||
for (const mon of party) {
|
||||
if (!mon.egg) continue;
|
||||
mon.happiness = (mon.happiness - 1) & 0xff;
|
||||
if (!mon.happiness) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
Reference in new issue
Block a user