Port the remaining battle items, the stats screen and hBattleTurn at the menu

- Run every non-ball item effect usable in battle from the ROM's
  ItemEffects: Full Restore, revives, bitter medicine, Bitter Berry, Ethers
  and Elixers, X items, X Accuracy, Guard Spec, Dire Hit and Poké Doll.
- Read happiness changes from HappinessChanges, including the larger
  level-up gain where a Pokémon was caught.
- Model hBattleTurn at the battle menu, including the trainer AI's writes,
  and drop the status-heal refusal.
- Port the stats screen for battles and Bill's PC.
- Compare the send-out and withdraw texts, RestoreHealth, RestorePP,
  ChangeHappiness and CalcPlayerStats with the original routines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sébastien QUEROLandClaude Opus 5.5 committed 2026-09-30 11:24:55 +02:00
1 parent cfd083c16d
commit b13e09ec20
22 files changed
+1547 -171

No files matched your search

+1
View File
@@ -31,6 +31,7 @@ export function renderShell(root: HTMLElement) {
<div id="battle-player" class="battle-player"><canvas id="battle-player-pic" width="48" height="48" role="img"></canvas><div class="battle-hud"><div><strong id="battle-player-name"></strong><span id="battle-player-level"></span></div><div class="hp-row"><span>HP</span><span class="hp-bar"><i id="battle-player-hp"></i></span></div><div class="battle-numbers"><span id="battle-player-status" class="battle-status"></span><span id="battle-player-hp-text"></span></div></div></div>
<div class="battle-box"><p id="battle-text" aria-live="polite"></p><div id="battle-menu" class="battle-menu"></div></div>
</div>
<div id="stats-screen" class="stats-screen" hidden aria-label="Pokémon stats"><div class="stats-top"><canvas id="stats-pic" width="56" height="56" role="img"></canvas><div id="stats-header" class="stats-header"></div></div><div id="stats-page" class="stats-page" aria-live="polite"></div><div class="stats-nav"><button id="stats-prev" aria-label="Previous page">◀</button><span id="stats-page-number"></span><button id="stats-next" aria-label="Next page">▶</button><button id="stats-close">Close</button></div></div>
<div id="town-map-view" class="town-map-view" hidden aria-label="Town Map"><canvas id="town-map-canvas" width="160" height="144" role="img" aria-label="Town Map"></canvas><button id="town-map-close">Close map</button></div>
<div id="field-menu" class="field-menu" hidden aria-label="Pack"><p>KEY ITEMS</p><div id="field-items"></div></div>
<div id="mart" class="mart" hidden aria-label="Poké Mart">
+83
View File
@@ -444,6 +444,89 @@ dialog h2 {
.battle-menu .wide {
grid-column: 1 / -1;
}
/* The Pokémon stats screen over the battle: three pages, as the pink,
green and blue pages of StatsScreenMain. */
.stats-screen {
position: absolute;
inset: 0;
z-index: 4;
display: grid;
grid-template-rows: auto 1fr auto;
gap: 8px;
padding: 10px;
overflow-y: auto;
color: var(--ink);
background: #f8f8f0;
border-top: 8px solid var(--stats-page, #e8a0b8);
}
.stats-screen[data-page="1"] {
--stats-page: #88c888;
}
.stats-screen[data-page="2"] {
--stats-page: #88a8e0;
}
.stats-top {
display: flex;
align-items: center;
gap: 12px;
}
.stats-top canvas {
width: min(28vw, 112px);
aspect-ratio: 1;
image-rendering: pixelated;
}
.stats-header p,
.stats-page p {
margin: 0;
white-space: pre-line;
}
.stats-header strong {
font-size: 1.1rem;
}
.stats-page {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 6px 16px;
align-content: start;
padding: 10px 12px;
background: var(--cream);
border: 5px double var(--ink);
font-variant-numeric: tabular-nums;
}
.stats-page dl {
display: grid;
grid-template-columns: max-content 1fr;
gap: 2px 10px;
margin: 0;
}
.stats-page dt {
font-weight: 800;
}
.stats-page dd {
margin: 0;
}
.stats-page .wide {
grid-column: 1 / -1;
}
.stats-nav {
display: flex;
align-items: center;
gap: 8px;
}
.stats-nav button {
padding: 6px 12px;
color: var(--ink);
background: var(--cream-dark);
border: 3px double var(--ink);
}
.stats-nav #stats-close {
margin-left: auto;
}
@media (max-width: 480px) {
.stats-page {
grid-template-columns: minmax(0, 1fr);
}
}
/* NewGame's screens: a plain background over the world until the
introduction ends. */
.intro-screen {