Port the Pokégear, phone calls and Mom's bank
Checks / web (push) Canceled after 0s

POKéGEAR in the start menu runs the clock, Town Map and phone cards with
the original joypad rules. Calls to Elm and Mom run their callee scripts,
with the out-of-area and out-of-hours cases and HangUp's corrected timing.
Mom saves a quarter of trainer prizes once asked, talking to her at home
opens BankOfMom (GET, SAVE, CHANGE and the DST checks) with its digit
amount box, and MomTriesToBuySomething buys items and dolls with her
savings. Saves gain Mom's money, her next item and its trigger balance.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sébastien QUEROLandClaude Opus 5.5 committed 2026-10-01 11:38:22 +02:00
1 parent 3456aa4e11
commit 209778cabe
29 files changed
+2726 -47

No files matched your search

+42 -4
View File
@@ -131,6 +131,8 @@ export type BattleInput = number | string | BattleAction | undefined;
export type BattleOutcome = {
result: number;
prizeMoney?: number;
/** The part of the prize sent to Mom's savings. */
momMoney?: number;
evolvable?: number;
};
@@ -177,6 +179,9 @@ export interface BattleOptions {
landmark?: number;
/** wPartyMenuCursor as the last party menu outside battle left it. */
partyMenuCursor?: number;
/** wMomSavingMoney's MOM_SAVING_MONEY_MASK bits and wMomsMoney: how much
* of a trainer's prize goes to Mom. */
mom?: { saving: number; money: number };
}
/** BATTLERESULT_BOX_FULL: a catch filled the current box. */
@@ -796,16 +801,49 @@ export class Battle {
yield this.hud();
}
if (trainer.winText) yield* this.say(trainer.winText);
const prizeMoney = trainer.reward * (amuletCoin ? 2 : 1);
this.numbers[RAM.battleReward] = prizeMoney;
yield* this.say(BATTLE.GotMoneyForWinningText);
return { result: this.battleResult, prizeMoney, evolvable: this.evolvable };
return {
result: this.battleResult,
...(yield* this.giveMoney(trainer.reward, amuletCoin)),
evolvable: this.evolvable,
};
}
if (trainer && this.options.canLose && trainer.lossText)
yield* this.say(trainer.lossText);
return { result: this.battleResult, evolvable: this.evolvable };
}
/** WinTrainerBattle.give_money: the reward (TrainerClassAttributes'
* base times the last Pokémon's level, which `reward` holds four times)
* is added four times, to Mom for as many quarters as her saving mode
* takes unless her account is full, and to the wallet for the rest. Each
* account stops at MAX_MONEY. The text shows four times the reward. */
private *giveMoney(
reward: number,
amuletCoin: boolean,
): Gen<{ prizeMoney: number; momMoney?: number }> {
const quarter = (reward / 4) * (amuletCoin ? 2 : 1);
const mom = this.options.mom ?? { saving: 0, money: 0 },
maxedOut = mom.money >= C.MAX_MONEY;
if (![0, 1, 2, 3].includes(mom.saving))
throw new UnsupportedBattle("Unsupported Mom saving mode.");
// .CheckMaxedOutMomMoney, then SOME|HALF counts as all four quarters.
const toMom = maxedOut ? 0 : mom.saving === 3 ? 4 : mom.saving;
this.numbers[RAM.battleReward] = quarter * 4;
yield* this.say(
maxedOut || !mom.saving
? BATTLE.GotMoneyForWinningText
: [
BATTLE.SentSomeToMomText,
BATTLE.SentHalfToMomText,
BATTLE.SentAllToMomText,
][mom.saving - 1],
);
return {
prizeMoney: quarter * (4 - toMom),
...(toMom ? { momMoney: quarter * toMom } : {}),
};
}
private *battleTurn(): Gen {
for (let turns = 0; turns < 1000; turns++) {
this.curDamage = 0;