mirror of
https://github.com/bryanthaboi/gen1recomp
synced 2026-09-26 21:35:42 -04:00
fix(game3/battle): guard from_rom and move_target_byte against nil ROM pack in headless tests
This commit is contained in:
@@ -124,8 +124,8 @@ end
|
||||
local function move_target_byte(mv)
|
||||
if move_num(mv) == 0 then return 0 end
|
||||
local Moves = require("src.core.game3.battle.moves")
|
||||
local m = Moves.get(mv)
|
||||
return tonumber(m and m.target) or 0
|
||||
local ok, m = pcall(Moves.get, mv)
|
||||
return tonumber(ok and m and m.target) or 0
|
||||
end
|
||||
|
||||
local function random_u16(rng)
|
||||
|
||||
@@ -116,6 +116,7 @@ end
|
||||
|
||||
local function from_rom(numId)
|
||||
Moves.romReady()
|
||||
if not Moves._rom then return nil end
|
||||
local row = Moves._rom[numId]
|
||||
if not row then return nil end
|
||||
local cat = Types.isPhysical(row.type) and "physical" or "special"
|
||||
|
||||
Reference in New Issue
Block a user