intro api upgrade (#294)

* intro api upgrade

* api updates

* fix tests

* updated templates
This commit is contained in:
bryanthaboi
2026-07-27 08:37:11 -04:00
committed by GitHub
parent 08e8dfc416
commit be90e5b42c
42 changed files with 1880 additions and 153 deletions
+17 -4
View File
@@ -299,8 +299,13 @@ local function makeBattler(data, mon, isPlayer, save)
curStats = mon.stats,
curTypes = def.types,
curMoves = mon.moves,
sprite = getImage(isPlayer and def.spriteBack or def.spriteFront,
monPalette(data, mon.species), def.trueColor),
sprite = (function()
local Sprites = require("src.pokemon.Sprites")
local path, tc = Sprites.path(data, mon.species,
isPlayer and "back" or "front",
{ mon = mon, kind = "battle" })
return getImage(path, monPalette(data, mon.species), tc)
end)(),
}
end
@@ -318,13 +323,16 @@ BattleState.makeBattler = makeBattler
function BattleState:speciesSprite(species, isPlayerSide)
local def = self.data.pokemon[species]
if not def then return nil end
local Sprites = require("src.pokemon.Sprites")
local path, tc = Sprites.path(self.data, species,
isPlayerSide and "back" or "front", { kind = "battle" })
local PaletteFX = require("src.render.PaletteFX")
local colors = PaletteFX.monPal(self.data, species, true)
local name = "GRAYMON"
if PaletteFX.usesGbcPack() then name = "redpp:GRAYMON" end
return getImage(isPlayerSide and def.spriteBack or def.spriteFront,
return getImage(path,
colors and { name = name, colors = colors } or nil,
def.trueColor)
tc)
end
local function markSeen(game, species)
@@ -4473,6 +4481,11 @@ function BattleState:draw()
love.graphics.rectangle("fill", 0, 0, 160, 144)
end
love.graphics.setColor(1, 1, 1, 1)
-- battle.overlay: shiny sparkles, custom HUD chrome, etc. Draw-only;
-- the vanilla link is a no-op so an empty chain costs nothing.
if Runtime.wantsHook("battle.overlay") then
Runtime.call("battle.overlay", function() end, self)
end
end
return BattleState
+6 -2
View File
@@ -581,8 +581,12 @@ MoveEffects.full = {
},
HYPER_BEAM_EFFECT = {
afterDamage = function(ctx)
-- no recharge when the target faints OR its substitute breaks
if ctx.target.mon.hp > 0 and not ctx.brokeSub then
-- Gen 1: no recharge when the target faints OR its substitute breaks.
-- Ruleset hyperBeamSkipRechargeOnKO=false forces Gen 2+ always-recharge.
local ruleset = ctx.battle and ctx.battle.ruleset
local skipOnKO = not ruleset or ruleset.hyperBeamSkipRechargeOnKO ~= false
local targetDown = ctx.target.mon.hp <= 0 or ctx.brokeSub
if not skipOnKO or not targetDown then
ctx.user.mustRecharge = true
end
end,
+3
View File
@@ -16,4 +16,7 @@ return {
-- Wild/trainer enemies never spend PP (DecrementPP only touches the
-- player side in pokered). They therefore never Struggle from empty PP.
enemyUnlimitedPP = true,
-- Gen 1 Hyper Beam: no recharge when the target faints (or its
-- substitute breaks). Set false to always recharge like Gen 2+.
hyperBeamSkipRechargeOnKO = true,
}
+2
View File
@@ -11,4 +11,6 @@ return {
focusEnergyBug = false,
-- Gen 2+ style: AI opponents deplete PP and can Struggle when empty.
enemyUnlimitedPP = false,
-- Gen 2+: Hyper Beam always forces a recharge turn, even on a KO.
hyperBeamSkipRechargeOnKO = false,
}