mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-17 19:24:01 +02:00
feat(mods): expose Fly and Softboiled field actions
This commit is contained in:
@@ -24,7 +24,11 @@ local redWorld = {
|
||||
}
|
||||
local redGame = {
|
||||
data = { field = { outsideTilesets = { "OVERWORLD" } },
|
||||
items = { OLD_ROD = { name = "OLD ROD" } } },
|
||||
items = { OLD_ROD = { name = "OLD ROD" } },
|
||||
maps = { PALLET_TOWN = { index = 0, tileset = "OVERWORLD" },
|
||||
ROUTE_4 = { index = 11, tileset = "OVERWORLD" } },
|
||||
pokemon = { CHANSEY = { name = "CHANSEY" },
|
||||
PIKACHU = { name = "PIKACHU" } } },
|
||||
save = { player = { name = "RED" }, party = {},
|
||||
inventory = { BICYCLE = 1, OLD_ROD = 1 } },
|
||||
stack = { states = { redWorld } },
|
||||
@@ -42,6 +46,7 @@ T.check(type(RedWorld.useBicycle) == "function"
|
||||
and type(RedWorld.useFishingRod) == "function"
|
||||
and type(RedWorld.useFlashFieldMove) == "function"
|
||||
and type(RedWorld.useStrengthFieldMove) == "function"
|
||||
and type(RedWorld.useSoftboiledFieldMove) == "function"
|
||||
and type(RedWorld.stopSurfing) == "function",
|
||||
"Red keeps field-action execution in its world")
|
||||
local actions = red:availableFieldActions()
|
||||
@@ -93,6 +98,40 @@ T.check(redWorld.cutUsed and redWorld.surfUsed and redWorld.strengthUsed
|
||||
and redWorld.flashUsed and redWorld.teleportUsed,
|
||||
"Red delegates every move to its overworld path")
|
||||
|
||||
local source = { species = "CHANSEY", level = 30, hp = 80,
|
||||
stats = { hp = 100 }, moves = { { id = "SOFTBOILED" } } }
|
||||
local target = { species = "PIKACHU", level = 20, hp = 10,
|
||||
stats = { hp = 50 }, moves = {} }
|
||||
redGame.save.party = { source, target }
|
||||
redWorld.useSoftboiledFieldMove = function(self, user, recipient)
|
||||
self.softboiled = { user, recipient }
|
||||
return true
|
||||
end
|
||||
byId = {}
|
||||
for _, action in ipairs(red:availableFieldActions()) do byId[action.id] = action end
|
||||
T.check(byId.softboiled and byId.softboiled.sources[1].targets[1].slot == 2,
|
||||
"Red lists only valid SOFTBOILED targets")
|
||||
T.check(red:useFieldAction("softboiled", { sourceSlot = 1, targetSlot = 2 }),
|
||||
"Red accepts a listed SOFTBOILED transfer")
|
||||
T.check(redWorld.softboiled[1] == source and redWorld.softboiled[2] == target,
|
||||
"Red delegates SOFTBOILED to its overworld path")
|
||||
ok, err = red:useFieldAction("softboiled", { sourceSlot = 2, targetSlot = 1 })
|
||||
T.check(not ok and err == "softboiled target unavailable",
|
||||
"Red rejects an invalid SOFTBOILED source")
|
||||
|
||||
redGame.save.inventory.THUNDERBADGE = 1
|
||||
redGame.save.visited = { PALLET_TOWN = true, ROUTE_4 = true }
|
||||
redGame.data.field.flyOrder = { "PALLET_TOWN", "ROUTE_4" }
|
||||
redGame.data.field.flyWarps = { PALLET_TOWN = true, ROUTE_4 = true }
|
||||
redMoves.FLY = source
|
||||
redWorld.flyTo = function(self, mapId) self.flewTo = mapId end
|
||||
T.check(red:canFly(), "Red exposes FLY only in a valid outdoor context")
|
||||
T.check(red:flyTo("PALLET_TOWN") and redWorld.flewTo == "PALLET_TOWN",
|
||||
"Red validates and delegates a visited FLY destination")
|
||||
ok, err = red:flyTo("ROUTE_4")
|
||||
T.check(not ok and err == "destination unavailable",
|
||||
"Red rejects a fly warp that is not a native town destination")
|
||||
|
||||
redSurf = "dismount"
|
||||
redWorld.player.surfing = true
|
||||
redWorld.stopSurfing = function(self) self.dismounted = true end
|
||||
|
||||
Reference in New Issue
Block a user