feat(mods): allow caught markers in wild battle HUDs

This commit is contained in:
AverageConsumer
2026-08-10 23:36:38 +02:00
parent 79ed37699e
commit e59175fc89
2 changed files with 52 additions and 4 deletions
+32 -4
View File
@@ -145,6 +145,17 @@ function BattleState:statusHUDVisible()
self) ~= false
end
function BattleState:caughtMarkerVisible()
local dex = self.game and self.game.save and self.game.save.pokedex
if not self.enemy or (self.kind ~= "wild" and self.kind ~= "safari")
or not (dex and dex.owned and dex.owned[self.enemy.mon.species]) then
return false
end
if not Runtime.wantsHook("battle.caught_marker_visible") then return false end
return Runtime.call("battle.caught_marker_visible",
function() return false end, self) == true
end
function BattleState:moveGridNavigation()
if self:wideLayout() then return true end
if not Runtime.wantsHook("battle.move_grid_navigation") then return false end
@@ -4779,7 +4790,7 @@ end
-- Party pokeball row (SetupPokeballs tiles: ball / status ball /
-- fainted ball / empty), 6 slots stepping dx from (x,y).
local ballQuads
function BattleState:drawBallRow(party, x, y, dx)
local function balls()
if ballQuads == nil then
local ok, img = pcall(love.graphics.newImage, "assets/generated/battle/balls.png")
if ok then
@@ -4791,11 +4802,23 @@ function BattleState:drawBallRow(party, x, y, dx)
ballQuads = false
end
end
if not ballQuads then return end
return ballQuads or nil
end
function BattleState:drawCaughtBall(x, y)
local quads = balls()
if not quads then return end
love.graphics.setColor(1, 1, 1, 1)
love.graphics.draw(quads.img, quads[0], x, y)
end
function BattleState:drawBallRow(party, x, y, dx)
local quads = balls()
if not quads then return end
for i = 1, 6 do
local mon = party[i]
local tile = not mon and 3 or mon.hp <= 0 and 2 or mon.status and 1 or 0
love.graphics.draw(ballQuads.img, ballQuads[tile], x + (i - 1) * dx, y)
love.graphics.draw(quads.img, quads[tile], x + (i - 1) * dx, y)
end
end
@@ -5511,7 +5534,12 @@ function BattleState:drawHUDs(slide)
love.graphics.translate(hudShake, 0)
end
love.graphics.setColor(0, 0, 0, 1)
Font.draw(self.enemy.name, nameX(1, self.enemy.name), 0)
local enemyNameX = nameX(1, self.enemy.name)
local enemyNameWidth = Font.draw(self.enemy.name, enemyNameX, 0)
if self:caughtMarkerVisible() then
self:drawCaughtBall(enemyNameX + enemyNameWidth, 0)
love.graphics.setColor(0, 0, 0, 1)
end
if self.enemy.shownStatus then
Font.draw(self:statusLabel({ status = self.enemy.shownStatus }), 40, 8)
else