2014-07-12 18:47:39 -07:00
|
|
|
local strategies = {}
|
|
|
|
|
|
|
|
local combat = require "ai.combat"
|
|
|
|
local control = require "ai.control"
|
|
|
|
|
|
|
|
local battle = require "action.battle"
|
|
|
|
local shop = require "action.shop"
|
|
|
|
local textbox = require "action.textbox"
|
|
|
|
local walk = require "action.walk"
|
|
|
|
|
|
|
|
local bridge = require "util.bridge"
|
|
|
|
local input = require "util.input"
|
|
|
|
local memory = require "util.memory"
|
|
|
|
local menu = require "util.menu"
|
|
|
|
local player = require "util.player"
|
|
|
|
local utils = require "util.utils"
|
|
|
|
|
|
|
|
local inventory = require "storage.inventory"
|
|
|
|
local pokemon = require "storage.pokemon"
|
|
|
|
|
2015-03-30 14:46:37 -07:00
|
|
|
local areaName = "Unknown"
|
|
|
|
local splitNumber, splitTime = 0, 0
|
2014-07-12 18:47:39 -07:00
|
|
|
local tries = 0
|
|
|
|
local tempDir, canProgress, initialized
|
2015-03-30 14:46:37 -07:00
|
|
|
local level4Nidoran = true -- 57 vs 96 (d39)
|
2014-07-12 18:47:39 -07:00
|
|
|
local nidoAttack, nidoSpeed, nidoSpecial = 0, 0, 0
|
|
|
|
local squirtleAtt, squirtleDef, squirtleSpd, squirtleScl
|
2015-03-30 14:46:37 -07:00
|
|
|
local yolo, deepRun, resetting, riskGiovanni, maxEtherSkip
|
2015-01-19 17:11:52 -08:00
|
|
|
|
2015-03-28 17:16:04 -07:00
|
|
|
-- TIME CONSTRAINTS
|
2014-07-12 18:47:39 -07:00
|
|
|
|
|
|
|
local timeRequirements = {
|
2015-03-28 17:16:04 -07:00
|
|
|
|
|
|
|
nidoran = function()
|
|
|
|
local timeLimit = 6.25
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.inParty("spearow") then
|
2015-03-28 17:16:04 -07:00
|
|
|
timeLimit = timeLimit + 0.67
|
|
|
|
end
|
|
|
|
return timeLimit
|
|
|
|
end,
|
|
|
|
|
|
|
|
mt_moon = function()
|
|
|
|
local timeLimit = 27
|
2015-03-30 15:29:00 -07:00
|
|
|
if nidoAttack > 15 and nidoSpeed > 14 then
|
2015-03-28 17:16:04 -07:00
|
|
|
timeLimit = timeLimit + 0.25
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.inParty("paras") then
|
2015-03-28 17:16:04 -07:00
|
|
|
timeLimit = timeLimit + 0.75
|
|
|
|
end
|
|
|
|
return timeLimit
|
|
|
|
end,
|
|
|
|
|
2014-07-12 18:47:39 -07:00
|
|
|
mankey = function()
|
|
|
|
local timeLimit = 33
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.inParty("paras") then
|
2014-07-12 18:47:39 -07:00
|
|
|
timeLimit = timeLimit + 0.75
|
|
|
|
end
|
|
|
|
return timeLimit
|
|
|
|
end,
|
|
|
|
|
|
|
|
goldeen = function()
|
|
|
|
local timeLimit = 38
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.inParty("paras") then
|
2014-07-12 18:47:39 -07:00
|
|
|
timeLimit = timeLimit + 0.75
|
|
|
|
end
|
|
|
|
return timeLimit
|
|
|
|
end,
|
|
|
|
|
|
|
|
misty = function()
|
|
|
|
local timeLimit = 40
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.inParty("paras") then
|
2014-07-12 18:47:39 -07:00
|
|
|
timeLimit = timeLimit + 0.75
|
|
|
|
end
|
|
|
|
return timeLimit
|
|
|
|
end,
|
|
|
|
|
|
|
|
vermilion = function()
|
|
|
|
return 44.25
|
|
|
|
end,
|
|
|
|
|
|
|
|
trash = function()
|
|
|
|
local timeLimit = 47
|
2015-03-30 15:29:00 -07:00
|
|
|
if nidoSpecial > 44 then
|
2014-07-12 18:47:39 -07:00
|
|
|
timeLimit = timeLimit + 0.25
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if nidoAttack > 53 then
|
2014-07-12 18:47:39 -07:00
|
|
|
timeLimit = timeLimit + 0.25
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if nidoAttack >= 54 and nidoSpecial >= 45 then
|
2014-07-12 18:47:39 -07:00
|
|
|
timeLimit = timeLimit + 0.25
|
|
|
|
end
|
|
|
|
return timeLimit
|
|
|
|
end,
|
|
|
|
|
|
|
|
safari_carbos = function()
|
|
|
|
return 70.5
|
|
|
|
end,
|
|
|
|
|
|
|
|
e4center = function()
|
|
|
|
return 102
|
|
|
|
end,
|
|
|
|
|
|
|
|
blue = function()
|
|
|
|
return 108.2
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
|
2015-03-28 17:16:04 -07:00
|
|
|
-- RISK/RESET
|
2014-07-12 18:47:39 -07:00
|
|
|
|
|
|
|
local function hardReset(message, extra)
|
|
|
|
resetting = true
|
2015-03-30 15:29:00 -07:00
|
|
|
if extra then
|
2014-07-12 18:47:39 -07:00
|
|
|
message = message.." | "..extra
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if strategies.seed then
|
2014-07-12 18:47:39 -07:00
|
|
|
message = message.." | "..strategies.seed
|
|
|
|
end
|
|
|
|
bridge.chat(message)
|
|
|
|
client.reboot_core()
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
local function reset(reason, extra)
|
2015-03-30 14:46:37 -07:00
|
|
|
local time = utils.elapsedTime()
|
2014-07-12 18:47:39 -07:00
|
|
|
local resetString = "Reset"
|
2015-03-30 15:29:00 -07:00
|
|
|
if time then
|
2014-07-12 18:47:39 -07:00
|
|
|
resetString = resetString.." after "..time
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if areaName then
|
2014-07-12 18:47:39 -07:00
|
|
|
resetString = " "..resetString.." at "..areaName
|
|
|
|
end
|
|
|
|
local separator
|
2015-03-30 15:29:00 -07:00
|
|
|
if deepRun and not yolo then
|
2014-07-12 18:47:39 -07:00
|
|
|
separator = " BibleThump"
|
|
|
|
else
|
|
|
|
separator = ":"
|
|
|
|
end
|
|
|
|
resetString = resetString..separator.." "..reason
|
|
|
|
return hardReset(resetString, extra)
|
|
|
|
end
|
|
|
|
strategies.reset = reset
|
|
|
|
|
|
|
|
local function resetDeath(extra)
|
|
|
|
local reason
|
2015-03-30 15:29:00 -07:00
|
|
|
if strategies.criticaled then
|
2014-07-12 18:47:39 -07:00
|
|
|
reason = "Critical'd"
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif yolo then
|
2014-07-12 18:47:39 -07:00
|
|
|
reason = "Yolo strats"
|
|
|
|
else
|
|
|
|
reason = "Died"
|
|
|
|
end
|
|
|
|
return reset(reason, extra)
|
|
|
|
end
|
|
|
|
strategies.death = resetDeath
|
|
|
|
|
|
|
|
local function overMinute(min)
|
|
|
|
return utils.igt() > min * 60
|
|
|
|
end
|
|
|
|
|
|
|
|
local function resetTime(timeLimit, reason, once)
|
2015-03-30 15:29:00 -07:00
|
|
|
if overMinute(timeLimit) then
|
2014-07-12 18:47:39 -07:00
|
|
|
reason = "Took too long to "..reason
|
2015-03-30 15:29:00 -07:00
|
|
|
if RESET_FOR_TIME then
|
2014-07-12 18:47:39 -07:00
|
|
|
return reset(reason)
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if once then
|
2015-03-30 14:46:37 -07:00
|
|
|
print(reason.." "..utils.elapsedTime())
|
2014-07-12 18:47:39 -07:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local function getTimeRequirement(name)
|
|
|
|
return timeRequirements[name]()
|
|
|
|
end
|
|
|
|
|
|
|
|
local function setYolo(name)
|
|
|
|
local minimumTime = getTimeRequirement(name)
|
|
|
|
local shouldYolo = overMinute(minimumTime)
|
2015-03-30 15:29:00 -07:00
|
|
|
if yolo ~= shouldYolo then
|
2014-07-12 18:47:39 -07:00
|
|
|
yolo = shouldYolo
|
|
|
|
control.setYolo(shouldYolo)
|
|
|
|
local prefix
|
2015-03-30 15:29:00 -07:00
|
|
|
if yolo then
|
2014-07-12 18:47:39 -07:00
|
|
|
prefix = "en"
|
|
|
|
else
|
|
|
|
prefix = "dis"
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if areaName then
|
2014-07-12 18:47:39 -07:00
|
|
|
print("YOLO "..prefix.."abled at "..areaName)
|
|
|
|
else
|
|
|
|
print("YOLO "..prefix.."abled")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return yolo
|
|
|
|
end
|
|
|
|
|
2015-03-28 17:16:04 -07:00
|
|
|
-- PRIVATE
|
|
|
|
|
|
|
|
local function initialize()
|
2015-03-30 15:29:00 -07:00
|
|
|
if not initialized then
|
2015-03-28 17:16:04 -07:00
|
|
|
initialized = true
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
2014-07-12 18:47:39 -07:00
|
|
|
|
2015-03-30 14:46:37 -07:00
|
|
|
local function canHealFor(damage)
|
|
|
|
local healChecks = {
|
|
|
|
{"full_restore", 9001},
|
|
|
|
{"super_potion", 50},
|
|
|
|
{"potion", 20},
|
|
|
|
}
|
|
|
|
local curr_hp = pokemon.index(0, "hp")
|
|
|
|
local max_hp = pokemon.index(0, "max_hp")
|
|
|
|
for idx,potion in ipairs(healChecks) do
|
|
|
|
local name = potion[1]
|
|
|
|
local result_hp = math.min(curr_hp + potion[2], max_hp)
|
2015-03-30 15:29:00 -07:00
|
|
|
if result_hp >= damage and inventory.contains(name) then
|
2015-03-30 14:46:37 -07:00
|
|
|
return name
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-07-12 18:47:39 -07:00
|
|
|
local function hasHealthFor(opponent, extra)
|
2015-03-30 15:29:00 -07:00
|
|
|
if not extra then
|
2014-07-12 18:47:39 -07:00
|
|
|
extra = 0
|
|
|
|
end
|
|
|
|
return pokemon.index(0, "hp") + extra > combat.healthFor(opponent)
|
|
|
|
end
|
|
|
|
|
|
|
|
local function damaged(factor)
|
2015-03-30 15:29:00 -07:00
|
|
|
if not factor then
|
2014-07-12 18:47:39 -07:00
|
|
|
factor = 1
|
|
|
|
end
|
|
|
|
return pokemon.index(0, "hp") * factor < pokemon.index(0, "max_hp")
|
|
|
|
end
|
|
|
|
|
|
|
|
local function opponentDamaged(factor)
|
2015-03-30 15:29:00 -07:00
|
|
|
if not factor then
|
2014-07-12 18:47:39 -07:00
|
|
|
factor = 1
|
|
|
|
end
|
|
|
|
return memory.double("battle", "opponent_hp") * factor < memory.double("battle", "opponent_max_hp")
|
|
|
|
end
|
|
|
|
|
|
|
|
local function redHP()
|
|
|
|
return math.ceil(pokemon.index(0, "max_hp") * 0.2)
|
|
|
|
end
|
|
|
|
|
|
|
|
local function buffTo(buff, defLevel)
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = true
|
|
|
|
local forced
|
2015-03-30 15:29:00 -07:00
|
|
|
if defLevel and memory.double("battle", "opponent_defense") > defLevel then
|
2014-07-12 18:47:39 -07:00
|
|
|
forced = buff
|
|
|
|
end
|
|
|
|
battle.automate(forced, true)
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
else
|
|
|
|
battle.automate()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local function dodgeUp(npc, sx, sy, dodge, offset)
|
2015-03-30 15:29:00 -07:00
|
|
|
if not battle.handleWild() then
|
2014-07-12 18:47:39 -07:00
|
|
|
return false
|
|
|
|
end
|
|
|
|
local px, py = player.position()
|
2015-03-30 15:29:00 -07:00
|
|
|
if py < sy - 1 then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
local wx, wy = px, py
|
2015-03-30 15:29:00 -07:00
|
|
|
if py < sy then
|
2014-07-12 18:47:39 -07:00
|
|
|
wy = py - 1
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif px == sx or px == dodge then
|
|
|
|
if px - memory.raw(npc) == offset then
|
|
|
|
if px == sx then
|
2014-07-12 18:47:39 -07:00
|
|
|
wx = dodge
|
|
|
|
else
|
|
|
|
wx = sx
|
|
|
|
end
|
|
|
|
else
|
|
|
|
wy = py - 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
walk.step(wx, wy)
|
|
|
|
end
|
|
|
|
|
|
|
|
local function dodgeH(options)
|
|
|
|
local left = 1
|
2015-03-30 15:29:00 -07:00
|
|
|
if options.left then
|
2014-07-12 18:47:39 -07:00
|
|
|
left = -1
|
|
|
|
end
|
|
|
|
local px, py = player.position()
|
2015-03-30 15:29:00 -07:00
|
|
|
if px * left > options.sx * left + (options.dist or 1) * left then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
local wx, wy = px, py
|
2015-03-30 15:29:00 -07:00
|
|
|
if px * left > options.sx * left then
|
2014-07-12 18:47:39 -07:00
|
|
|
wx = px + 1 * left
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif py == options.sy or py == options.dodge then
|
|
|
|
if py - memory.raw(options.npc) == options.offset then
|
|
|
|
if py == options.sy then
|
2014-07-12 18:47:39 -07:00
|
|
|
wy = options.dodge
|
|
|
|
else
|
|
|
|
wy = options.sy
|
|
|
|
end
|
|
|
|
else
|
|
|
|
wx = px + 1 * left
|
|
|
|
end
|
|
|
|
end
|
|
|
|
walk.step(wx, wy)
|
|
|
|
end
|
|
|
|
|
|
|
|
local function completedMenuFor(data)
|
|
|
|
local count = inventory.count(data.item)
|
2015-03-30 15:29:00 -07:00
|
|
|
if count == 0 or count + (data.amount or 1) <= tries then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
|
|
|
local function closeMenuFor(data)
|
2015-03-30 15:29:00 -07:00
|
|
|
if (not tempDir and not data.close) or data.chain or menu.close() then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local function useItem(data)
|
|
|
|
local main = memory.value("menu", "main")
|
2015-03-30 15:29:00 -07:00
|
|
|
if tries == 0 then
|
2014-07-12 18:47:39 -07:00
|
|
|
tries = inventory.count(data.item)
|
2015-03-30 15:29:00 -07:00
|
|
|
if tries == 0 then
|
|
|
|
if closeMenuFor(data) then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if completedMenuFor(data) then
|
|
|
|
if closeMenuFor(data) then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
else
|
2015-03-30 15:29:00 -07:00
|
|
|
if inventory.use(data.item, data.poke) then
|
2014-07-12 18:47:39 -07:00
|
|
|
tempDir = true
|
|
|
|
else
|
|
|
|
menu.pause()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local function completedSkillFor(data)
|
2015-03-30 15:29:00 -07:00
|
|
|
if data.map then
|
|
|
|
if data.map ~= memory.value("game", "map") then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif data.x or data.y then
|
2014-07-12 18:47:39 -07:00
|
|
|
local px, py = player.position()
|
2015-03-30 15:29:00 -07:00
|
|
|
if data.x == px or data.y == py then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif data.done then
|
|
|
|
if memory.raw(data.done) > (data.val or 0) then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif tries > 0 and not menu.isOpen() then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
|
|
|
local function isPrepared(...)
|
2015-03-30 15:29:00 -07:00
|
|
|
if tries == 0 then
|
2014-07-12 18:47:39 -07:00
|
|
|
tries = {}
|
|
|
|
end
|
2015-03-28 21:28:58 -07:00
|
|
|
for i,name in ipairs(arg) do
|
|
|
|
local currentCount = inventory.count(name)
|
2015-03-30 15:29:00 -07:00
|
|
|
if currentCount > 0 then
|
2015-03-28 21:28:58 -07:00
|
|
|
local previousCount = tries[name]
|
2015-03-30 15:29:00 -07:00
|
|
|
if previousCount == nil or currentCount == previousCount then
|
2014-07-12 18:47:39 -07:00
|
|
|
return false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
local function prepare(...)
|
2015-03-30 15:29:00 -07:00
|
|
|
if tries == 0 then
|
2014-07-12 18:47:39 -07:00
|
|
|
tries = {}
|
|
|
|
end
|
2015-03-28 21:28:58 -07:00
|
|
|
local item
|
|
|
|
for idx,name in ipairs(arg) do
|
|
|
|
local currentCount = inventory.count(name)
|
|
|
|
local needsItem = currentCount > 0
|
|
|
|
local previousCount = tries[name]
|
2015-03-30 15:29:00 -07:00
|
|
|
if previousCount == nil then
|
2015-03-28 21:28:58 -07:00
|
|
|
tries[name] = currentCount
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif needsItem then
|
2015-03-28 21:28:58 -07:00
|
|
|
needsItem = currentCount == previousCount
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if needsItem then
|
2015-03-28 21:28:58 -07:00
|
|
|
item = name
|
|
|
|
break
|
2014-07-12 18:47:39 -07:00
|
|
|
end
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if not item then
|
2015-03-28 21:28:58 -07:00
|
|
|
return true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
inventory.use(item, nil, true)
|
|
|
|
else
|
|
|
|
input.cancel()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- DSum
|
|
|
|
|
|
|
|
local function nidoranDSum(disabled)
|
|
|
|
local sx, sy = player.position()
|
2015-03-30 15:29:00 -07:00
|
|
|
if not disabled and tries == nil then
|
2014-07-12 18:47:39 -07:00
|
|
|
local opName = battle.opponent()
|
|
|
|
local opLevel = memory.value("battle", "opponent_level")
|
2015-03-30 15:29:00 -07:00
|
|
|
if opName == "rattata" then
|
|
|
|
if opLevel == 2 then
|
2014-07-12 18:47:39 -07:00
|
|
|
tries = {0, 4, 12}
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif opLevel == 3 then
|
2014-07-12 18:47:39 -07:00
|
|
|
tries = {0, 14, 11}
|
|
|
|
else
|
|
|
|
-- tries = {0, 0, 10} -- TODO can't escape
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif opName == "spearow" then
|
|
|
|
if opLevel == 5 then
|
2015-01-19 17:11:52 -08:00
|
|
|
-- can't escape
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif opName == "nidoran" then
|
2014-07-12 18:47:39 -07:00
|
|
|
tries = {0, 6, 12}
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif opName == "nidoranf" then
|
|
|
|
if opLevel == 3 then
|
2014-07-12 18:47:39 -07:00
|
|
|
tries = {4, 6, 12}
|
|
|
|
else
|
|
|
|
tries = {5, 6, 12}
|
|
|
|
end
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if tries then
|
2014-07-12 18:47:39 -07:00
|
|
|
tries.idx = 1
|
|
|
|
tries.x, tries.y = sx, sy
|
|
|
|
else
|
|
|
|
tries = 0
|
|
|
|
end
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if not disabled and tries ~= 0 then
|
|
|
|
if tries[tries.idx] == 0 then
|
2014-07-12 18:47:39 -07:00
|
|
|
tries.idx = tries.idx + 1
|
2015-03-30 15:29:00 -07:00
|
|
|
if tries.idx > 3 then
|
2014-07-12 18:47:39 -07:00
|
|
|
tries = 0
|
|
|
|
end
|
|
|
|
return nidoranDSum()
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if tries.x ~= sx or tries.y ~= sy then
|
2014-07-12 18:47:39 -07:00
|
|
|
tries[tries.idx] = tries[tries.idx] - 1
|
|
|
|
tries.x, tries.y = sx, sy
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if tries.idx == 2 then
|
2014-07-12 18:47:39 -07:00
|
|
|
sy = 11
|
|
|
|
else
|
|
|
|
sy = 12
|
|
|
|
end
|
|
|
|
else
|
|
|
|
sy = 11
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if sx == 33 then
|
2014-07-12 18:47:39 -07:00
|
|
|
sx = 32
|
|
|
|
else
|
|
|
|
sx = 33
|
|
|
|
end
|
|
|
|
walk.step(sx, sy)
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Strategies
|
|
|
|
|
|
|
|
local strategyFunctions
|
|
|
|
strategyFunctions = {
|
|
|
|
|
|
|
|
a = function(data)
|
|
|
|
areaName = data.a
|
|
|
|
return true
|
|
|
|
end,
|
|
|
|
|
|
|
|
startFrames = function()
|
|
|
|
strategies.frames = 0
|
|
|
|
return true
|
|
|
|
end,
|
|
|
|
|
|
|
|
reportFrames = function()
|
|
|
|
print("FR "..strategies.frames)
|
|
|
|
local repels = memory.value("player", "repel")
|
2015-03-30 15:29:00 -07:00
|
|
|
if repels > 0 then
|
2014-07-12 18:47:39 -07:00
|
|
|
print("S "..repels)
|
|
|
|
end
|
|
|
|
strategies.frames = nil
|
|
|
|
return true
|
|
|
|
end,
|
|
|
|
|
|
|
|
tweetMisty = function()
|
2015-03-30 14:46:37 -07:00
|
|
|
local elt = utils.elapsedTime()
|
2015-03-30 15:29:00 -07:00
|
|
|
if setYolo("misty") then
|
2015-01-19 17:11:52 -08:00
|
|
|
print("Misty: "..elt)
|
|
|
|
else
|
2015-03-30 14:46:37 -07:00
|
|
|
local pbn = ""
|
|
|
|
local pbTime = getTimeRequirement("misty") - 1.75
|
2015-03-30 15:29:00 -07:00
|
|
|
if not overMinute(pbTime) then
|
2015-01-19 17:11:52 -08:00
|
|
|
pbn = " (PB pace)"
|
|
|
|
end
|
|
|
|
bridge.tweet("Got a run going, just beat Misty "..elt.." in"..pbn.." http://www.twitch.tv/thepokebot")
|
|
|
|
end
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end,
|
|
|
|
|
|
|
|
tweetVictoryRoad = function()
|
2015-03-30 14:46:37 -07:00
|
|
|
local elt = utils.elapsedTime()
|
2015-01-19 17:11:52 -08:00
|
|
|
local pbn = ""
|
2015-03-30 15:29:00 -07:00
|
|
|
if not overMinute(98) then -- TODO verify
|
2015-01-19 17:11:52 -08:00
|
|
|
pbn = " (PB pace)"
|
|
|
|
end
|
2015-03-30 14:46:37 -07:00
|
|
|
local elt = utils.elapsedTime()
|
2015-01-19 17:11:52 -08:00
|
|
|
bridge.tweet("Entering Victory Road at "..elt..pbn.." on our way to the Elite Four! http://www.twitch.tv/thepokebot")
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end,
|
|
|
|
|
|
|
|
split = function(data)
|
2015-03-28 17:16:04 -07:00
|
|
|
bridge.split(data and data.finished)
|
2015-03-30 14:46:37 -07:00
|
|
|
splitNumber = splitNumber + 1
|
|
|
|
|
|
|
|
local timeDiff
|
|
|
|
splitTime, timeDiff = utils.timeSince(splitTime)
|
2015-03-30 15:29:00 -07:00
|
|
|
if timeDiff then
|
2015-03-30 14:46:37 -07:00
|
|
|
print(splitNumber..". "..areaName..": "..utils.elapsedTime().." ("..timeDiff..")")
|
|
|
|
end
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end,
|
|
|
|
|
|
|
|
wait = function()
|
|
|
|
print("Please save state")
|
|
|
|
input.press("Start", 9001)
|
|
|
|
end,
|
|
|
|
|
|
|
|
emuSpeed = function(data)
|
|
|
|
-- client.speedmode = data.percent
|
|
|
|
return true
|
|
|
|
end,
|
|
|
|
|
|
|
|
-- Global
|
|
|
|
|
|
|
|
interact = function(data)
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.handleWild() then
|
|
|
|
if battle.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if textbox.isActive() then
|
|
|
|
if tries > 0 then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
tries = tries - 1
|
|
|
|
input.cancel()
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif player.interact(data.dir) then
|
2014-07-12 18:47:39 -07:00
|
|
|
tries = tries + 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
confirm = function(data)
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.handleWild() then
|
|
|
|
if textbox.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
tries = tries + 1
|
|
|
|
input.cancel(data.type or "A")
|
|
|
|
else
|
2015-03-30 15:29:00 -07:00
|
|
|
if tries > 0 then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
player.interact(data.dir)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
item = function(data)
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.handleWild() then
|
|
|
|
if data.full and not inventory.isFull() then
|
|
|
|
if closeMenuFor(data) then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
return useItem(data)
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
potion = function(data)
|
|
|
|
local curr_hp = pokemon.index(0, "hp")
|
2015-03-30 15:29:00 -07:00
|
|
|
if curr_hp == 0 then
|
2014-07-12 18:47:39 -07:00
|
|
|
return false
|
|
|
|
end
|
2015-03-30 14:46:37 -07:00
|
|
|
local toHP
|
2015-03-30 15:29:00 -07:00
|
|
|
if yolo and data.yolo ~= nil then
|
2014-07-12 18:47:39 -07:00
|
|
|
toHP = data.yolo
|
2015-03-30 14:46:37 -07:00
|
|
|
else
|
|
|
|
toHP = data.hp
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if type(toHP) == "string" then
|
2014-07-12 18:47:39 -07:00
|
|
|
toHP = combat.healthFor(toHP)
|
|
|
|
end
|
|
|
|
local toHeal = toHP - curr_hp
|
2015-03-30 15:29:00 -07:00
|
|
|
if toHeal > 0 then
|
2014-07-12 18:47:39 -07:00
|
|
|
local toPotion
|
2015-03-30 15:29:00 -07:00
|
|
|
if data.forced then
|
2014-07-12 18:47:39 -07:00
|
|
|
toPotion = inventory.contains(data.forced)
|
|
|
|
else
|
|
|
|
local p_first, p_second, p_third
|
2015-03-30 15:29:00 -07:00
|
|
|
if toHeal > 50 then
|
|
|
|
if data.full then
|
2014-07-12 18:47:39 -07:00
|
|
|
p_first = "full_restore"
|
|
|
|
else
|
|
|
|
p_first = "super_potion"
|
|
|
|
end
|
|
|
|
p_second, p_third = "super_potion", "potion"
|
|
|
|
else
|
2015-03-30 15:29:00 -07:00
|
|
|
if toHeal > 20 then
|
2014-07-12 18:47:39 -07:00
|
|
|
p_first, p_second = "super_potion", "potion"
|
|
|
|
else
|
|
|
|
p_first, p_second = "potion", "super_potion"
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if data.full then
|
2014-07-12 18:47:39 -07:00
|
|
|
p_third = "full_restore"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
toPotion = inventory.contains(p_first, p_second, p_third)
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if toPotion then
|
|
|
|
if menu.pause() then
|
2014-07-12 18:47:39 -07:00
|
|
|
inventory.use(toPotion)
|
|
|
|
tempDir = true
|
|
|
|
end
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if closeMenuFor(data) then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
teach = function(data)
|
2015-03-30 15:29:00 -07:00
|
|
|
if data.full and not inventory.isFull() then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
local itemName
|
2015-03-30 15:29:00 -07:00
|
|
|
if data.item then
|
2014-07-12 18:47:39 -07:00
|
|
|
itemName = data.item
|
|
|
|
else
|
|
|
|
itemName = data.move
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.hasMove(data.move) then
|
2014-07-12 18:47:39 -07:00
|
|
|
local main = memory.value("menu", "main")
|
2015-03-30 15:29:00 -07:00
|
|
|
if main == 128 then
|
|
|
|
if data.chain then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif main < 3 then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
input.press("B")
|
|
|
|
else
|
|
|
|
local replacement
|
2015-03-30 15:29:00 -07:00
|
|
|
if data.replace then
|
2014-07-12 18:47:39 -07:00
|
|
|
replacement = pokemon.moveIndex(data.replace, data.poke) - 1
|
|
|
|
else
|
|
|
|
replacement = 0
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if inventory.teach(itemName, data.poke, replacement, data.alt) then
|
2014-07-12 18:47:39 -07:00
|
|
|
tempDir = true
|
|
|
|
else
|
|
|
|
menu.pause()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
skill = function(data)
|
2015-03-30 15:29:00 -07:00
|
|
|
if completedSkillFor(data) then
|
|
|
|
if not textbox.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
input.press("B")
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif not data.dir or player.face(data.dir) then
|
|
|
|
if pokemon.use(data.move) then
|
2014-07-12 18:47:39 -07:00
|
|
|
tries = tries + 1
|
|
|
|
else
|
|
|
|
menu.pause()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
fly = function(data)
|
2015-03-30 15:29:00 -07:00
|
|
|
if memory.value("game", "map") == data.map then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
local cities = {
|
|
|
|
pallet = {62, "Up"},
|
|
|
|
viridian = {63, "Up"},
|
|
|
|
lavender = {66, "Down"},
|
|
|
|
celadon = {68, "Down"},
|
|
|
|
fuchsia = {69, "Down"},
|
|
|
|
cinnabar = {70, "Down"},
|
|
|
|
}
|
|
|
|
|
|
|
|
local main = memory.value("menu", "main")
|
2015-03-30 15:29:00 -07:00
|
|
|
if main == 228 then
|
2014-07-12 18:47:39 -07:00
|
|
|
local currentFly = memory.raw(0x1FEF)
|
|
|
|
local destination = cities[data.dest]
|
|
|
|
local press
|
2015-03-30 15:29:00 -07:00
|
|
|
if destination[1] - currentFly == 0 then
|
2014-07-12 18:47:39 -07:00
|
|
|
press = "A"
|
|
|
|
else
|
|
|
|
press = destination[2]
|
|
|
|
end
|
|
|
|
input.press(press)
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif not pokemon.use("fly") then
|
2014-07-12 18:47:39 -07:00
|
|
|
menu.pause()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
bicycle = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if memory.raw(0x1700) == 1 then
|
|
|
|
if textbox.handle() then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
else
|
|
|
|
return useItem({item="bicycle"})
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
fightXAccuracy = function()
|
|
|
|
return prepare("x_accuracy")
|
|
|
|
end,
|
|
|
|
|
|
|
|
waitToTalk = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = false
|
|
|
|
battle.automate()
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif textbox.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = true
|
|
|
|
input.cancel()
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
waitToPause = function()
|
|
|
|
local main = memory.value("menu", "main")
|
2015-03-30 15:29:00 -07:00
|
|
|
if main == 128 then
|
|
|
|
if canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif battle.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = false
|
|
|
|
battle.automate()
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif main == 123 then
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = true
|
|
|
|
input.press("B")
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif textbox.handle() then
|
2014-07-12 18:47:39 -07:00
|
|
|
input.press("Start", 2)
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
waitToFight = function(data)
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = true
|
|
|
|
battle.automate()
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif textbox.handle() then
|
|
|
|
if data.dir then
|
2014-07-12 18:47:39 -07:00
|
|
|
player.interact(data.dir)
|
|
|
|
else
|
|
|
|
input.cancel()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
allowDeath = function(data)
|
2015-03-28 21:28:58 -07:00
|
|
|
control.canDie(data.on)
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end,
|
|
|
|
|
|
|
|
-- Route
|
|
|
|
|
|
|
|
squirtleIChooseYou = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.inParty("squirtle") then
|
2014-07-12 18:47:39 -07:00
|
|
|
bridge.caught("squirtle")
|
|
|
|
return true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if player.face("Up") then
|
2014-07-12 18:47:39 -07:00
|
|
|
textbox.name("A")
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
fightBulbasaur = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if tries < 9000 and pokemon.index(0, "level") == 6 then
|
|
|
|
if tries > 200 then
|
2014-07-12 18:47:39 -07:00
|
|
|
squirtleAtt = pokemon.index(0, "attack")
|
|
|
|
squirtleDef = pokemon.index(0, "defense")
|
|
|
|
squirtleSpd = pokemon.index(0, "speed")
|
|
|
|
squirtleScl = pokemon.index(0, "special")
|
2015-03-30 15:29:00 -07:00
|
|
|
if squirtleAtt < 11 and squirtleScl < 12 then
|
2014-07-12 18:47:39 -07:00
|
|
|
return reset("Bad Squirtle - "..squirtleAtt.." attack, "..squirtleScl.." special")
|
|
|
|
end
|
|
|
|
tries = 9001
|
|
|
|
else
|
|
|
|
tries = tries + 1
|
|
|
|
end
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() and memory.double("battle", "opponent_hp") > 0 and resetTime(2.15, "kill Bulbasaur") then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
return buffTo("tail_whip", 6)
|
|
|
|
end,
|
|
|
|
|
|
|
|
dodgePalletBoy = function()
|
|
|
|
return dodgeUp(0x0223, 14, 14, 15, 7)
|
|
|
|
end,
|
|
|
|
|
2015-03-28 12:47:01 -07:00
|
|
|
shopViridianPokeballs = function()
|
2014-07-12 18:47:39 -07:00
|
|
|
return shop.transaction{
|
|
|
|
buy = {{name="pokeball", index=0, amount=8}}
|
|
|
|
}
|
|
|
|
end,
|
|
|
|
|
|
|
|
catchNidoran = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if not control.canCatch() then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
local pokeballs = inventory.count("pokeball")
|
|
|
|
local caught = memory.value("player", "party_size") - 1
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokeballs < 5 - caught * 2 then
|
2015-02-12 12:59:46 -08:00
|
|
|
return reset("Ran too low on PokeBalls", pokeballs)
|
2014-07-12 18:47:39 -07:00
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
local isNidoran = pokemon.isOpponent("nidoran")
|
2015-03-30 15:29:00 -07:00
|
|
|
if isNidoran and memory.value("battle", "opponent_level") > 2 then
|
|
|
|
if initialize() then
|
2014-07-12 18:47:39 -07:00
|
|
|
bridge.pollForName()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
tries = nil
|
2015-03-30 15:29:00 -07:00
|
|
|
if memory.value("menu", "text_input") == 240 then
|
2014-07-12 18:47:39 -07:00
|
|
|
textbox.name()
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif memory.value("battle", "menu") == 95 then
|
|
|
|
if isNidoran then
|
2014-07-12 18:47:39 -07:00
|
|
|
input.press("A")
|
|
|
|
else
|
|
|
|
input.cancel()
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif not control.shouldCatch() then
|
|
|
|
if control.shouldFight() then
|
2014-07-12 18:47:39 -07:00
|
|
|
battle.fight()
|
|
|
|
else
|
|
|
|
battle.run()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
local noDSum
|
|
|
|
pokemon.updateParty()
|
|
|
|
local hasNidoran = pokemon.inParty("nidoran")
|
2015-03-30 15:29:00 -07:00
|
|
|
if hasNidoran then
|
|
|
|
if not tempDir then
|
2014-07-12 18:47:39 -07:00
|
|
|
bridge.caught("nidoran")
|
|
|
|
tempDir = true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.getExp() > 205 then
|
2014-07-12 18:47:39 -07:00
|
|
|
local nidoranLevel = pokemon.info("nidoran", "level")
|
|
|
|
level4Nidoran = nidoranLevel == 4
|
|
|
|
print("Level "..nidoranLevel.." Nidoran")
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
noDSum = true
|
|
|
|
end
|
2015-03-28 17:16:04 -07:00
|
|
|
|
|
|
|
local timeLimit = getTimeRequirement("nidoran")
|
2014-07-12 18:47:39 -07:00
|
|
|
local resetMessage
|
2015-03-30 15:29:00 -07:00
|
|
|
if hasNidoran then
|
2014-07-12 18:47:39 -07:00
|
|
|
resetMessage = "get an experience kill before Brock"
|
|
|
|
else
|
|
|
|
resetMessage = "find a Nidoran"
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if resetTime(timeLimit, resetMessage) then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if not noDSum and overMinute(timeLimit - 0.25) then
|
2014-07-12 18:47:39 -07:00
|
|
|
noDSum = true
|
|
|
|
end
|
|
|
|
nidoranDSum(noDSum)
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
-- 1: NIDORAN
|
|
|
|
|
|
|
|
dodgeViridianOldMan = function()
|
|
|
|
return dodgeUp(0x0273, 18, 6, 17, 9)
|
|
|
|
end,
|
|
|
|
|
|
|
|
grabAntidote = function()
|
|
|
|
local px, py = player.position()
|
2015-03-30 15:29:00 -07:00
|
|
|
if py < 11 then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.info("spearow", "level") == 3 then
|
|
|
|
if px < 26 then
|
2014-07-12 18:47:39 -07:00
|
|
|
px = 26
|
|
|
|
else
|
|
|
|
py = 10
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif inventory.contains("antidote") then
|
2014-07-12 18:47:39 -07:00
|
|
|
py = 10
|
|
|
|
else
|
|
|
|
player.interact("Up")
|
|
|
|
end
|
|
|
|
walk.step(px, py)
|
|
|
|
end,
|
|
|
|
|
2015-02-12 12:59:46 -08:00
|
|
|
grabForestPotion = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if inventory.contains("potion") then
|
2015-03-28 12:47:01 -07:00
|
|
|
local healthNeeded = (pokemon.info("spearow", "level") == 3) and 6 or 10
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.info("squirtle", "hp") <= healthNeeded then
|
|
|
|
if menu.pause() then
|
2015-02-12 12:59:46 -08:00
|
|
|
inventory.use("potion", "squirtle")
|
|
|
|
end
|
|
|
|
else
|
|
|
|
return true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif menu.close() then
|
2015-02-12 12:59:46 -08:00
|
|
|
player.interact("Up")
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
2014-07-12 18:47:39 -07:00
|
|
|
fightWeedle = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isTrainer() then
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = true
|
|
|
|
local squirtleOut = pokemon.isDeployed("squirtle")
|
2015-03-30 15:29:00 -07:00
|
|
|
if squirtleOut and memory.value("battle", "our_status") > 0 and not inventory.contains("antidote") then
|
2014-07-12 18:47:39 -07:00
|
|
|
return reset("Poisoned, but we skipped the antidote")
|
|
|
|
end
|
|
|
|
local sidx = pokemon.indexOf("spearow")
|
2015-03-30 15:29:00 -07:00
|
|
|
if sidx ~= -1 and pokemon.index(sidx, "level") > 3 then
|
2014-07-12 18:47:39 -07:00
|
|
|
sidx = -1
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if sidx == -1 then
|
2014-07-12 18:47:39 -07:00
|
|
|
return buffTo("tail_whip", 5)
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.index(sidx, "hp") < 1 then
|
2014-07-12 18:47:39 -07:00
|
|
|
local battleMenu = memory.value("battle", "menu")
|
2015-03-30 15:29:00 -07:00
|
|
|
if utils.onPokemonSelect(battleMenu) then
|
2014-07-12 18:47:39 -07:00
|
|
|
menu.select(pokemon.indexOf("squirtle"), true)
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif battleMenu == 95 then
|
2014-07-12 18:47:39 -07:00
|
|
|
input.press("A")
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif squirtleOut then
|
2014-07-12 18:47:39 -07:00
|
|
|
battle.automate()
|
|
|
|
else
|
|
|
|
input.cancel()
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif squirtleOut then
|
2014-07-12 18:47:39 -07:00
|
|
|
battle.swap("spearow")
|
|
|
|
else
|
|
|
|
local peck = combat.bestMove()
|
|
|
|
local forced
|
2015-03-30 15:29:00 -07:00
|
|
|
if peck and peck.damage and peck.damage + 1 >= memory.double("battle", "opponent_hp") then
|
2014-07-12 18:47:39 -07:00
|
|
|
forced = "growl"
|
|
|
|
end
|
|
|
|
battle.fight(forced)
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
equipForBrock = function(data)
|
2015-03-30 15:29:00 -07:00
|
|
|
if initialize() then
|
|
|
|
if pokemon.info("squirtle", "level") < 8 then
|
2014-07-12 18:47:39 -07:00
|
|
|
return reset("Not level 8 before Brock", pokemon.getExp())
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if data.anti then
|
2014-07-12 18:47:39 -07:00
|
|
|
local poisoned = pokemon.info("squirtle", "status") > 0
|
2015-03-30 15:29:00 -07:00
|
|
|
if not poisoned then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if not inventory.contains("antidote") then
|
2014-07-12 18:47:39 -07:00
|
|
|
return reset("Poisoned, but we skipped the antidote")
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if inventory.contains("potion") and pokemon.info("squirtle", "hp") > 8 then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
local main = memory.value("menu", "main")
|
|
|
|
local nidoranIndex = pokemon.indexOf("nidoran")
|
2015-03-30 15:29:00 -07:00
|
|
|
if nidoranIndex == 0 then
|
|
|
|
if menu.close() then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif menu.pause() then
|
2014-07-12 18:47:39 -07:00
|
|
|
local column = menu.getCol()
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.info("squirtle", "status") > 0 then
|
2014-07-12 18:47:39 -07:00
|
|
|
inventory.use("antidote", "squirtle")
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif inventory.contains("potion") and pokemon.info("squirtle", "hp") < 15 then
|
2014-07-12 18:47:39 -07:00
|
|
|
inventory.use("potion", "squirtle")
|
|
|
|
else
|
2015-03-30 15:29:00 -07:00
|
|
|
if main == 128 then
|
|
|
|
if column == 11 then
|
2014-07-12 18:47:39 -07:00
|
|
|
menu.select(1, true)
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif column == 12 then
|
2014-07-12 18:47:39 -07:00
|
|
|
menu.select(1, true)
|
|
|
|
else
|
|
|
|
input.press("B")
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif main == 103 then
|
|
|
|
if memory.value("menu", "selection_mode") == 1 then
|
2014-07-12 18:47:39 -07:00
|
|
|
menu.select(nidoranIndex, true)
|
|
|
|
else
|
|
|
|
menu.select(0, true)
|
|
|
|
end
|
|
|
|
else
|
|
|
|
input.press("B")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
fightBrock = function()
|
|
|
|
local squirtleHP = pokemon.info("squirtle", "hp")
|
2015-03-30 15:29:00 -07:00
|
|
|
if squirtleHP == 0 then
|
2014-07-12 18:47:39 -07:00
|
|
|
return resetDeath()
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
|
|
|
if tries < 1 then
|
2014-07-12 18:47:39 -07:00
|
|
|
tries = 1
|
|
|
|
end
|
|
|
|
local bubble, turnsToKill, turnsToDie = combat.bestMove()
|
2015-03-30 15:29:00 -07:00
|
|
|
if not pokemon.isDeployed("squirtle") then
|
2014-07-12 18:47:39 -07:00
|
|
|
battle.swap("squirtle")
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif turnsToDie and turnsToDie < 2 and inventory.contains("potion") then
|
2014-07-12 18:47:39 -07:00
|
|
|
inventory.use("potion", "squirtle", true)
|
|
|
|
else
|
|
|
|
local battleMenu = memory.value("battle", "menu")
|
|
|
|
local bideTurns = memory.value("battle", "opponent_bide")
|
2015-03-30 15:29:00 -07:00
|
|
|
if battleMenu == 95 and menu.getCol() == 1 then
|
2014-07-12 18:47:39 -07:00
|
|
|
input.press("A")
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif bideTurns > 0 then
|
2014-07-12 18:47:39 -07:00
|
|
|
local onixHP = memory.double("battle", "opponent_hp")
|
2015-03-30 15:29:00 -07:00
|
|
|
if not canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = onixHP
|
|
|
|
tempDir = bideTurns
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if turnsToKill then
|
2014-07-12 18:47:39 -07:00
|
|
|
local forced
|
2015-03-30 15:29:00 -07:00
|
|
|
if turnsToDie < 2 or turnsToKill < 2 or tempDir - bideTurns > 1 then
|
|
|
|
-- elseif turnsToKill < 3 and tempDir == bideTurns then
|
|
|
|
elseif onixHP == canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
forced = "tail_whip"
|
|
|
|
end
|
|
|
|
battle.fight(forced)
|
|
|
|
else
|
|
|
|
input.cancel()
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif utils.onPokemonSelect(battleMenu) then
|
2014-07-12 18:47:39 -07:00
|
|
|
menu.select(pokemon.indexOf("nidoran"), true)
|
|
|
|
else
|
|
|
|
canProgress = false
|
|
|
|
battle.fight()
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if tries < 9000 then
|
2014-07-12 18:47:39 -07:00
|
|
|
local nidx = pokemon.indexOf("nidoran")
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.index(nidx, "level") == 8 then
|
2014-07-12 18:47:39 -07:00
|
|
|
local att = pokemon.index(nidx, "attack")
|
|
|
|
local def = pokemon.index(nidx, "defense")
|
|
|
|
local spd = pokemon.index(nidx, "speed")
|
|
|
|
local scl = pokemon.index(nidx, "special")
|
|
|
|
bridge.stats(att.." "..def.." "..spd.." "..scl)
|
|
|
|
nidoAttack = att
|
|
|
|
nidoSpeed = spd
|
|
|
|
nidoSpecial = scl
|
2015-03-30 15:29:00 -07:00
|
|
|
if tries > 300 then
|
2014-07-12 18:47:39 -07:00
|
|
|
local statDiff = (16 - att) + (15 - spd) + (13 - scl)
|
2015-03-30 15:29:00 -07:00
|
|
|
if def < 12 then
|
2014-07-12 18:47:39 -07:00
|
|
|
statDiff = statDiff + 1
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if level4Nidoran then
|
2015-03-28 17:16:04 -07:00
|
|
|
statDiff = statDiff - 1
|
|
|
|
end
|
2014-07-12 18:47:39 -07:00
|
|
|
local resets = att < 15 or spd < 14 or scl < 12 or statDiff > 3
|
2015-03-30 15:29:00 -07:00
|
|
|
if not resets and att == 15 and spd == 14 then
|
2014-07-12 18:47:39 -07:00
|
|
|
resets = true
|
|
|
|
end
|
|
|
|
local nStatus = "Att: "..att..", Def: "..def..", Speed: "..spd..", Special: "..scl
|
2015-03-30 15:29:00 -07:00
|
|
|
if resets then
|
2014-07-12 18:47:39 -07:00
|
|
|
return reset("Bad Nidoran - "..nStatus)
|
|
|
|
end
|
|
|
|
tries = 9001
|
|
|
|
local superlative
|
|
|
|
local exclaim = "!"
|
2015-03-30 15:29:00 -07:00
|
|
|
if statDiff == 0 then
|
|
|
|
if def == 14 then
|
2014-07-12 18:47:39 -07:00
|
|
|
superlative = " god"
|
|
|
|
exclaim = "! Kreygasm"
|
|
|
|
else
|
|
|
|
superlative = " perfect"
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif att == 16 and spd == 15 then
|
|
|
|
if statDiff == 1 then
|
2014-07-12 18:47:39 -07:00
|
|
|
superlative = " great"
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif statDiff == 2 then
|
2014-07-12 18:47:39 -07:00
|
|
|
superlative = " good"
|
2015-03-30 14:46:37 -07:00
|
|
|
else
|
|
|
|
superlative = " okay"
|
2014-07-12 18:47:39 -07:00
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif statDiff == 1 then
|
2014-07-12 18:47:39 -07:00
|
|
|
superlative = " good"
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif statDiff == 2 then
|
2014-07-12 18:47:39 -07:00
|
|
|
superlative = "n okay"
|
|
|
|
exclaim = "."
|
|
|
|
else
|
|
|
|
superlative = " min stat"
|
|
|
|
exclaim = "."
|
|
|
|
end
|
2015-03-28 21:28:58 -07:00
|
|
|
nStatus = "Beat Brock with a"..superlative.." Nidoran"..exclaim.." "..nStatus..", caught at level "..(level4Nidoran and "4" or "3").."."
|
2014-07-12 18:47:39 -07:00
|
|
|
bridge.chat(nStatus)
|
|
|
|
else
|
|
|
|
tries = tries + 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif tries > 0 then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif textbox.handle() then
|
2014-07-12 18:47:39 -07:00
|
|
|
player.interact("Up")
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
-- 2: BROCK
|
|
|
|
|
2015-03-28 12:47:01 -07:00
|
|
|
shopPewterMart = function()
|
2014-07-12 18:47:39 -07:00
|
|
|
return shop.transaction{
|
2015-03-30 15:20:13 -07:00
|
|
|
buy = {{name="potion", index=1, amount=9}}
|
2014-07-12 18:47:39 -07:00
|
|
|
}
|
|
|
|
end,
|
|
|
|
|
|
|
|
battleModeSet = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if memory.value("setting", "battle_style") == 10 then
|
|
|
|
if menu.close() then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif menu.pause() then
|
2014-07-12 18:47:39 -07:00
|
|
|
local main = memory.value("menu", "main")
|
2015-03-30 15:29:00 -07:00
|
|
|
if main == 128 then
|
|
|
|
if menu.getCol() ~= 11 then
|
2014-07-12 18:47:39 -07:00
|
|
|
input.press("B")
|
|
|
|
else
|
|
|
|
menu.select(5, true)
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif main == 228 then
|
2014-07-12 18:47:39 -07:00
|
|
|
menu.setOption("battle_style", 8, 10)
|
|
|
|
else
|
|
|
|
input.press("B")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
leer = function(data)
|
|
|
|
local bm = combat.bestMove()
|
2015-03-30 15:29:00 -07:00
|
|
|
if not bm or bm.minTurns < 3 then
|
|
|
|
if battle.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = true
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
battle.automate()
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
local opp = battle.opponent()
|
|
|
|
local defLimit = 9001
|
|
|
|
for i,poke in ipairs(data) do
|
2015-03-30 15:29:00 -07:00
|
|
|
if opp == poke[1] then
|
2015-03-30 14:46:37 -07:00
|
|
|
local minimumAttack = poke[3]
|
2015-03-30 15:29:00 -07:00
|
|
|
if not minimumAttack or nidoAttack > minimumAttack then
|
2015-03-30 14:46:37 -07:00
|
|
|
defLimit = poke[2]
|
|
|
|
end
|
2014-07-12 18:47:39 -07:00
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return buffTo("leer", defLimit)
|
|
|
|
end,
|
|
|
|
|
2015-03-30 15:20:13 -07:00
|
|
|
bugCatcher = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
2015-03-30 15:20:13 -07:00
|
|
|
canProgress = true
|
|
|
|
local isWeedle = pokemon.isOpponent("weedle")
|
2015-03-30 15:29:00 -07:00
|
|
|
if isWeedle and not tempDir then
|
2015-03-30 15:20:13 -07:00
|
|
|
tempDir = true
|
|
|
|
end
|
|
|
|
secondCaterpie = tempDir
|
2015-03-30 15:29:00 -07:00
|
|
|
if not isWeedle and secondCaterpie then
|
|
|
|
if level4Nidoran and nidoSpeed >= 14 and pokemon.index(0, "attack") >= 19 then
|
2015-03-30 15:20:13 -07:00
|
|
|
-- print("IA "..pokemon.index(0, "attack"))
|
|
|
|
battle.automate()
|
|
|
|
return
|
|
|
|
end
|
|
|
|
end
|
|
|
|
strategyFunctions.leer({{"caterpie",8}, {"weedle",7}})
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2015-03-30 15:20:13 -07:00
|
|
|
return true
|
|
|
|
else
|
|
|
|
battle.automate()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
2014-07-12 18:47:39 -07:00
|
|
|
shortsKid = function()
|
2015-03-28 12:47:01 -07:00
|
|
|
local fightingEkans = pokemon.isOpponent("ekans")
|
2015-03-30 15:29:00 -07:00
|
|
|
if fightingEkans then
|
2015-03-30 15:20:13 -07:00
|
|
|
local wrapping = memory.value("battle", "turns") > 0
|
2015-03-30 15:29:00 -07:00
|
|
|
if wrapping then
|
2015-03-30 15:20:13 -07:00
|
|
|
local curr_hp = memory.double("battle", "our_hp")
|
2015-03-30 15:29:00 -07:00
|
|
|
if not tempDir then
|
2015-03-30 15:20:13 -07:00
|
|
|
tempDir = curr_hp
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if tempDir - curr_hp < 4 and curr_hp < 14 and not opponentDamaged() then
|
2015-03-30 15:20:13 -07:00
|
|
|
inventory.use("potion", nil, true)
|
|
|
|
return false
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif tempDir then
|
2015-03-30 15:20:13 -07:00
|
|
|
tempDir = nil
|
|
|
|
end
|
|
|
|
end
|
2015-03-28 12:47:01 -07:00
|
|
|
control.battlePotion(fightingEkans or damaged(2))
|
2014-07-12 18:47:39 -07:00
|
|
|
return strategyFunctions.leer({{"rattata",9}, {"ekans",10}})
|
|
|
|
end,
|
|
|
|
|
|
|
|
potionBeforeCocoons = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if nidoSpeed >= 15 then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
2015-03-30 14:46:37 -07:00
|
|
|
return strategyFunctions.potion({hp=6, yolo=3})
|
2014-07-12 18:47:39 -07:00
|
|
|
end,
|
|
|
|
|
|
|
|
swapHornAttack = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.battleMove("horn_attack") == 1 then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
battle.swapMove(1, 3)
|
|
|
|
end,
|
|
|
|
|
|
|
|
fightMetapod = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = true
|
2015-03-30 15:29:00 -07:00
|
|
|
if memory.double("battle", "opponent_hp") > 0 and pokemon.isOpponent("metapod") then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
battle.automate()
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
else
|
|
|
|
battle.automate()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
catchFlierBackup = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if initialize() then
|
2015-03-28 21:28:58 -07:00
|
|
|
control.canDie(true)
|
2014-07-12 18:47:39 -07:00
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if not control.canCatch() then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
local caught = pokemon.inParty("pidgey", "spearow")
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
|
|
|
if memory.double("battle", "our_hp") == 0 then
|
|
|
|
if pokemon.info("squirtle", "hp") == 0 then
|
2015-03-28 21:28:58 -07:00
|
|
|
control.canDie(false)
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif utils.onPokemonSelect(memory.value("battle", "menu")) then
|
2014-07-12 18:47:39 -07:00
|
|
|
menu.select(pokemon.indexOf("squirtle"), true)
|
|
|
|
else
|
|
|
|
input.press("A")
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif not control.shouldCatch() then
|
2014-07-12 18:47:39 -07:00
|
|
|
battle.run()
|
|
|
|
end
|
|
|
|
else
|
|
|
|
local birdPath
|
|
|
|
local px, py = player.position()
|
2015-03-30 15:29:00 -07:00
|
|
|
if caught then
|
|
|
|
if px > 33 then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
local startY = 9
|
2015-03-30 15:29:00 -07:00
|
|
|
if px > 28 then
|
2014-07-12 18:47:39 -07:00
|
|
|
startY = py
|
|
|
|
end
|
|
|
|
birdPath = {{32,startY}, {32,11}, {34,11}}
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif px == 37 then
|
|
|
|
if py == 10 then
|
2014-07-12 18:47:39 -07:00
|
|
|
py = 11
|
|
|
|
else
|
|
|
|
py = 10
|
|
|
|
end
|
|
|
|
walk.step(px, py)
|
|
|
|
else
|
|
|
|
birdPath = {{32,10}, {32,11}, {34,11}, {34,10}, {37,10}}
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if birdPath then
|
2014-07-12 18:47:39 -07:00
|
|
|
walk.custom(birdPath)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
-- 3: ROUTE 3
|
|
|
|
|
|
|
|
startMtMoon = function()
|
|
|
|
strategies.moonEncounters = 0
|
2015-03-28 21:28:58 -07:00
|
|
|
control.canDie(false)
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end,
|
|
|
|
|
|
|
|
evolveNidorino = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.inParty("nidorino") then
|
2014-07-12 18:47:39 -07:00
|
|
|
bridge.caught("nidorino")
|
|
|
|
return true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
tries = 0
|
|
|
|
canProgress = true
|
2015-03-30 15:29:00 -07:00
|
|
|
if memory.double("battle", "opponent_hp") == 0 then
|
2014-07-12 18:47:39 -07:00
|
|
|
input.press("A")
|
|
|
|
else
|
|
|
|
battle.automate()
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif tries > 3600 then
|
2014-07-12 18:47:39 -07:00
|
|
|
print("Broke from Nidorino on tries")
|
|
|
|
return true
|
|
|
|
else
|
2015-03-30 15:29:00 -07:00
|
|
|
if canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
tries = tries + 1
|
|
|
|
end
|
|
|
|
input.press("A")
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
evolveNidoking = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.handleWild() then
|
|
|
|
if not inventory.contains("moon_stone") then
|
|
|
|
if initialize() then
|
2014-07-12 18:47:39 -07:00
|
|
|
bridge.caught("nidoking")
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if menu.close() then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif not inventory.use("moon_stone") then
|
2014-07-12 18:47:39 -07:00
|
|
|
menu.pause()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
helix = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.handleWild() then
|
|
|
|
if inventory.contains("helix_fossil") then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
player.interact("Up")
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
reportMtMoon = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.pp("horn_attack") == 0 then
|
2014-07-12 18:47:39 -07:00
|
|
|
print("ERR: Ran out of Horn Attacks")
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if strategies.moonEncounters then
|
2014-07-12 18:47:39 -07:00
|
|
|
local parasStatus
|
|
|
|
local conjunction = "but"
|
|
|
|
local goodEncounters = strategies.moonEncounters < 10
|
|
|
|
local parasCatch
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.inParty("paras") then
|
2014-07-12 18:47:39 -07:00
|
|
|
parasCatch = "paras"
|
2015-03-30 15:29:00 -07:00
|
|
|
if goodEncounters then
|
2014-07-12 18:47:39 -07:00
|
|
|
conjunction = "and"
|
|
|
|
end
|
|
|
|
parasStatus = "we found a Paras!"
|
|
|
|
else
|
|
|
|
parasCatch = "no_paras"
|
2015-03-30 15:29:00 -07:00
|
|
|
if not goodEncounters then
|
2014-07-12 18:47:39 -07:00
|
|
|
conjunction = "and"
|
|
|
|
end
|
|
|
|
parasStatus = "we didn't find a Paras :("
|
|
|
|
end
|
|
|
|
bridge.caught(parasCatch)
|
|
|
|
bridge.chat(strategies.moonEncounters.." Moon encounters, "..conjunction.." "..parasStatus)
|
|
|
|
strategies.moonEncounters = nil
|
|
|
|
end
|
|
|
|
|
2015-03-28 17:16:04 -07:00
|
|
|
local timeLimit = getTimeRequirement("mt_moon")
|
2014-07-12 18:47:39 -07:00
|
|
|
resetTime(timeLimit, "complete Mt. Moon", true)
|
|
|
|
return true
|
|
|
|
end,
|
|
|
|
|
|
|
|
-- 4: MT. MOON
|
|
|
|
|
|
|
|
dodgeCerulean = function()
|
|
|
|
return dodgeH{
|
|
|
|
npc = 0x0242,
|
|
|
|
sx = 14, sy = 18,
|
|
|
|
dodge = 19,
|
|
|
|
offset = 10,
|
|
|
|
dist = 4
|
|
|
|
}
|
|
|
|
end,
|
|
|
|
|
|
|
|
dodgeCeruleanLeft = function()
|
|
|
|
return dodgeH{
|
|
|
|
npc = 0x0242,
|
|
|
|
sx = 16, sy = 18,
|
|
|
|
dodge = 17,
|
|
|
|
offset = 10,
|
|
|
|
dist = -7,
|
|
|
|
left = true
|
|
|
|
}
|
|
|
|
end,
|
|
|
|
|
|
|
|
rivalSandAttack = function(data)
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
|
|
|
if battle.redeployNidoking() then
|
2014-07-12 18:47:39 -07:00
|
|
|
return false
|
|
|
|
end
|
2015-03-30 14:46:37 -07:00
|
|
|
|
2014-07-12 18:47:39 -07:00
|
|
|
local opponent = battle.opponent()
|
2015-03-30 15:29:00 -07:00
|
|
|
if opponent == "pidgeotto" then
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = true
|
|
|
|
combat.disableThrash = true
|
2015-03-30 15:29:00 -07:00
|
|
|
if memory.value("battle", "accuracy") < 7 then
|
2014-07-12 18:47:39 -07:00
|
|
|
local __, turns = combat.bestMove()
|
2015-03-30 15:29:00 -07:00
|
|
|
if turns == 1 and battle.sacrifice("pidgey", "spearow", "paras", "oddish", "squirtle") then
|
2015-03-30 14:46:37 -07:00
|
|
|
return false
|
2014-07-12 18:47:39 -07:00
|
|
|
end
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif opponent == "raticate" then
|
2014-07-12 18:47:39 -07:00
|
|
|
combat.disableThrash = opponentDamaged() or (not yolo and pokemon.index(0, "hp") < 32) -- RISK
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif opponent == "ivysaur" then
|
|
|
|
if not yolo and damaged(5) and inventory.contains("super_potion") then
|
2014-07-12 18:47:39 -07:00
|
|
|
inventory.use("super_potion", nil, true)
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
combat.disableThrash = opponentDamaged()
|
|
|
|
else
|
|
|
|
combat.disableThrash = false
|
|
|
|
end
|
2015-03-30 14:46:37 -07:00
|
|
|
battle.automate()
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = true
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
combat.disableThrash = false
|
|
|
|
return true
|
|
|
|
else
|
|
|
|
textbox.handle()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
teachThrash = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if initialize() then
|
|
|
|
if pokemon.hasMove("thrash") or pokemon.info("nidoking", "level") < 21 then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if strategyFunctions.teach({move="thrash",item="rare_candy",replace="leer"}) then
|
|
|
|
if menu.close() then
|
2014-07-12 18:47:39 -07:00
|
|
|
local att = pokemon.index(0, "attack")
|
|
|
|
local def = pokemon.index(0, "defense")
|
|
|
|
local spd = pokemon.index(0, "speed")
|
|
|
|
local scl = pokemon.index(0, "special")
|
|
|
|
local statDesc = att.." "..def.." "..spd.." "..scl
|
|
|
|
nidoAttack = att
|
|
|
|
nidoSpeed = spd
|
|
|
|
nidoSpecial = scl
|
|
|
|
bridge.stats(statDesc)
|
|
|
|
print(statDesc)
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
redbarMankey = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if not setYolo("mankey") then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
local curr_hp, red_hp = pokemon.index(0, "hp"), redHP()
|
2015-03-30 15:29:00 -07:00
|
|
|
if curr_hp <= red_hp then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if initialize() then
|
|
|
|
if pokemon.info("nidoking", "level") < 23 or inventory.count("potion") < 3 then -- RISK
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
bridge.chat("Using Poison Sting to attempt to redbar off Mankey")
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = true
|
|
|
|
local enemyMove, enemyTurns = combat.enemyAttack()
|
2015-03-30 15:29:00 -07:00
|
|
|
if enemyTurns then
|
|
|
|
if enemyTurns < 2 then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
local scratchDmg = enemyMove.damage
|
2015-03-30 15:29:00 -07:00
|
|
|
if curr_hp - red_hp > scratchDmg then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
battle.automate("poison_sting")
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
else
|
|
|
|
textbox.handle()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
2015-01-19 17:11:52 -08:00
|
|
|
thrashGeodude = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
2015-01-19 17:11:52 -08:00
|
|
|
canProgress = true
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.isOpponent("geodude") and pokemon.isDeployed("nidoking") then
|
|
|
|
if battle.sacrifice("squirtle") then
|
2015-01-19 17:11:52 -08:00
|
|
|
return false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
battle.automate()
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2015-01-19 17:11:52 -08:00
|
|
|
return true
|
|
|
|
else
|
|
|
|
textbox.handle()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
2014-07-12 18:47:39 -07:00
|
|
|
potionBeforeGoldeen = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if not STREAMING_MODE and nidoSpeed == 51 then
|
2015-01-19 17:11:52 -08:00
|
|
|
return false --TEST
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if initialize() then
|
|
|
|
if setYolo("goldeen") or pokemon.index(0, "hp") > 7 then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return strategyFunctions.potion({hp=64, chain=true})
|
|
|
|
end,
|
|
|
|
|
|
|
|
potionBeforeMisty = function()
|
|
|
|
local healAmount = 70
|
2015-03-30 15:29:00 -07:00
|
|
|
if yolo then
|
|
|
|
if nidoAttack > 53 and nidoSpeed > 50 then
|
2014-07-12 18:47:39 -07:00
|
|
|
healAmount = 45
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif nidoAttack > 53 then
|
2014-07-12 18:47:39 -07:00
|
|
|
healAmount = 65
|
|
|
|
end
|
|
|
|
else
|
2015-03-30 15:29:00 -07:00
|
|
|
if nidoAttack > 54 and nidoSpeed > 51 then -- RISK
|
2014-07-12 18:47:39 -07:00
|
|
|
healAmount = 45
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif nidoAttack > 53 and nidoSpeed > 50 then
|
2014-07-12 18:47:39 -07:00
|
|
|
healAmount = 65
|
|
|
|
end
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if initialize() then
|
|
|
|
if healAmount < 60 then
|
2015-03-30 14:46:37 -07:00
|
|
|
bridge.chat("Limiting heals to attempt to get closer to red-bar off Misty", inventory.count("potion"))
|
|
|
|
end
|
|
|
|
end
|
2014-07-12 18:47:39 -07:00
|
|
|
return strategyFunctions.potion({hp=healAmount})
|
|
|
|
end,
|
|
|
|
|
2015-03-28 12:47:01 -07:00
|
|
|
fightMisty = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
2015-03-28 12:47:01 -07:00
|
|
|
canProgress = true
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.redeployNidoking() then
|
|
|
|
if tempDir == false then
|
2015-03-30 14:46:37 -07:00
|
|
|
tempDir = true
|
|
|
|
end
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
local swappedOut = tempDir
|
2015-03-30 15:29:00 -07:00
|
|
|
if not swappedOut and combat.isConfused() then
|
2015-03-30 14:46:37 -07:00
|
|
|
tempDir = false
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.sacrifice("pidgey", "spearow", "paras") then
|
2015-03-28 12:47:01 -07:00
|
|
|
return false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
battle.automate()
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2015-03-28 12:47:01 -07:00
|
|
|
return true
|
|
|
|
else
|
|
|
|
textbox.handle()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
2014-07-12 18:47:39 -07:00
|
|
|
-- 6: MISTY
|
|
|
|
|
|
|
|
potionBeforeRocket = function()
|
|
|
|
local minAttack = 55 -- RISK
|
2015-03-30 15:29:00 -07:00
|
|
|
if yolo then
|
2014-07-12 18:47:39 -07:00
|
|
|
minAttack = minAttack - 1
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if nidoAttack >= minAttack then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
return strategyFunctions.potion({hp=10})
|
|
|
|
end,
|
|
|
|
|
|
|
|
jingleSkip = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
local px, py = player.position()
|
2015-03-30 15:29:00 -07:00
|
|
|
if px < 4 then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
input.press("Left", 0)
|
|
|
|
else
|
|
|
|
input.press("A", 0)
|
|
|
|
canProgress = true
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
catchOddish = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if not control.canCatch() then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
local caught = pokemon.inParty("oddish", "paras")
|
|
|
|
local battleValue = memory.value("game", "battle")
|
|
|
|
local px, py = player.position()
|
2015-03-30 15:29:00 -07:00
|
|
|
if battleValue > 0 then
|
|
|
|
if battleValue == 2 then
|
2014-07-12 18:47:39 -07:00
|
|
|
tries = 2
|
|
|
|
battle.automate()
|
|
|
|
else
|
2015-03-30 15:29:00 -07:00
|
|
|
if tries == 0 and py == 31 then
|
2014-07-12 18:47:39 -07:00
|
|
|
tries = 1
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if not control.shouldCatch() then
|
2014-07-12 18:47:39 -07:00
|
|
|
battle.run()
|
|
|
|
end
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif tries == 1 and py == 31 then
|
2014-07-12 18:47:39 -07:00
|
|
|
player.interact("Left")
|
|
|
|
else
|
|
|
|
local path
|
2015-03-30 15:29:00 -07:00
|
|
|
if caught then
|
|
|
|
if not tempDir then
|
2014-07-12 18:47:39 -07:00
|
|
|
bridge.caught(pokemon.inParty("oddish"))
|
|
|
|
tempDir = true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if py < 21 then
|
2014-07-12 18:47:39 -07:00
|
|
|
py = 21
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif py < 24 then
|
|
|
|
if px < 16 then
|
2014-07-12 18:47:39 -07:00
|
|
|
px = 17
|
|
|
|
else
|
|
|
|
py = 24
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif py < 25 then
|
2014-07-12 18:47:39 -07:00
|
|
|
py = 25
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif px > 15 then
|
2014-07-12 18:47:39 -07:00
|
|
|
px = 15
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif py < 28 then
|
2014-07-12 18:47:39 -07:00
|
|
|
py = 28
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif py > 29 then
|
2014-07-12 18:47:39 -07:00
|
|
|
py = 29
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif px ~= 11 then
|
2014-07-12 18:47:39 -07:00
|
|
|
px = 11
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif py ~= 29 then
|
2014-07-12 18:47:39 -07:00
|
|
|
py = 29
|
|
|
|
else
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
walk.step(px, py)
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif px == 12 then
|
2014-07-12 18:47:39 -07:00
|
|
|
local dy
|
2015-03-30 15:29:00 -07:00
|
|
|
if py == 30 then
|
2014-07-12 18:47:39 -07:00
|
|
|
dy = 31
|
|
|
|
else
|
|
|
|
dy = 30
|
|
|
|
end
|
|
|
|
walk.step(px, dy)
|
|
|
|
else
|
|
|
|
local path = {{15,19}, {15,25}, {15,25}, {15,27}, {14,27}, {14,30}, {12,30}}
|
|
|
|
walk.custom(path)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
2015-03-28 12:47:01 -07:00
|
|
|
shopVermilionMart = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if initialize() then
|
2014-07-12 18:47:39 -07:00
|
|
|
setYolo("vermilion")
|
|
|
|
end
|
|
|
|
local buyArray, sellArray
|
2015-03-30 15:29:00 -07:00
|
|
|
if not inventory.contains("pokeball") or (not yolo and nidoAttack < 53) then
|
2014-07-12 18:47:39 -07:00
|
|
|
sellArray = {{name="pokeball"}, {name="antidote"}, {name="tm34"}, {name="nugget"}}
|
|
|
|
buyArray = {{name="super_potion",index=1,amount=3}, {name="paralyze_heal",index=4,amount=2}, {name="repel",index=5,amount=3}}
|
|
|
|
else
|
|
|
|
sellArray = {{name="antidote"}, {name="tm34"}, {name="nugget"}}
|
|
|
|
buyArray = {{name="super_potion",index=1,amount=3}, {name="repel",index=5,amount=3}}
|
|
|
|
end
|
|
|
|
return shop.transaction{
|
|
|
|
sell = sellArray,
|
|
|
|
buy = buyArray
|
|
|
|
}
|
|
|
|
end,
|
|
|
|
|
2015-03-28 12:47:01 -07:00
|
|
|
-- rivalSandAttack
|
|
|
|
|
2014-07-12 18:47:39 -07:00
|
|
|
trashcans = function()
|
|
|
|
local progress = memory.value("progress", "trashcans")
|
2015-03-30 15:29:00 -07:00
|
|
|
if textbox.isActive() then
|
|
|
|
if not canProgress then
|
|
|
|
if progress < 2 then
|
2014-07-12 18:47:39 -07:00
|
|
|
tries = tries + 1
|
|
|
|
end
|
|
|
|
canProgress = true
|
|
|
|
end
|
|
|
|
input.cancel()
|
|
|
|
else
|
2015-03-30 15:29:00 -07:00
|
|
|
if progress == 3 then
|
2014-07-12 18:47:39 -07:00
|
|
|
local px, py = player.position()
|
2015-03-30 15:29:00 -07:00
|
|
|
if px == 4 and py == 6 then
|
2014-07-12 18:47:39 -07:00
|
|
|
tries = tries + 1
|
|
|
|
local timeLimit = getTimeRequirement("trash") + 1
|
2015-03-30 15:29:00 -07:00
|
|
|
if resetTime(timeLimit, "complete Trashcans ("..tries.." tries)") then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
setYolo("trash")
|
2015-03-28 17:16:04 -07:00
|
|
|
|
2014-07-12 18:47:39 -07:00
|
|
|
local prefix
|
|
|
|
local suffix = "!"
|
2015-03-30 15:29:00 -07:00
|
|
|
if tries < 2 then
|
2014-07-12 18:47:39 -07:00
|
|
|
prefix = "PERFECT"
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif tries < 4 then
|
2014-07-12 18:47:39 -07:00
|
|
|
prefix = "Amazing"
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif tries < 7 then
|
2014-07-12 18:47:39 -07:00
|
|
|
prefix = "Great"
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif tries < 10 then
|
2014-07-12 18:47:39 -07:00
|
|
|
prefix = "Good"
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif tries < 24 then
|
2014-07-12 18:47:39 -07:00
|
|
|
prefix = "Ugh"
|
|
|
|
suffix = "."
|
2015-01-19 17:11:52 -08:00
|
|
|
else -- TODO trashcans WR
|
2014-07-12 18:47:39 -07:00
|
|
|
prefix = "Reset me now"
|
|
|
|
suffix = " BibleThump"
|
|
|
|
end
|
2015-03-30 14:46:37 -07:00
|
|
|
bridge.chat(prefix..", "..tries.." try Trashcans"..suffix, utils.elapsedTime())
|
2014-07-12 18:47:39 -07:00
|
|
|
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
|
2015-03-30 15:29:00 -07:00
|
|
|
if px == tile[1] and py == tile[2] then
|
2014-07-12 18:47:39 -07:00
|
|
|
walkIn = dir
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
input.press(walkIn, 0)
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif progress == 2 then
|
|
|
|
if canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = false
|
|
|
|
walk.invertCustom()
|
|
|
|
end
|
|
|
|
local inverse = {
|
|
|
|
Up = "Down",
|
|
|
|
Right = "Left",
|
|
|
|
Down = "Up",
|
|
|
|
Left = "Right"
|
|
|
|
}
|
|
|
|
player.interact(inverse[tempDir])
|
|
|
|
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},{7,8},{"Down"},{7,8}, {9,8},{"Up"},{9,8}, {8,8},{8,11},{"Right"},{8,11}}
|
2015-03-30 15:29:00 -07:00
|
|
|
if tempDir and type(tempDir) == "number" then
|
2014-07-12 18:47:39 -07:00
|
|
|
local px, py = player.position()
|
|
|
|
local dx, dy = px, py
|
2015-03-30 15:29:00 -07:00
|
|
|
if py < 12 then
|
2014-07-12 18:47:39 -07:00
|
|
|
dy = 12
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif tempDir == 1 then
|
2014-07-12 18:47:39 -07:00
|
|
|
dx = 2
|
|
|
|
else
|
|
|
|
dx = 8
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if px ~= dx or py ~= dy then
|
2014-07-12 18:47:39 -07:00
|
|
|
walk.step(dx, dy)
|
|
|
|
return
|
|
|
|
end
|
|
|
|
tempDir = nil
|
|
|
|
end
|
|
|
|
tempDir = walk.custom(trashPath, canProgress)
|
|
|
|
canProgress = false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
fightSurge = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = true
|
|
|
|
local forced
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.isOpponent("voltorb") then
|
2014-07-12 18:47:39 -07:00
|
|
|
combat.disableThrash = true
|
|
|
|
local __, enemyTurns = combat.enemyAttack()
|
2015-03-30 15:29:00 -07:00
|
|
|
if not enemyTurns or enemyTurns > 2 then
|
2014-07-12 18:47:39 -07:00
|
|
|
forced = "bubblebeam"
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif enemyTurns == 2 and not opponentDamaged() then
|
2014-07-12 18:47:39 -07:00
|
|
|
local curr_hp, red_hp = pokemon.index(0, "hp"), redHP()
|
|
|
|
local afterHit = curr_hp - 20
|
2015-03-30 15:29:00 -07:00
|
|
|
if afterHit > 5 and afterHit <= red_hp then
|
2014-07-12 18:47:39 -07:00
|
|
|
forced = "bubblebeam"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
combat.disableThrash = false
|
|
|
|
end
|
|
|
|
battle.automate(forced)
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
else
|
|
|
|
textbox.handle()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
-- 7: SURGE
|
|
|
|
|
|
|
|
procureBicycle = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if inventory.contains("bicycle") then
|
|
|
|
if not textbox.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
input.cancel()
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif textbox.handle() then
|
2015-03-28 12:47:01 -07:00
|
|
|
player.interact("Right")
|
2014-07-12 18:47:39 -07:00
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
swapBicycle = function()
|
|
|
|
local bicycleIdx = inventory.indexOf("bicycle")
|
2015-03-30 15:29:00 -07:00
|
|
|
if bicycleIdx < 3 then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
local main = memory.value("menu", "main")
|
2015-03-30 15:29:00 -07:00
|
|
|
if main == 128 then
|
|
|
|
if menu.getCol() ~= 5 then
|
2014-07-12 18:47:39 -07:00
|
|
|
menu.select(2, true)
|
|
|
|
else
|
|
|
|
local selection = memory.value("menu", "selection_mode")
|
2015-03-30 15:29:00 -07:00
|
|
|
if selection == 0 then
|
|
|
|
if menu.select(0, "accelerate", true, nil, true) then
|
2014-07-12 18:47:39 -07:00
|
|
|
input.press("Select")
|
|
|
|
end
|
|
|
|
else
|
2015-03-30 15:29:00 -07:00
|
|
|
if menu.select(bicycleIdx, "accelerate", true, nil, true) then
|
2014-07-12 18:47:39 -07:00
|
|
|
input.press("Select")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
menu.pause()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
redbarCubone = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
local forced
|
|
|
|
canProgress = true
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.isOpponent("cubone") then
|
2014-07-12 18:47:39 -07:00
|
|
|
local enemyMove, enemyTurns = combat.enemyAttack()
|
2015-03-30 15:29:00 -07:00
|
|
|
if enemyTurns then
|
2014-07-12 18:47:39 -07:00
|
|
|
local curr_hp, red_hp = pokemon.index(0, "hp"), redHP()
|
|
|
|
local clubDmg = enemyMove.damage
|
|
|
|
local afterHit = curr_hp - clubDmg
|
2015-03-30 14:46:37 -07:00
|
|
|
red_hp = red_hp - 2
|
2015-03-30 15:29:00 -07:00
|
|
|
if afterHit > -2 and afterHit < red_hp then
|
2014-07-12 18:47:39 -07:00
|
|
|
forced = "thunderbolt"
|
|
|
|
else
|
|
|
|
afterHit = afterHit - clubDmg
|
2015-03-30 15:29:00 -07:00
|
|
|
if afterHit > -4 and afterHit < red_hp then
|
2014-07-12 18:47:39 -07:00
|
|
|
forced = "thunderbolt"
|
|
|
|
end
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if forced and initialize() then
|
2014-07-12 18:47:39 -07:00
|
|
|
bridge.chat("Using Thunderbolt to attempt to redbar off Cubone")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
battle.automate(forced)
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
else
|
|
|
|
battle.automate()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
2015-03-28 12:47:01 -07:00
|
|
|
shopTM07 = function()
|
2014-07-12 18:47:39 -07:00
|
|
|
return shop.transaction{
|
2015-03-28 12:47:01 -07:00
|
|
|
direction = "Up",
|
|
|
|
buy = {{name="horn_drill", index=3}}
|
2014-07-12 18:47:39 -07:00
|
|
|
}
|
|
|
|
end,
|
|
|
|
|
2015-03-28 12:47:01 -07:00
|
|
|
shopRepels = function()
|
2014-07-12 18:47:39 -07:00
|
|
|
return shop.transaction{
|
|
|
|
direction = "Up",
|
2015-03-28 12:47:01 -07:00
|
|
|
buy = {{name="super_repel", index=3, amount=9}}
|
|
|
|
}
|
|
|
|
end,
|
|
|
|
|
|
|
|
shopPokeDoll = function()
|
|
|
|
return shop.transaction{
|
|
|
|
direction = "Down",
|
|
|
|
buy = {{name="pokedoll", index=0}}
|
2014-07-12 18:47:39 -07:00
|
|
|
}
|
|
|
|
end,
|
|
|
|
|
|
|
|
shopVending = function()
|
|
|
|
return shop.vend{
|
|
|
|
direction = "Up",
|
|
|
|
buy = {{name="fresh_water", index=0}, {name="soda_pop", index=1}}
|
|
|
|
}
|
|
|
|
end,
|
|
|
|
|
|
|
|
giveWater = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if not inventory.contains("fresh_water", "soda_pop") then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if textbox.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
input.cancel("A")
|
|
|
|
else
|
|
|
|
local cx, cy = memory.raw(0x0223) - 3, memory.raw(0x0222) - 3
|
|
|
|
local px, py = player.position()
|
2015-03-30 15:29:00 -07:00
|
|
|
if utils.dist(cx, cy, px, py) == 1 then
|
2014-07-12 18:47:39 -07:00
|
|
|
player.interact(walk.dir(px, py, cx, cy))
|
|
|
|
else
|
|
|
|
walk.step(cx, cy)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
shopExtraWater = function()
|
|
|
|
return shop.vend{
|
|
|
|
direction = "Up",
|
|
|
|
buy = {{name="fresh_water", index=0}}
|
|
|
|
}
|
|
|
|
end,
|
|
|
|
|
2015-03-28 12:47:01 -07:00
|
|
|
shopBuffs = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if initialize() then
|
2015-03-28 12:47:01 -07:00
|
|
|
local minSpecial = 45
|
2015-03-30 15:29:00 -07:00
|
|
|
if yolo then
|
2015-03-28 12:47:01 -07:00
|
|
|
minSpecial = minSpecial - 1
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if nidoAttack >= 54 and nidoSpecial >= minSpecial then
|
2015-03-28 12:47:01 -07:00
|
|
|
riskGiovanni = true
|
|
|
|
print("Giovanni skip strats!")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local xspecAmt = 4
|
2015-03-30 15:29:00 -07:00
|
|
|
if riskGiovanni then
|
2015-03-28 12:47:01 -07:00
|
|
|
xspecAmt = xspecAmt + 1
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif nidoSpecial < 46 then
|
2015-03-30 14:46:37 -07:00
|
|
|
-- xspecAmt = xspecAmt - 1
|
2015-03-28 12:47:01 -07:00
|
|
|
end
|
2014-07-12 18:47:39 -07:00
|
|
|
return shop.transaction{
|
|
|
|
direction = "Up",
|
2015-03-28 12:47:01 -07:00
|
|
|
buy = {{name="x_accuracy", index=0, amount=10}, {name="x_speed", index=5, amount=4}, {name="x_special", index=6, amount=xspecAmt}}
|
2014-07-12 18:47:39 -07:00
|
|
|
}
|
|
|
|
end,
|
|
|
|
|
2015-03-28 12:47:01 -07:00
|
|
|
deptElevator = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if textbox.isActive() then
|
2015-03-28 12:47:01 -07:00
|
|
|
canProgress = true
|
|
|
|
menu.select(0, false)
|
|
|
|
else
|
2015-03-30 15:29:00 -07:00
|
|
|
if canProgress then
|
2015-03-28 12:47:01 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
player.interact("Up")
|
|
|
|
end
|
2014-07-12 18:47:39 -07:00
|
|
|
end,
|
|
|
|
|
|
|
|
swapRepels = function()
|
|
|
|
local repelIdx = inventory.indexOf("super_repel")
|
2015-03-30 15:29:00 -07:00
|
|
|
if repelIdx < 3 then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
local main = memory.value("menu", "main")
|
2015-03-30 15:29:00 -07:00
|
|
|
if main == 128 then
|
|
|
|
if menu.getCol() ~= 5 then
|
2014-07-12 18:47:39 -07:00
|
|
|
menu.select(2, true)
|
|
|
|
else
|
|
|
|
local selection = memory.value("menu", "selection_mode")
|
2015-03-30 15:29:00 -07:00
|
|
|
if selection == 0 then
|
|
|
|
if menu.select(1, "accelerate", true, nil, true) then
|
2014-07-12 18:47:39 -07:00
|
|
|
input.press("Select")
|
|
|
|
end
|
|
|
|
else
|
2015-03-30 15:29:00 -07:00
|
|
|
if menu.select(repelIdx, "accelerate", true, nil, true) then
|
2014-07-12 18:47:39 -07:00
|
|
|
input.press("Select")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
menu.pause()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
-- 8: FLY
|
|
|
|
|
|
|
|
lavenderRival = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = true
|
|
|
|
local forced
|
2015-03-30 15:29:00 -07:00
|
|
|
if nidoSpecial > 44 then -- RISK
|
2014-07-12 18:47:39 -07:00
|
|
|
local __, enemyTurns = combat.enemyAttack()
|
2015-03-30 15:29:00 -07:00
|
|
|
if enemyTurns and enemyTurns < 2 and pokemon.isOpponent("pidgeotto", "gyarados") then
|
2014-07-12 18:47:39 -07:00
|
|
|
battle.automate()
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.isOpponent("gyarados") or prepare("x_accuracy") then
|
2014-07-12 18:47:39 -07:00
|
|
|
battle.automate()
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
else
|
|
|
|
input.cancel()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
pokeDoll = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = true
|
|
|
|
inventory.use("pokedoll", nil, true)
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
else
|
|
|
|
input.cancel()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
digFight = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = true
|
|
|
|
local backupIndex = pokemon.indexOf("paras", "squirtle")
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.isDeployed("nidoking") then
|
|
|
|
if pokemon.info("nidoking", "hp") == 0 then
|
|
|
|
if utils.onPokemonSelect(memory.value("battle", "menu")) then
|
2014-07-12 18:47:39 -07:00
|
|
|
menu.select(backupIndex, true)
|
|
|
|
else
|
|
|
|
input.press("A")
|
|
|
|
end
|
|
|
|
else
|
|
|
|
battle.automate()
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif pokemon.info("nidoking", "hp") == 0 and pokemon.index(backupIndex, "hp") == 0 and pokemon.isDeployed("paras", "squirtle") then
|
2014-07-12 18:47:39 -07:00
|
|
|
return resetDeath()
|
|
|
|
else
|
|
|
|
battle.fight("dig")
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
else
|
|
|
|
textbox.handle()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
thunderboltFirst = function()
|
|
|
|
local forced
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.isOpponent("zubat") then
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = true
|
|
|
|
forced = "thunderbolt"
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
battle.automate(forced)
|
|
|
|
end,
|
|
|
|
|
|
|
|
-- 8: POKÉFLUTE
|
|
|
|
|
|
|
|
playPokeflute = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if memory.value("battle", "menu") == 95 then
|
2014-07-12 18:47:39 -07:00
|
|
|
input.press("A")
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif menu.pause() then
|
2014-07-12 18:47:39 -07:00
|
|
|
inventory.use("pokeflute")
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
drivebyRareCandy = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if textbox.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = true
|
|
|
|
input.cancel()
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
else
|
|
|
|
local px, py = player.position()
|
2015-03-30 15:29:00 -07:00
|
|
|
if py < 13 then
|
2014-07-12 18:47:39 -07:00
|
|
|
tries = 0
|
|
|
|
return
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if py == 13 and tries % 2 == 0 then
|
2014-07-12 18:47:39 -07:00
|
|
|
input.press("A", 2)
|
|
|
|
else
|
|
|
|
input.press("Up")
|
|
|
|
tries = 0
|
|
|
|
end
|
|
|
|
tries = tries + 1
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
safariCarbos = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if initialize() then
|
2014-07-12 18:47:39 -07:00
|
|
|
setYolo("safari_carbos")
|
|
|
|
end
|
|
|
|
local minSpeed = 50
|
2015-03-30 15:29:00 -07:00
|
|
|
if yolo then
|
2014-07-12 18:47:39 -07:00
|
|
|
minSpeed = minSpeed - 1
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if nidoSpeed >= minSpeed then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if inventory.contains("carbos") then
|
|
|
|
if walk.step(20, 20) then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
else
|
|
|
|
local px, py = player.position()
|
2015-03-30 15:29:00 -07:00
|
|
|
if px < 21 then
|
2014-07-12 18:47:39 -07:00
|
|
|
walk.step(21, py)
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif px == 21 and py == 13 then
|
2014-07-12 18:47:39 -07:00
|
|
|
player.interact("Left")
|
|
|
|
else
|
|
|
|
walk.step(21, 13)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
centerSkipFullRestore = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if initialize() then
|
|
|
|
if yolo or inventory.contains("full_restore") then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
2015-03-30 14:46:37 -07:00
|
|
|
bridge.chat("We need to grab the backup Full Restore here.")
|
2014-07-12 18:47:39 -07:00
|
|
|
end
|
|
|
|
local px, py = player.position()
|
2015-03-30 15:29:00 -07:00
|
|
|
if px < 21 then
|
2014-07-12 18:47:39 -07:00
|
|
|
px = 21
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif py < 9 then
|
2014-07-12 18:47:39 -07:00
|
|
|
py = 9
|
|
|
|
else
|
|
|
|
return strategyFunctions.interact({dir="Down"})
|
|
|
|
end
|
|
|
|
walk.step(px, py)
|
|
|
|
end,
|
|
|
|
|
|
|
|
silphElevator = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if textbox.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = true
|
|
|
|
menu.select(9, false, true)
|
|
|
|
else
|
2015-03-30 15:29:00 -07:00
|
|
|
if canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
player.interact("Up")
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
fightSilphMachoke = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = true
|
2015-03-30 15:29:00 -07:00
|
|
|
if nidoSpecial > 44 then
|
2014-07-12 18:47:39 -07:00
|
|
|
return prepare("x_accuracy")
|
|
|
|
end
|
|
|
|
battle.automate("thrash")
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
else
|
|
|
|
textbox.handle()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
silphCarbos = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if nidoSpeed > 50 then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
return strategyFunctions.interact({dir="Left"})
|
|
|
|
end,
|
|
|
|
|
|
|
|
silphRival = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
|
|
|
if initialize() then
|
2015-03-28 21:28:58 -07:00
|
|
|
tempDir = combat.healthFor("RivalGyarados")
|
|
|
|
print("Gyarados "..tempDir)
|
|
|
|
canProgress = true
|
|
|
|
end
|
|
|
|
local gyaradosDamage = tempDir
|
|
|
|
|
|
|
|
local forced
|
|
|
|
local readyToAttack = false
|
|
|
|
local opName = battle.opponent()
|
|
|
|
if opName == "gyarados" then
|
|
|
|
readyToAttack = true
|
|
|
|
local hp, red_hp = pokemon.index(0, "hp"), redHP()
|
2015-03-30 15:29:00 -07:00
|
|
|
if hp > gyaradosDamage * 0.98 and hp - gyaradosDamage * 0.975 < red_hp then --TODO
|
|
|
|
if prepare("x_special") then
|
2015-03-28 21:28:58 -07:00
|
|
|
forced = "ice_beam"
|
|
|
|
else
|
|
|
|
readyToAttack = false
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif isPrepared("x_special") then
|
2015-03-28 21:28:58 -07:00
|
|
|
local canPotion
|
2015-03-30 15:29:00 -07:00
|
|
|
if inventory.contains("potion") and hp + 20 > gyaradosDamage and hp + 20 - gyaradosDamage < red_hp then
|
2015-03-28 21:28:58 -07:00
|
|
|
canPotion = "potion"
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif inventory.contains("super_potion") and hp + 50 > gyaradosDamage and hp + 50 - gyaradosDamage < red_hp then
|
2015-03-28 21:28:58 -07:00
|
|
|
canPotion = "super_potion"
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if canPotion then
|
2015-03-28 21:28:58 -07:00
|
|
|
inventory.use(canPotion, nil, true)
|
|
|
|
readyToAttack = false
|
|
|
|
end
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif prepare("x_accuracy", "x_speed") then
|
|
|
|
if opName == "pidgeot" then
|
|
|
|
if riskGiovanni or nidoSpecial < 45 or pokemon.info("nidoking", "hp") > 85 then
|
2014-07-12 18:47:39 -07:00
|
|
|
forced = "thunderbolt"
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif opName == "alakazam" or opName == "growlithe" then
|
2014-07-12 18:47:39 -07:00
|
|
|
forced = "earthquake"
|
|
|
|
end
|
2015-03-28 21:28:58 -07:00
|
|
|
readyToAttack = true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if readyToAttack then
|
2014-07-12 18:47:39 -07:00
|
|
|
battle.automate(forced)
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
else
|
|
|
|
textbox.handle()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
fightSilphGiovanni = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = true
|
|
|
|
local forced
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.isOpponent("nidorino") then
|
|
|
|
if battle.pp("horn_drill") > 2 then
|
2014-07-12 18:47:39 -07:00
|
|
|
forced = "horn_drill"
|
|
|
|
else
|
|
|
|
forced = "earthquake"
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif pokemon.isOpponent("rhyhorn") then
|
2014-07-12 18:47:39 -07:00
|
|
|
forced = "ice_beam"
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif pokemon.isOpponent("kangaskhan") then
|
2014-07-12 18:47:39 -07:00
|
|
|
forced = "horn_drill"
|
|
|
|
end
|
|
|
|
battle.automate(forced)
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
else
|
|
|
|
textbox.handle()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
-- 9: SILPH CO.
|
|
|
|
|
2015-03-28 21:28:58 -07:00
|
|
|
healBeforeHypno = function()
|
|
|
|
local curr_hp, red_hp = pokemon.index(0, "hp"), redHP()
|
|
|
|
local healthUnderRedBar = red_hp - curr_hp
|
|
|
|
local yoloHP = combat.healthFor("HypnoHeadbutt") * 0.9
|
|
|
|
local healTarget
|
|
|
|
local rareCandyCount = inventory.count("rare_candy")
|
|
|
|
local useRareCandy
|
2015-03-30 15:29:00 -07:00
|
|
|
if healthUnderRedBar >= 0 then
|
2015-03-28 21:28:58 -07:00
|
|
|
healTarget = "HypnoHeadbutt"
|
2015-03-30 15:29:00 -07:00
|
|
|
if healthUnderRedBar > 2 then
|
|
|
|
if rareCandyCount > 2 then
|
2015-03-28 21:28:58 -07:00
|
|
|
useRareCandy = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
healTarget = "HypnoConfusion"
|
|
|
|
useRareCandy = rareCandyCount > 2
|
|
|
|
end
|
|
|
|
if useRareCandy then
|
2015-03-30 15:29:00 -07:00
|
|
|
if menu.pause() then
|
2015-03-28 21:28:58 -07:00
|
|
|
inventory.use("rare_candy", nil, false)
|
|
|
|
end
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
|
|
|
return strategyFunctions.potion({hp=healTarget, yolo=yoloHP, close=true})
|
|
|
|
end,
|
|
|
|
|
2014-07-12 18:47:39 -07:00
|
|
|
fightHypno = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
local forced
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.isOpponent("hypno") then
|
|
|
|
if pokemon.info("nidoking", "hp") > combat.healthFor("KogaWeezing") * 0.9 then
|
|
|
|
if combat.isDisabled(85) then
|
2014-07-12 18:47:39 -07:00
|
|
|
forced = "ice_beam"
|
|
|
|
else
|
|
|
|
forced = "thunderbolt"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
battle.automate(forced)
|
|
|
|
canProgress = true
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
else
|
|
|
|
textbox.handle()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
2015-03-28 21:28:58 -07:00
|
|
|
fightKoga = function() --TODO x-accuracy?
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
local forced
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.isOpponent("weezing") then
|
|
|
|
if opponentDamaged(2) then
|
2014-07-12 18:47:39 -07:00
|
|
|
inventory.use("pokeflute", nil, true)
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
forced = "thunderbolt"
|
2015-03-28 21:28:58 -07:00
|
|
|
control.canDie(true)
|
2014-07-12 18:47:39 -07:00
|
|
|
end
|
|
|
|
battle.fight(forced)
|
|
|
|
canProgress = true
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
deepRun = true
|
|
|
|
return true
|
|
|
|
else
|
|
|
|
textbox.handle()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
-- 10: KOGA
|
|
|
|
|
|
|
|
dodgeGirl = function()
|
|
|
|
local gx, gy = memory.raw(0x0223) - 5, memory.raw(0x0222)
|
|
|
|
local px, py = player.position()
|
2015-03-30 15:29:00 -07:00
|
|
|
if py > gy then
|
|
|
|
if px > 3 then
|
2014-07-12 18:47:39 -07:00
|
|
|
px = 3
|
|
|
|
else
|
|
|
|
return true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif gy - py ~= 1 or px ~= gx then
|
2014-07-12 18:47:39 -07:00
|
|
|
py = py + 1
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif px == 3 then
|
2014-07-12 18:47:39 -07:00
|
|
|
px = 2
|
|
|
|
else
|
|
|
|
px = 3
|
|
|
|
end
|
|
|
|
walk.step(px, py)
|
|
|
|
end,
|
|
|
|
|
|
|
|
cinnabarCarbos = function()
|
|
|
|
local px, py = player.position()
|
2015-03-30 15:29:00 -07:00
|
|
|
if px == 21 then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
local minSpeed = 51
|
2015-03-30 15:29:00 -07:00
|
|
|
if yolo then
|
2014-07-12 18:47:39 -07:00
|
|
|
minSpeed = minSpeed - 1
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if nidoSpeed > minSpeed then -- TODO >=
|
2014-07-12 18:47:39 -07:00
|
|
|
walk.step(21, 20)
|
|
|
|
else
|
2015-03-30 15:29:00 -07:00
|
|
|
if py == 20 then
|
2014-07-12 18:47:39 -07:00
|
|
|
py = 21
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif px == 17 and not inventory.contains("carbos") then
|
2014-07-12 18:47:39 -07:00
|
|
|
player.interact("Right")
|
|
|
|
return false
|
|
|
|
else
|
|
|
|
px = 21
|
|
|
|
end
|
|
|
|
walk.step(px, py)
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
fightErika = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = true
|
|
|
|
local forced
|
|
|
|
local curr_hp, red_hp = pokemon.index(0, "hp"), redHP()
|
|
|
|
local razorDamage = 34
|
2015-03-30 15:29:00 -07:00
|
|
|
if curr_hp > razorDamage and curr_hp - razorDamage < red_hp then
|
|
|
|
if opponentDamaged() then
|
2014-07-12 18:47:39 -07:00
|
|
|
forced = "thunderbolt"
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif nidoSpecial < 45 then
|
2014-07-12 18:47:39 -07:00
|
|
|
forced = "ice_beam"
|
|
|
|
else
|
|
|
|
forced = "thunderbolt"
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif riskGiovanni then
|
2014-07-12 18:47:39 -07:00
|
|
|
forced = "ice_beam"
|
|
|
|
end
|
|
|
|
battle.automate(forced)
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
else
|
|
|
|
textbox.handle()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
-- 11: ERIKA
|
|
|
|
|
|
|
|
waitToReceive = function()
|
|
|
|
local main = memory.value("menu", "main")
|
2015-03-30 15:29:00 -07:00
|
|
|
if main == 128 then
|
|
|
|
if canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif main == 32 or main == 123 then
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = true
|
|
|
|
input.cancel()
|
|
|
|
else
|
|
|
|
input.press("Start", 2)
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
-- 14: SABRINA
|
|
|
|
|
|
|
|
earthquakeElixer = function(data)
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.pp("earthquake") >= data.min then
|
|
|
|
if closeMenuFor(data) then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
return false
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if initialize() then
|
|
|
|
if areaName then
|
2014-07-12 18:47:39 -07:00
|
|
|
print("EQ Elixer: "..areaName)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return useItem({item="elixer", poke="nidoking", chain=data.chain, close=data.close})
|
|
|
|
end,
|
|
|
|
|
2015-03-30 15:20:13 -07:00
|
|
|
fightGiovanniMachoke = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if initialize() then
|
|
|
|
if nidoAttack >= 55 then
|
2015-03-30 15:20:13 -07:00
|
|
|
local eqRequired = nidoSpecial >= 47 and 7 or 8
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.pp("earthquake") >= eqRequired then
|
2015-03-30 15:20:13 -07:00
|
|
|
bridge.chat("Using Earthquake strats on the Machokes")
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return prepare("x_special")
|
|
|
|
end,
|
|
|
|
|
2014-07-12 18:47:39 -07:00
|
|
|
checkGiovanni = function()
|
2015-03-30 15:20:13 -07:00
|
|
|
local ryhornDamage = math.floor(combat.healthFor("GiovanniRhyhorn") * 0.9)
|
2015-03-30 15:29:00 -07:00
|
|
|
if initialize() then
|
2014-07-12 18:47:39 -07:00
|
|
|
local earthquakePP = battle.pp("earthquake")
|
2015-03-30 15:29:00 -07:00
|
|
|
if earthquakePP >= 2 then
|
|
|
|
if riskGiovanni then
|
|
|
|
if earthquakePP >= 5 then
|
2015-03-30 15:20:13 -07:00
|
|
|
bridge.chat("Saved enough Earthquake PP for safe strats on Giovanni!")
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif earthquakePP >= 3 and battle.pp("horn_drill") >= 5 and (yolo or pokemon.info("nidoking", "hp") >= ryhornDamage) then -- RISK
|
2015-03-30 15:20:13 -07:00
|
|
|
bridge.chat("Using risky strats on Giovanni to skip the extra Max Ether...")
|
|
|
|
else
|
|
|
|
riskGiovanni = false
|
|
|
|
end
|
2014-07-12 18:47:39 -07:00
|
|
|
end
|
|
|
|
return true
|
|
|
|
end
|
2015-03-30 15:20:13 -07:00
|
|
|
local message = "Ran out of Earthquake PP :( "
|
2015-03-30 15:29:00 -07:00
|
|
|
if yolo then
|
2015-03-30 15:20:13 -07:00
|
|
|
message = message.."Risking on Giovanni."
|
|
|
|
else
|
|
|
|
message = message.."Time for standard strats."
|
2014-07-12 18:47:39 -07:00
|
|
|
end
|
|
|
|
bridge.chat(message)
|
|
|
|
riskGiovanni = false
|
|
|
|
end
|
2015-03-30 15:20:13 -07:00
|
|
|
return strategyFunctions.potion({hp=50, yolo=ryhornDamage})
|
2014-07-12 18:47:39 -07:00
|
|
|
end,
|
|
|
|
|
|
|
|
fightGiovanni = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
|
|
|
if initialize() then
|
2015-03-30 15:20:13 -07:00
|
|
|
tempDir = battle.pp("earthquake")
|
|
|
|
canProgress = true
|
2014-07-12 18:47:39 -07:00
|
|
|
end
|
2015-03-30 15:20:13 -07:00
|
|
|
local forced, needsXSpecial
|
|
|
|
local startEqPP = tempDir
|
2015-03-30 15:29:00 -07:00
|
|
|
if riskGiovanni then
|
|
|
|
if startEqPP < 5 then
|
2015-03-30 15:20:13 -07:00
|
|
|
needsXSpecial = true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if needsXSpecial or battle.pp("earthquake") < 4 then
|
2015-03-30 15:20:13 -07:00
|
|
|
forced = "ice_beam"
|
|
|
|
end
|
|
|
|
else
|
|
|
|
needsXSpecial = startEqPP < 2
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.isOpponent("rhydon") then
|
2015-03-30 15:20:13 -07:00
|
|
|
forced = "ice_beam"
|
|
|
|
end
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if needsXSpecial and not prepare("x_special") then
|
2015-03-30 15:20:13 -07:00
|
|
|
return false
|
2014-07-12 18:47:39 -07:00
|
|
|
end
|
|
|
|
battle.automate(forced)
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
else
|
|
|
|
textbox.handle()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
-- 15: GIOVANNI
|
|
|
|
|
|
|
|
viridianRival = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
|
|
|
if not canProgress then
|
|
|
|
if riskGiovanni or nidoSpecial < 45 or pokemon.index(0, "speed") < 134 then
|
2014-07-12 18:47:39 -07:00
|
|
|
tempDir = "x_special"
|
|
|
|
else
|
|
|
|
print("Skip X Special strats!")
|
|
|
|
end
|
|
|
|
canProgress = true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if prepare("x_accuracy", tempDir) then
|
2014-07-12 18:47:39 -07:00
|
|
|
local forced
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.isOpponent("pidgeot") then
|
2014-07-12 18:47:39 -07:00
|
|
|
forced = "thunderbolt"
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif riskGiovanni then
|
|
|
|
if pokemon.isOpponent("rhyhorn") or opponentDamaged() then
|
2014-07-12 18:47:39 -07:00
|
|
|
forced = "ice_beam"
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif pokemon.isOpponent("gyarados") then
|
2014-07-12 18:47:39 -07:00
|
|
|
forced = "thunderbolt"
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif pokemon.isOpponent("growlithe", "alakazam") then
|
2014-07-12 18:47:39 -07:00
|
|
|
forced = "earthquake"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
battle.automate(forced)
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
else
|
|
|
|
textbox.handle()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
ether = function(data)
|
|
|
|
local main = memory.value("menu", "main")
|
|
|
|
data.item = tempDir
|
2015-03-30 15:29:00 -07:00
|
|
|
if tempDir and completedMenuFor(data) then
|
|
|
|
if closeMenuFor(data) then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
else
|
2015-03-30 15:29:00 -07:00
|
|
|
if not tempDir then
|
|
|
|
if data.max then
|
2014-07-12 18:47:39 -07:00
|
|
|
-- TODO don't skip center if not in redbar
|
|
|
|
maxEtherSkip = nidoAttack > 53 and battle.pp("earthquake") > 0 and battle.pp("horn_drill") > 3
|
2015-03-30 15:29:00 -07:00
|
|
|
if maxEtherSkip then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
bridge.chat("Grabbing the Max Ether to skip the Elite 4 Center")
|
|
|
|
end
|
|
|
|
tempDir = inventory.contains("ether", "max_ether")
|
2015-03-30 15:29:00 -07:00
|
|
|
if not tempDir then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
2015-03-30 14:46:37 -07:00
|
|
|
tries = inventory.count(tempDir) --TODO remove?
|
2014-07-12 18:47:39 -07:00
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if memory.value("menu", "main") == 144 and menu.getCol() == 5 then
|
|
|
|
if memory.value("battle", "menu") ~= 95 then
|
2014-07-12 18:47:39 -07:00
|
|
|
menu.select(pokemon.battleMove("horn_drill"), true)
|
|
|
|
else
|
|
|
|
input.cancel()
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif menu.pause() then
|
2014-07-12 18:47:39 -07:00
|
|
|
inventory.use(tempDir, "nidoking")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
pickMaxEther = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if not canProgress then
|
|
|
|
if maxEtherSkip then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if memory.value("player", "moving") == 0 then
|
|
|
|
if player.isFacing("Right") then
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = true
|
|
|
|
end
|
|
|
|
tries = not tries
|
2015-03-30 15:29:00 -07:00
|
|
|
if tries then
|
2014-07-12 18:47:39 -07:00
|
|
|
input.press("Right", 1)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return false
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if inventory.contains("max_ether") then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
player.interact("Right")
|
|
|
|
end,
|
|
|
|
|
|
|
|
push = function(data)
|
|
|
|
local pos
|
2015-03-30 15:29:00 -07:00
|
|
|
if data.dir == "Up" or data.dir == "Down" then
|
2014-07-12 18:47:39 -07:00
|
|
|
pos = data.y
|
|
|
|
else
|
|
|
|
pos = data.x
|
|
|
|
end
|
|
|
|
local newP = memory.raw(pos)
|
2015-03-30 15:29:00 -07:00
|
|
|
if tries == 0 then
|
2014-07-12 18:47:39 -07:00
|
|
|
tries = {start=newP}
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif tries.start ~= newP then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
input.press(data.dir, 0)
|
|
|
|
end,
|
|
|
|
|
|
|
|
healBeforeLorelei = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if initialize() then
|
2014-07-12 18:47:39 -07:00
|
|
|
local canPotion
|
2015-03-30 15:29:00 -07:00
|
|
|
if inventory.contains("potion") and hasHealthFor("LoreleiDewgong", 20) then
|
2014-07-12 18:47:39 -07:00
|
|
|
canPotion = true
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif inventory.contains("super_potion") and hasHealthFor("LoreleiDewgong", 50) then
|
2014-07-12 18:47:39 -07:00
|
|
|
canPotion = true
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if not canPotion then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
bridge.chat("Healing before Lorelei to skip the Elite 4 Center...")
|
|
|
|
end
|
|
|
|
return strategyFunctions.potion({hp=combat.healthFor("LoreleiDewgong")})
|
|
|
|
end,
|
|
|
|
|
|
|
|
depositPokemon = function()
|
|
|
|
local toSize
|
2015-03-30 15:29:00 -07:00
|
|
|
if hasHealthFor("LoreleiDewgong") then
|
2014-07-12 18:47:39 -07:00
|
|
|
toSize = 1
|
|
|
|
else
|
|
|
|
toSize = 2
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if memory.value("player", "party_size") == toSize then
|
|
|
|
if menu.close() then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
else
|
2015-03-30 15:29:00 -07:00
|
|
|
if not textbox.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
player.interact("Up")
|
|
|
|
else
|
|
|
|
local pc = memory.value("menu", "size")
|
2015-03-30 15:29:00 -07:00
|
|
|
if memory.value("battle", "menu") ~= 95 and (pc == 2 or pc == 4) then
|
|
|
|
if menu.getCol() == 10 then
|
2014-07-12 18:47:39 -07:00
|
|
|
input.press("A")
|
|
|
|
else
|
|
|
|
menu.select(1)
|
|
|
|
end
|
|
|
|
else
|
|
|
|
input.press("A")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
centerSkip = function()
|
|
|
|
setYolo("e4center")
|
|
|
|
local message = "Skipping the Center and attempting to redbar "
|
2015-03-30 15:29:00 -07:00
|
|
|
if hasHealthFor("LoreleiDewgong") then
|
2014-07-12 18:47:39 -07:00
|
|
|
message = message.."off Lorelei..."
|
|
|
|
else
|
|
|
|
message = message.."the Elite 4!"
|
|
|
|
end
|
|
|
|
bridge.chat(message)
|
|
|
|
return true
|
|
|
|
end,
|
|
|
|
|
|
|
|
lorelei = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = true
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.redeployNidoking() then
|
2014-07-12 18:47:39 -07:00
|
|
|
return false
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.isOpponent("dewgong") then
|
|
|
|
if battle.sacrifice("pidgey", "spearow", "squirtle", "paras", "oddish") then
|
2014-07-12 18:47:39 -07:00
|
|
|
return false
|
|
|
|
end
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if prepare("x_accuracy") then
|
2014-07-12 18:47:39 -07:00
|
|
|
battle.automate()
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
else
|
|
|
|
textbox.handle()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
-- 16: LORELEI
|
|
|
|
|
|
|
|
bruno = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = true
|
|
|
|
local forced
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.isOpponent("onix") then
|
2014-07-12 18:47:39 -07:00
|
|
|
forced = "ice_beam"
|
|
|
|
-- local curr_hp, red_hp = pokemon.info("nidoking", "hp"), redHP()
|
2015-03-30 15:29:00 -07:00
|
|
|
-- if curr_hp > red_hp then
|
2014-07-12 18:47:39 -07:00
|
|
|
-- local enemyMove, enemyTurns = combat.enemyAttack()
|
2015-03-30 15:29:00 -07:00
|
|
|
-- if enemyTurns and enemyTurns > 1 then
|
2014-07-12 18:47:39 -07:00
|
|
|
-- local rockDmg = enemyMove.damage
|
2015-03-30 15:29:00 -07:00
|
|
|
-- if curr_hp - rockDmg <= red_hp then
|
2014-07-12 18:47:39 -07:00
|
|
|
-- forced = "thunderbolt"
|
|
|
|
-- end
|
|
|
|
-- end
|
|
|
|
-- end
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if prepare("x_accuracy") then
|
2014-07-12 18:47:39 -07:00
|
|
|
battle.automate(forced)
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
else
|
|
|
|
textbox.handle()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
2015-03-28 12:47:01 -07:00
|
|
|
agatha = function() --TODO test without x acc
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
2014-07-12 18:47:39 -07:00
|
|
|
canProgress = true
|
2015-03-30 15:29:00 -07:00
|
|
|
if combat.isSleeping() then
|
2014-07-12 18:47:39 -07:00
|
|
|
inventory.use("pokeflute", nil, true)
|
|
|
|
return false
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.isOpponent("gengar") then
|
2014-07-12 18:47:39 -07:00
|
|
|
local currentHP = pokemon.info("nidoking", "hp")
|
2015-03-30 15:29:00 -07:00
|
|
|
-- if not yolo and currentHP <= 56 and not isPrepared("x_speed") then
|
|
|
|
if not yolo and currentHP <= 56 and not isPrepared("x_accuracy", "x_speed") then
|
2014-07-12 18:47:39 -07:00
|
|
|
local toPotion = inventory.contains("full_restore", "super_potion")
|
2015-03-30 15:29:00 -07:00
|
|
|
if toPotion then
|
2014-07-12 18:47:39 -07:00
|
|
|
inventory.use(toPotion, nil, true)
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
-- if not prepare("x_speed") then
|
|
|
|
if not prepare("x_accuracy", "x_speed") then
|
2014-07-12 18:47:39 -07:00
|
|
|
return false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
battle.automate()
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
else
|
|
|
|
textbox.handle()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
prepareForLance = function()
|
|
|
|
local enableFull
|
2015-03-30 15:29:00 -07:00
|
|
|
if hasHealthFor("LanceGyarados", 100) then
|
2014-07-12 18:47:39 -07:00
|
|
|
enableFull = inventory.count("super_potion") < 2
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif hasHealthFor("LanceGyarados", 50) then
|
2014-07-12 18:47:39 -07:00
|
|
|
enableFull = not inventory.contains("super_potion")
|
|
|
|
else
|
|
|
|
enableFull = true
|
|
|
|
end
|
|
|
|
local min_recovery = combat.healthFor("LanceGyarados")
|
|
|
|
return strategyFunctions.potion({hp=min_recovery, full=enableFull, chain=true})
|
|
|
|
end,
|
|
|
|
|
|
|
|
lance = function()
|
2015-03-28 21:28:58 -07:00
|
|
|
local xItem
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.isOpponent("dragonair") then
|
2015-03-28 21:28:58 -07:00
|
|
|
xItem = "x_speed"
|
|
|
|
else
|
|
|
|
xItem = "x_special"
|
2014-07-12 18:47:39 -07:00
|
|
|
end
|
2015-03-28 21:28:58 -07:00
|
|
|
return prepare(xItem)
|
2014-07-12 18:47:39 -07:00
|
|
|
end,
|
|
|
|
|
|
|
|
prepareForBlue = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if initialize() then
|
2014-07-12 18:47:39 -07:00
|
|
|
setYolo("blue")
|
|
|
|
end
|
2015-03-30 14:46:37 -07:00
|
|
|
local skyDmg = combat.healthFor("BlueSky") * 0.9
|
2014-07-12 18:47:39 -07:00
|
|
|
local wingDmg = combat.healthFor("BluePidgeot")
|
|
|
|
return strategyFunctions.potion({hp=skyDmg-50, yolo=wingDmg, full=true})
|
|
|
|
end,
|
|
|
|
|
|
|
|
blue = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if battle.isActive() then
|
|
|
|
if not canProgress then
|
2015-03-30 15:20:13 -07:00
|
|
|
canProgress = true
|
2015-03-30 15:29:00 -07:00
|
|
|
if nidoSpecial >= 45 and pokemon.index(0, "speed") >= 52 and inventory.contains("x_special") then
|
2014-07-12 18:47:39 -07:00
|
|
|
tempDir = "x_special"
|
|
|
|
else
|
|
|
|
tempDir = "x_speed"
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if not STREAMING_MODE then
|
2015-03-30 15:20:13 -07:00
|
|
|
tempDir = "x_speed"
|
|
|
|
end
|
2014-07-12 18:47:39 -07:00
|
|
|
end
|
2015-03-30 15:20:13 -07:00
|
|
|
|
|
|
|
local boostFirst = pokemon.index(0, "hp") < 55
|
|
|
|
local firstItem, secondItem
|
2015-03-30 15:29:00 -07:00
|
|
|
if boostFirst then
|
2015-03-30 15:20:13 -07:00
|
|
|
firstItem = tempDir
|
|
|
|
secondItem = "x_accuracy"
|
|
|
|
else
|
|
|
|
firstItem = "x_accuracy"
|
|
|
|
secondItem = tempDir
|
|
|
|
end
|
|
|
|
|
|
|
|
local forced = "horn_drill"
|
|
|
|
|
2015-03-30 15:29:00 -07:00
|
|
|
if memory.value("battle", "turns") > 0 then
|
2015-03-30 15:20:13 -07:00
|
|
|
local skyDamage = combat.healthFor("BlueSky")
|
|
|
|
local healCutoff = skyDamage * 0.825
|
2015-03-30 15:29:00 -07:00
|
|
|
if initialize() then
|
|
|
|
if not isPrepared("x_accuracy", tempDir) then
|
2015-03-30 15:20:13 -07:00
|
|
|
local msg = "Uh oh... First-turn Sky Attack could end the run here, "
|
2015-03-30 15:29:00 -07:00
|
|
|
if pokemon.index(0, "hp") > skyDamage then
|
2015-03-30 15:20:13 -07:00
|
|
|
msg = msg.."no criticals pls D:"
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canHealFor(healCutoff) then
|
2015-03-30 15:20:13 -07:00
|
|
|
msg = msg.."attempting to heal for it"
|
2015-03-30 15:29:00 -07:00
|
|
|
if not canHealFor(skyDamage) then
|
2015-03-30 15:20:13 -07:00
|
|
|
msg = msg.." (damage range)"
|
|
|
|
end
|
|
|
|
msg = msg.."."
|
|
|
|
else
|
|
|
|
msg = msg.."and nothing left to heal with BibleThump"
|
|
|
|
end
|
|
|
|
bridge.chat(msg)
|
2014-07-12 18:47:39 -07:00
|
|
|
end
|
2015-03-30 15:20:13 -07:00
|
|
|
end
|
|
|
|
|
2015-03-30 15:29:00 -07:00
|
|
|
if prepare(firstItem) then
|
|
|
|
if not isPrepared(secondItem) then
|
2015-03-30 15:20:13 -07:00
|
|
|
local toPotion = canHealFor(healCutoff)
|
2015-03-30 15:29:00 -07:00
|
|
|
if toPotion then
|
2015-03-30 15:20:13 -07:00
|
|
|
inventory.use(toPotion, nil, true)
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if prepare("x_accuracy", tempDir) then
|
2015-03-30 15:20:13 -07:00
|
|
|
battle.automate(forced)
|
2014-07-12 18:47:39 -07:00
|
|
|
end
|
|
|
|
end
|
2015-03-30 15:20:13 -07:00
|
|
|
else
|
2015-03-30 15:29:00 -07:00
|
|
|
if prepare(firstItem, secondItem) then
|
|
|
|
if pokemon.isOpponent("alakazam") then
|
|
|
|
if tempDir == "x_speed" then
|
2015-03-30 15:20:13 -07:00
|
|
|
forced = "earthquake"
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif pokemon.isOpponent("rhydon") then
|
|
|
|
if tempDir == "x_special" then
|
2015-03-30 15:20:13 -07:00
|
|
|
forced = "ice_beam"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
battle.automate(forced)
|
|
|
|
end
|
2014-07-12 18:47:39 -07:00
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif canProgress then
|
2014-07-12 18:47:39 -07:00
|
|
|
return true
|
|
|
|
else
|
|
|
|
textbox.handle()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
champion = function()
|
2015-03-30 15:29:00 -07:00
|
|
|
if canProgress then
|
|
|
|
if tries > 1500 then
|
2014-07-12 18:47:39 -07:00
|
|
|
return hardReset("Beat the game in "..canProgress.." !")
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if tries == 0 then
|
2014-07-12 18:47:39 -07:00
|
|
|
bridge.tweet("Beat Pokemon Red in "..canProgress.."!")
|
2015-01-19 17:11:52 -08:00
|
|
|
-- strategyFunctions.reportFrames()
|
2015-03-30 15:29:00 -07:00
|
|
|
if strategies.seed then
|
2014-07-12 18:47:39 -07:00
|
|
|
print(memory.value("game", "frames").." frames, with seed "..strategies.seed)
|
|
|
|
print("Please save this seed number to share, if you would like proof of your run!")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
tries = tries + 1
|
2015-03-30 15:29:00 -07:00
|
|
|
elseif memory.value("menu", "shop_current") == 252 then
|
2014-07-12 18:47:39 -07:00
|
|
|
strategyFunctions.split({finished=true})
|
2015-03-30 14:46:37 -07:00
|
|
|
canProgress = utils.elapsedTime()
|
2014-07-12 18:47:39 -07:00
|
|
|
else
|
|
|
|
input.cancel()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
function strategies.execute(data)
|
2015-03-30 15:29:00 -07:00
|
|
|
if strategyFunctions[data.s](data) then
|
2014-07-12 18:47:39 -07:00
|
|
|
tries = 0
|
|
|
|
canProgress = false
|
|
|
|
initialized = false
|
|
|
|
tempDir = nil
|
2015-03-30 15:29:00 -07:00
|
|
|
if resetting then
|
2014-07-12 18:47:39 -07:00
|
|
|
return nil
|
|
|
|
end
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
|
|
|
function strategies.init(midGame)
|
2015-03-30 15:29:00 -07:00
|
|
|
if not STREAMING_MODE then
|
2015-01-19 17:11:52 -08:00
|
|
|
-- setYolo(0)
|
|
|
|
nidoAttack = 55
|
|
|
|
nidoSpeed = 50
|
|
|
|
nidoSpecial = 45
|
|
|
|
riskGiovanni = true
|
2015-03-30 14:46:37 -07:00
|
|
|
splitTime = utils.timeSince(0)
|
2015-01-19 17:11:52 -08:00
|
|
|
print(nidoAttack.." x "..nidoSpeed.." "..nidoSpecial)
|
|
|
|
end
|
2015-03-30 15:29:00 -07:00
|
|
|
if midGame then
|
2014-07-12 18:47:39 -07:00
|
|
|
combat.factorPP(true)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function strategies.softReset()
|
|
|
|
canProgress = false
|
|
|
|
initialized = false
|
|
|
|
maxEtherSkip = false
|
|
|
|
tempDir = nil
|
|
|
|
strategies.moonEncounters = nil
|
|
|
|
tries = 0
|
2015-03-30 14:46:37 -07:00
|
|
|
splitNumber, splitTime = 0, 0
|
2014-07-12 18:47:39 -07:00
|
|
|
deepRun = false
|
|
|
|
resetting = nil
|
|
|
|
yolo = false
|
|
|
|
end
|
|
|
|
|
|
|
|
return strategies
|