CLOSES #785, CLOSES #807, CLOSES #811, CLOSES #814

This commit is contained in:
bryanthaboi
2026-08-04 15:13:06 -04:00
parent 8fbe819493
commit 0fa8206321
15 changed files with 862 additions and 37 deletions
+15 -7
View File
@@ -418,8 +418,11 @@ function StatBox:draw()
Font.drawBox(9, 2, 11, 10)
love.graphics.setColor(0, 0, 0, 1)
local s = self.mon.stats
local rows = { { "ATTACK", s.attack }, { "DEFENSE", s.defense },
{ "SPEED", s.speed }, { "SPECIAL", s.special } }
-- labels through Strings so a mod catalog translates them (#811)
local rows = { { Strings("ATTACK"), s.attack },
{ Strings("DEFENSE"), s.defense },
{ Strings("SPEED"), s.speed },
{ Strings("SPECIAL"), s.special } }
for i, r in ipairs(rows) do
Font.draw(r[1], 88, 24 + (i - 1) * 16)
Font.draw(("%3d"):format(r[2]), 128, 32 + (i - 1) * 16)
@@ -793,7 +796,7 @@ end
-- tutorial passes failThrow -- it stands in for that event (#636).
function BattleState:makeOldManDemo(name, failThrow)
self.demo = true
self.demoName = name or "OLD MAN"
self.demoName = name or Strings("OLD MAN")
self.demoFails = failThrow and true or false
-- LoadPlayerBackPic and DisplayBattleMenu split on the same wBattleType:
-- BATTLE_TYPE_OLD_MAN gets .oldManName + OldManPicBack, BATTLE_TYPE_PIKACHU
@@ -1566,7 +1569,7 @@ function BattleState:enter()
-- out of the ball after "X sent out Y!" (not the wild "already there"
-- intro that LinkBattle previously inherited from newWild).
self.enemySendingOut = true
self:say(Strings("%s sent\nout %s!", self.opponentName or "FOE",
self:say(Strings("%s sent\nout %s!", self.opponentName or Strings("FOE"),
self.enemy.name))
self:act(function()
self.enemySendingOut = false
@@ -2147,7 +2150,7 @@ function BattleState:oldManThrow()
self.phase = "messages"
self.afterQueue = "finish"
self.result = "run" -- nothing is kept; wBattleResult only ends the demo
self:sayAuto(Strings("%s used\nPOKé BALL!", self.demoName or "OLD MAN"))
self:sayAuto(Strings("%s used\nPOKé BALL!", self.demoName or Strings("OLD MAN")))
self:act(function()
require("src.core.Sound").play(self.data, "Ball_Toss")
-- ItemUseBall's beat before the toss chain (like throwBall)
@@ -5509,8 +5512,13 @@ function BattleState:drawTextArea()
local def = self.data.moves[mv.id]
Font.draw(def and def.name or tostring(mv.id), 48, 96 + i * 8)
end
Font.drawCode((self.moveSwapIndex == self.moveIndex) and 0xEC or 0xED,
40, 96 + self.moveIndex * 8)
-- Swap cursor: SelectMenuItem parks the hollow arrow on the marked row
-- (core.asm:2600-2607), then HandleMenuInput's PlaceMenuCursor writes the
-- filled arrow into the tilemap over it whenever the cursor sits there
-- (home/window.asm:184-185), so the current row is always filled. Only
-- one glyph may land per cell -- drawCode blits black-on-transparent, so
-- stacking 0xED over 0xEC would merge the two arrows (#814).
Font.drawCode(0xED, 40, 96 + self.moveIndex * 8)
if self.moveSwapIndex and self.moveSwapIndex ~= self.moveIndex then
Font.drawCode(0xEC, 40, 96 + self.moveSwapIndex * 8)
end
+19 -9
View File
@@ -26,9 +26,14 @@ local function displayName(b)
return b.isPlayer and b.name or Strings("Enemy %s", b.name) -- #779
end
-- Stat names as printed (data/battle/stat_mod_names.asm
-- StatModTextStrings). Strings.source, not Strings: this table is built
-- at require time, before Strings.load has a catalog, so changeStage
-- looks each label up at use time (#811).
local STAT_LABEL = {
attack = "ATTACK", defense = "DEFENSE", speed = "SPEED",
special = "SPECIAL", accuracy = "ACCURACY", evasion = "EVADE",
attack = Strings.source("ATTACK"), defense = Strings.source("DEFENSE"),
speed = Strings.source("SPEED"), special = Strings.source("SPECIAL"),
accuracy = Strings.source("ACCURACY"), evasion = Strings.source("EVADE"),
}
-- ---------------------------------------------------------------------
@@ -54,14 +59,15 @@ local function changeStage(battle, who, stat, delta, fromEnemy)
who.hazeStatReset = nil
-- _MonsStatsRoseText/_MonsStatsFellText: "X's / STAT rose!"; the
-- two-stage variants scroll "greatly" onto a third line
local label = Strings(STAT_LABEL[stat]) -- looked up here, not at require (#811)
if delta >= 2 then
return { Strings("%s's\n%s\ngreatly rose!", displayName(who), STAT_LABEL[stat]) }
return { Strings("%s's\n%s\ngreatly rose!", displayName(who), label) }
elseif delta == 1 then
return { Strings("%s's\n%s rose!", displayName(who), STAT_LABEL[stat]) }
return { Strings("%s's\n%s rose!", displayName(who), label) }
elseif delta == -1 then
return { Strings("%s's\n%s fell!", displayName(who), STAT_LABEL[stat]) }
return { Strings("%s's\n%s fell!", displayName(who), label) }
end
return { Strings("%s's\n%s\ngreatly fell!", displayName(who), STAT_LABEL[stat]) }
return { Strings("%s's\n%s\ngreatly fell!", displayName(who), label) }
end
MoveEffects.changeStage = changeStage
@@ -494,7 +500,9 @@ MoveEffects.full = {
chooseDamage = function(ctx)
-- no immunity check: SetDamageEffects skips AdjustDamageForMoveType (#616)
local dmg = fixedDamageFor(ctx)
if not dmg then return nil, "But, it failed!" end
if not dmg then
return nil, romText(ctx.battle.data, "_ButItFailedText", "But, it failed!")
end
return dmg, plainInfo()
end,
},
@@ -510,7 +518,7 @@ MoveEffects.full = {
local blocked = immuneMsg(ctx)
if blocked then return false, blocked end
if TurnOrder.effectiveSpeed(ctx.user) < TurnOrder.effectiveSpeed(ctx.target) then
return false, "But, it failed!"
return false, romText(ctx.battle.data, "_ButItFailedText", "But, it failed!")
end
return true
end,
@@ -535,7 +543,9 @@ MoveEffects.full = {
DREAM_EATER_EFFECT = {
-- only works on sleeping targets (checked before damage)
gate = function(ctx)
if ctx.target.mon.status ~= "SLP" then return false, "But, it failed!" end
if ctx.target.mon.status ~= "SLP" then
return false, romText(ctx.battle.data, "_ButItFailedText", "But, it failed!")
end
return true
end,
afterDamage = drainHalf("_DreamWasEatenText", Strings.source("%s's\ndream was eaten!")),
+4 -1
View File
@@ -244,7 +244,10 @@ end
local function drawMoveMenu(battle)
drawMoveGrid(battle, battle.player.curMoves, battle.moveIndex)
if battle.moveSwapIndex then
-- The filled cursor replaces the hollow swap marker when they share a row
-- (PlaceMenuCursor's tilemap write, home/window.asm:184-185); drawCode blits
-- black-on-transparent, so skip the 0xEC instead of stacking glyphs (#814).
if battle.moveSwapIndex and battle.moveSwapIndex ~= battle.moveIndex then
local col = (battle.moveSwapIndex - 1) % 2
local row = math.floor((battle.moveSwapIndex - 1) / 2)
Font.drawCode(0xEC, col == 0 and 8 or 112, 112 + row * 16)