Standardize skill strategies for Yellow

This commit is contained in:
Kyle Coburn 2015-04-12 11:29:20 -07:00
parent 04780ef769
commit 6412bab195
5 changed files with 93 additions and 106 deletions

View File

@ -282,6 +282,16 @@ strategyFunctions.tweetVictoryRoad = function()
return true
end
strategyFunctions.bicycle = function()
if Memory.value("player", "bicycle") == 1 then
if Textbox.handle() then
return true
end
else
return Strategies.useItem({item="bicycle"})
end
end
strategyFunctions.fightXAccuracy = function()
return Strategies.prepare("x_accuracy")
end
@ -1053,85 +1063,40 @@ strategyFunctions.trashcans = function()
status.canProgress = true
end
Input.cancel()
else
if progress == 3 then
local px, py = Player.position()
if px == 4 and py == 6 then
status.tries = status.tries + 1
local timeLimit = Strategies.getTimeRequirement("trash") + 1.5
if Strategies.resetTime(timeLimit, "complete Trashcans ("..status.tries.." tries)") then
return true
end
Strategies.setYolo("trash")
local prefix
local suffix = "!"
if status.tries < 2 then
prefix = "PERFECT"
elseif status.tries < 4 then
prefix = "Amazing"
elseif status.tries < 7 then
prefix = "Great"
elseif status.tries < 10 then
prefix = "Good"
elseif status.tries < 24 then
prefix = "Ugh"
suffix = ""
else -- TODO trashcans WR
prefix = "Reset me now"
suffix = " BibleThump"
end
Bridge.chat(" "..prefix..", "..status.tries.." try Trashcans"..suffix, Utils.elapsedTime())
return true
end
local completePath = {
Down = {{2,11}, {8,7}},
Right = {{2,12}, {3,12}, {2,6}, {3,6}},
Left = {{9,8}, {8,8}, {7,8}, {6,8}, {5,8}, {9,10}, {8,10}, {7,10}, {6,10}, {5,10}, {}, {}, {}, {}, {}, {}},
}
local walkIn = "Up"
for dir,tileset in pairs(completePath) do
for i,tile in ipairs(tileset) do
if px == tile[1] and py == tile[2] then
walkIn = dir
break
end
end
end
Input.press(walkIn, 0)
elseif progress == 2 then
if status.canProgress then
status.canProgress = false
Walk.invertCustom()
end
local inverse = {
Up = "Down",
Right = "Left",
Down = "Up",
Left = "Right"
}
Player.interact(inverse[status.direction])
else
local trashPath = {{2,11},{"Left"},{2,11}, {2,12},{4,12},{4,11},{"Right"},{4,11}, {4,9},{"Left"},{4,9}, {4,7},{"Right"},{4,7}, {4,6},{2,6},{2,7},{"Left"},{2,7}, {2,6},{4,6},{4,8},{9,8},{"Up"},{9,8}, {8,8},{8,9},{"Left"},{8,9}, {8,10},{9,10},{"Down"},{9,10},{8,10}}
if status.direction and type(status.direction) == "number" then
local px, py = Player.position()
local dx, dy = px, py
if py < 12 then
dy = 12
elseif status.direction == 1 then
dx = 2
else
dx = 8
end
if px ~= dx or py ~= dy then
Walk.step(dx, dy)
return
end
status.direction = nil
end
status.direction = Walk.custom(trashPath, status.canProgress)
elseif progress == 3 then
return Strategies.completeCans()
elseif progress == 2 then
if status.canProgress then
status.canProgress = false
Walk.invertCustom()
end
local inverse = {
Up = "Down",
Right = "Left",
Down = "Up",
Left = "Right"
}
Player.interact(inverse[status.direction])
else
local trashPath = {{2,11},{"Left"},{2,11}, {2,12},{4,12},{4,11},{"Right"},{4,11}, {4,9},{"Left"},{4,9}, {4,7},{"Right"},{4,7}, {4,6},{2,6},{2,7},{"Left"},{2,7}, {2,6},{4,6},{4,8},{9,8},{"Up"},{9,8}, {8,8},{8,9},{"Left"},{8,9}, {8,10},{9,10},{"Down"},{9,10},{8,10}}
if status.direction and type(status.direction) == "number" then
local px, py = Player.position()
local dx, dy = px, py
if py < 12 then
dy = 12
elseif status.direction == 1 then
dx = 2
else
dx = 8
end
if px ~= dx or py ~= dy then
Walk.step(dx, dy)
return
end
status.direction = nil
end
status.direction = Walk.custom(trashPath, status.canProgress)
status.canProgress = false
end
end

View File

@ -626,6 +626,10 @@ Strategies.functions = {
elseif not data.dir or Player.face(data.dir) then
if Pokemon.use(data.move) then
status.tries = status.tries + 1
elseif yellow and Memory.value("battle", "menu") == 19 then
if Textbox.handle() then
return true
end
else
Menu.pause()
end
@ -661,16 +665,6 @@ Strategies.functions = {
end
end,
bicycle = function()
if Memory.raw(0x1700) == 1 then
if Textbox.handle() then
return true
end
else
return Strategies.useItem({item="bicycle"})
end
end,
swap = function(data)
if Strategies.initialize() then
if not Inventory.contains(data.item) then
@ -1121,7 +1115,12 @@ Strategies.functions = {
strategyFunctions = Strategies.functions
function Strategies.execute(data)
if strategyFunctions[data.s](data) then
local strategyFunction = strategyFunctions[data.s]
if not strategyFunction then
p("INVALID STRATEGY", data.s, GAME_NAME)
return true
end
if strategyFunction(data) then
status = {tries=0}
Strategies.status = status
Strategies.completeGameStrategy()

View File

@ -121,6 +121,16 @@ local function takeCenter(pp, startMap, entranceX, entranceY, finishX)
Walk.step(px, py)
end
strategyFunctions.bicycle = function()
if Memory.value("battle", "menu") == 19 then
if Textbox.handle() then
return true
end
else
return Strategies.useItem({item="bicycle"})
end
end
-- STRATEGIES
-- dodgePalletBoy

View File

@ -5,6 +5,8 @@ local Input = require "util.input"
local Memory = require "util.memory"
local Menu = require "util.menu"
local yellow = YELLOW
local pokeIDs = {
rhydon = 1,
kangaskhan = 2,
@ -125,6 +127,33 @@ local function indexOf(...)
end
Pokemon.indexOf = indexOf
local function fieldMoveIndex(move)
local moveIndex = 0
local menuSize = Memory.value("menu", "size")
if yellow then
if move == "cut" then
moveIndex = 1
end
else
if menuSize == 4 then
if move == "dig" then
moveIndex = 1
elseif move == "surf" then
if Pokemon.inParty("paras") then
moveIndex = 1
end
end
elseif menuSize == 5 then
if move == "dig" then
moveIndex = 2
elseif move == "surf" then
moveIndex = 1
end
end
end
return moveIndex
end
-- Table functions
function Pokemon.battleMove(name)
@ -261,24 +290,7 @@ function Pokemon.use(move)
if column == 11 then
Menu.select(1, true)
elseif column == 10 or column == 12 then
local midx = 0
local menuSize = Memory.value("menu", "size")
if menuSize == 4 then
if move == "dig" then
midx = 1
elseif move == "surf" then
if Pokemon.inParty("paras") then
midx = 1
end
end
elseif menuSize == 5 then
if move == "dig" then
midx = 2
elseif move == "surf" then
midx = 1
end
end
Menu.select(midx, true)
Menu.select(fieldMoveIndex(move), true)
else
Input.press("B")
end

View File

@ -35,6 +35,7 @@ local memoryNames = {
repel = 0x10DB,
party_size = 0x1163,
inventory_count = 0x131D,
bicycle = 0x1700,
},
game = {
map = 0x135E,