mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-18 19:54:21 +02:00
solving more things and making the auto-player work almost perfectly
This commit is contained in:
@@ -92,6 +92,12 @@ local LAST_MAP_REWRITES = {
|
||||
UNDERGROUND_PATH_ROUTE_6 = { rules = { { map = "ROUTE_6" } } },
|
||||
UNDERGROUND_PATH_ROUTE_7 = { rules = { { map = "ROUTE_7" } } },
|
||||
UNDERGROUND_PATH_ROUTE_8 = { rules = { { map = "ROUTE_8" } } },
|
||||
-- DiglettsCaveRoute{2,11}_Script are the same pattern for the cave's two
|
||||
-- entrance houses. Without these, crossing the cave and taking the far
|
||||
-- house's LAST_MAP door warps you back to the route you ENTERED from --
|
||||
-- the whole cave was a one-way trip that always returned to its start.
|
||||
DIGLETTS_CAVE_ROUTE_2 = { rules = { { map = "ROUTE_2" } } },
|
||||
DIGLETTS_CAVE_ROUTE_11 = { rules = { { map = "ROUTE_11" } } },
|
||||
}
|
||||
|
||||
FieldDefaults.FIELD = {
|
||||
|
||||
@@ -1506,6 +1506,21 @@ function OverworldState:trySurf(fx, fy)
|
||||
end
|
||||
|
||||
function OverworldState:tryCut(fx, fy)
|
||||
-- UsedCut (engine/overworld/cut.asm) gates on the TILESET before
|
||||
-- anything else: only OVERWORLD (tree tile $3d) and GYM (plant tile
|
||||
-- $50) have cuttable anything. Matching raw block ids alone
|
||||
-- false-positives on every other tileset -- block ids are only
|
||||
-- meaningful within one tileset, so Route 23 (PLATEAU) had blocks
|
||||
-- matching a swap's `before`, and applying it wrote a block id that
|
||||
-- does not exist in PLATEAU's block table: the renderer indexed nil
|
||||
-- and the game crashed. The same false match is what made the bot
|
||||
-- chain-cut "ornamental bushes" around Saffron and Celadon.
|
||||
local ts = self.map.def.tileset
|
||||
local tile = self.map:cellTile(fx, fy)
|
||||
if not ((ts == "OVERWORLD" and tile == 0x3d)
|
||||
or (ts == "GYM" and tile == 0x50)) then
|
||||
return false
|
||||
end
|
||||
local bx, by = math.floor(fx / 2), math.floor(fy / 2)
|
||||
local block = self.map:blockAt(bx, by)
|
||||
local swap
|
||||
@@ -1591,6 +1606,15 @@ function OverworldState:useCutFieldMove()
|
||||
if not self:partyKnows("CUT") then return "no_badge" end
|
||||
local fx, fy = self.player:facingCell()
|
||||
if not self.map:inBounds(fx, fy) then return "nothing" end
|
||||
-- same tileset/tile gate as tryCut (UsedCut, engine/overworld/cut.asm):
|
||||
-- a tree BLOCK also contains fence/path cells, and facing those is
|
||||
-- "nothing to cut" in vanilla
|
||||
local ts = self.map.def.tileset
|
||||
local tile = self.map:cellTile(fx, fy)
|
||||
if not ((ts == "OVERWORLD" and tile == 0x3d)
|
||||
or (ts == "GYM" and tile == 0x50)) then
|
||||
return "nothing"
|
||||
end
|
||||
local bx, by = math.floor(fx / 2), math.floor(fy / 2)
|
||||
local block = self.map:blockAt(bx, by)
|
||||
local swap
|
||||
|
||||
Reference in New Issue
Block a user