mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-16 08:11:35 +02:00
fix testsZ
This commit is contained in:
@@ -266,7 +266,10 @@ function OakSpeech.new(game, onDone)
|
||||
-- RedSprite: the walking sprite the pic shrinks into (frame 0 =
|
||||
-- standing, facing down)
|
||||
local playerSprites = (game.data.field and game.data.field.playerSprites) or {}
|
||||
local red = game.data.sprites and game.data.sprites[playerSprites.walk or "SPRITE_RED"] or game.data.sprites.SPRITE_RED
|
||||
-- The fallback has to read the same guarded table: reaching for
|
||||
-- game.data.sprites.SPRITE_RED after the `and` already found it nil threw.
|
||||
local sprites = game.data.sprites or {}
|
||||
local red = sprites[playerSprites.walk or "SPRITE_RED"] or sprites.SPRITE_RED
|
||||
self.walkSheet = tryImage(red and red.image)
|
||||
return self
|
||||
end
|
||||
|
||||
@@ -3517,10 +3517,21 @@ end
|
||||
|
||||
function OverworldState:onStepComplete()
|
||||
local p = self.player
|
||||
local suppressWildEncounter = self.wildEncounterGraceSteps > 0
|
||||
if suppressWildEncounter then
|
||||
self.wildEncounterGraceSteps = self.wildEncounterGraceSteps - 1
|
||||
-- Defaulted: a state built without the constructor (a mod harness, a test
|
||||
-- fixture) reaches this before :234 ever ran, and nil > 0 threw the step.
|
||||
local grace = self.wildEncounterGraceSteps or 0
|
||||
if grace > 0 then
|
||||
self.wildEncounterGraceSteps = grace - 1
|
||||
end
|
||||
-- TryDoWildEncounter's first guard is `ld a, [wNPCMovementScriptPointerTable
|
||||
-- Num] / and a / ret nz` (engine/battle/wild_encounters.asm:3-9): a step the
|
||||
-- player did not take never rolls, which is why Oak's escort walks to the lab
|
||||
-- through Pallet's grass without being jumped.
|
||||
local runner = self.runner
|
||||
local scripted = (runner and runner.isRunning and runner:isRunning())
|
||||
or #(self.scriptMoves or {}) > 0
|
||||
or self.engaging or self.emote or self.teleportOut
|
||||
local suppressWildEncounter = grace > 0 or scripted and true or false
|
||||
self.todSteps = (self.todSteps or 0) + 1
|
||||
-- UpdatePikachuHappinessAndMood rides the step counter (poison.asm)
|
||||
require("src.world.PikachuFollower").onStep(Game.save)
|
||||
|
||||
@@ -3946,7 +3946,8 @@ function World:rollEncounter(kind, terrain, tables, vanilla)
|
||||
local ctx = {
|
||||
mapId = map and map.id,
|
||||
terrain = terrain,
|
||||
rng = love.math.random,
|
||||
-- Same guard World:rockRandom uses: a headless suite has no love global.
|
||||
rng = (love and love.math and love.math.random) or math.random,
|
||||
kind = kind,
|
||||
daytime = self.daytime,
|
||||
environment = map and map.def and map.def.environment,
|
||||
|
||||
Reference in New Issue
Block a user