PokeBot/ai/red/strategies.lua

2152 lines
52 KiB
Lua
Raw Normal View History

2015-04-06 01:18:46 -07:00
local Strategies = require "ai.strategies"
2015-04-06 00:50:00 -07:00
2015-04-06 01:18:46 -07:00
local Combat = require "ai.combat"
local Control = require "ai.control"
2015-04-06 00:50:00 -07:00
2015-04-06 01:18:46 -07:00
local Battle = require "action.battle"
local Shop = require "action.shop"
local Textbox = require "action.textbox"
local Walk = require "action.walk"
2015-04-06 00:50:00 -07:00
2015-04-06 01:18:46 -07:00
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"
2015-04-06 00:50:00 -07:00
2015-04-06 01:18:46 -07:00
local Inventory = require "storage.inventory"
local Pokemon = require "storage.pokemon"
2015-04-06 00:50:00 -07:00
local riskGiovanni, maxEtherSkip
2015-04-06 01:18:46 -07:00
local status = Strategies.status
local stats = Strategies.stats
2015-04-06 00:50:00 -07:00
2015-04-06 02:19:25 -07:00
-- TIME CONSTRAINTS
local function timeForStats()
local timeBonus = (stats.nidoran.attack - 53) * 0.05
if stats.nidoran.attack >= 55 then
timeBonus = timeBonus + 0.05
end
local maxSpeed = math.min(stats.nidoran.speed, 52)
timeBonus = timeBonus + (maxSpeed - 49) * 0.125
if stats.nidoran.special >= 45 then
timeBonus = timeBonus + 0.1
end
return timeBonus
end
2015-04-06 01:18:46 -07:00
Strategies.timeRequirements = {
2015-04-06 00:50:00 -07:00
bulbasaur = function()
return 2.25
end,
nidoran = function()
local timeLimit = 6.4
2015-04-06 01:18:46 -07:00
if Pokemon.inParty("spearow") then
2015-04-06 00:50:00 -07:00
timeLimit = timeLimit + 0.67
end
return timeLimit
end,
shorts = function()
local timeLimit = 14
timeLimit = timeLimit + (3 - stats.nidoran.rating) * 0.2
if Pokemon.inParty("spearow") then
timeLimit = timeLimit + 0.5
end
return timeLimit
end,
2015-04-06 00:50:00 -07:00
mt_moon = function()
local timeLimit = 26.75
if stats.nidoran.attack > 15 and stats.nidoran.speed > 14 then
timeLimit = timeLimit + 0.33
2015-04-06 00:50:00 -07:00
end
2015-04-06 01:18:46 -07:00
if Pokemon.inParty("paras") then
2015-04-06 00:50:00 -07:00
timeLimit = timeLimit + 0.75
end
return timeLimit
end,
mankey = function()
local timeLimit = 32.5
2015-04-06 01:18:46 -07:00
if Pokemon.inParty("paras") then
2015-04-06 00:50:00 -07:00
timeLimit = timeLimit + 0.75
end
return timeLimit
end,
goldeen = function()
local timeLimit = 37 + timeForStats()
2015-04-06 01:18:46 -07:00
if Pokemon.inParty("paras") then
2015-04-06 00:50:00 -07:00
timeLimit = timeLimit + 0.75
end
return timeLimit
end,
misty = function()
local timeLimit = 39 + timeForStats()
2015-04-06 01:18:46 -07:00
if Pokemon.inParty("paras") then
2015-04-06 00:50:00 -07:00
timeLimit = timeLimit + 0.75
end
return timeLimit
end,
vermilion = function()
return 43.5 + timeForStats()
2015-04-06 00:50:00 -07:00
end,
trash = function()
return 47 + timeForStats()
2015-04-06 00:50:00 -07:00
end,
safari_carbos = function()
return 70 + timeForStats()
2015-04-06 00:50:00 -07:00
end,
victory_road = function()
return 98.75 -- PB
end,
e4center = function()
return 102
end,
blue = function()
return 108.5
end,
}
-- HELPERS
2015-04-10 16:45:15 -07:00
local function nidoranDSum(enabled)
2015-04-06 01:18:46 -07:00
local sx, sy = Player.position()
2015-04-10 16:45:15 -07:00
if enabled and status.path == nil then
2015-04-06 01:18:46 -07:00
local opponentName = Battle.opponent()
2015-04-10 16:45:15 -07:00
local opponentLevel = Memory.value("battle", "opponent_level")
2015-04-06 00:50:00 -07:00
if opponentName == "rattata" then
2015-04-10 16:45:15 -07:00
if opponentLevel == 2 then
status.path = {0, 4, 12}
elseif opponentLevel == 3 then
status.path = {0, 14, 11}
2015-04-06 00:50:00 -07:00
else
2015-04-10 16:45:15 -07:00
status.path = {0, 0, 10}
2015-04-06 00:50:00 -07:00
end
elseif opponentName == "spearow" then
2015-04-10 16:45:15 -07:00
if opponentLevel == 5 then --TODO
else
2015-04-06 00:50:00 -07:00
end
elseif opponentName == "nidoran" then
2015-04-10 16:45:15 -07:00
status.path = {0, 6, 12}
2015-04-06 00:50:00 -07:00
elseif opponentName == "nidoranf" then
2015-04-10 16:45:15 -07:00
if opponentLevel == 3 then
status.path = {4, 6, 12}
2015-04-06 00:50:00 -07:00
else
2015-04-10 16:45:15 -07:00
status.path = {5, 6, 12}
2015-04-06 00:50:00 -07:00
end
end
2015-04-10 16:45:15 -07:00
if status.path then
status.pathIndex = 1
status.pathX, status.pathY = sx, sy
2015-04-06 00:50:00 -07:00
else
2015-04-10 16:45:15 -07:00
status.path = 0
2015-04-06 00:50:00 -07:00
end
end
2015-04-10 16:45:15 -07:00
if enabled and status.path ~= 0 then
if status.path[status.pathIndex] == 0 then
status.pathIndex = status.pathIndex + 1
if status.pathIndex > 3 then
status.path = 0
2015-04-06 00:50:00 -07:00
end
return nidoranDSum()
end
2015-04-10 16:45:15 -07:00
if status.pathX ~= sx or status.pathY ~= sy then
status.path[status.pathIndex] = status.path[status.pathIndex] - 1
status.pathX, status.pathY = sx, sy
2015-04-06 00:50:00 -07:00
end
2015-04-10 16:45:15 -07:00
if status.pathIndex == 2 then
2015-04-06 00:50:00 -07:00
sy = 11
else
sy = 12
end
else
sy = 11
end
if sx == 33 then
sx = 32
else
sx = 33
end
2015-04-06 01:18:46 -07:00
Walk.step(sx, sy)
2015-04-06 00:50:00 -07:00
end
local function willRedBar(forDamage)
local curr_hp, red_hp = Combat.hp(), Combat.redHP()
return curr_hp > forDamage*0.975 and curr_hp - forDamage*0.925 < red_hp
end
local function potionForRedBar(damage)
local curr_hp, red_hp = Combat.hp(), Combat.redHP()
local max_hp = Pokemon.index(0, "max_hp")
local potions = {
{"potion", 20},
{"super_potion", 50},
}
for i,potion in ipairs(potions) do
if Inventory.contains(potion[1]) then
local healTo = math.min(curr_hp + potion[2], max_hp)
if healTo > damage and healTo - damage < red_hp then
return potion
end
end
end
return canPotion
end
-- STATE
local function canRiskGiovanni()
return stats.nidoran.attackDV >= 11 and stats.nidoran.specialDV >= 4
end
local function requiresE4Center()
local hornDrillPP = Battle.pp("horn_drill")
if hornDrillPP >= 5 then
return false
end
if hornDrillPP == 4 then
return stats.nidoran.attackDV < 11 or Battle.pp("earthquake") == 0
end
return true
end
2015-04-06 00:50:00 -07:00
-- STRATEGIES
2015-04-06 01:18:46 -07:00
local strategyFunctions = Strategies.functions
2015-04-06 00:50:00 -07:00
-- General
strategyFunctions.tweetAfterBrock = function()
if stats.nidoran.rating < 2 then
if not Strategies.overMinute("shorts") then
Strategies.tweetProgress("On pace after Brock with a great Nidoran", "brock")
end
end
return true
end
2015-04-06 00:50:00 -07:00
strategyFunctions.tweetMisty = function()
if not Strategies.updates.brock and not Strategies.setYolo("misty") then
2015-04-06 01:18:46 -07:00
local timeLimit = Strategies.getTimeRequirement("misty")
if not Strategies.overMinute(timeLimit - 0.25) then
2015-04-06 00:50:00 -07:00
local pbn = ""
2015-04-06 01:18:46 -07:00
if not Strategies.overMinute(timeLimit - 1) then
2015-04-06 00:50:00 -07:00
pbn = " (PB pace)"
end
2015-04-06 01:18:46 -07:00
local elt = Utils.elapsedTime()
Strategies.tweetProgress("Got a run going, just beat Misty "..elt.." in"..pbn, "misty")
end
end
return true
end
strategyFunctions.tweetSurge = function()
if not Strategies.updates.misty and not Control.yolo then
local elt = Utils.elapsedTime()
local pbn = ""
2015-04-09 20:45:37 -07:00
local pbPace = Strategies.getTimeRequirement("trash") + 1
if not Strategies.overMinute(pbPace) then
pbn = " (PB pace)"
2015-04-06 00:50:00 -07:00
end
Strategies.tweetProgress("Got a run going, just beat Surge "..elt.." in"..pbn, "surge")
2015-04-06 00:50:00 -07:00
end
return true
end
strategyFunctions.tweetVictoryRoad = function()
2015-04-06 01:18:46 -07:00
local elt = Utils.elapsedTime()
2015-04-06 00:50:00 -07:00
local pbn = ""
if not Strategies.overMinute("victory_road") then
2015-04-06 00:50:00 -07:00
pbn = " (PB pace)"
end
2015-04-06 01:18:46 -07:00
local elt = Utils.elapsedTime()
Strategies.tweetProgress("Entering Victory Road at "..elt..pbn.." on our way to the Elite Four", "victory")
2015-04-06 00:50:00 -07:00
return true
end
strategyFunctions.bicycle = function()
if Memory.value("player", "bicycle") == 1 then
if Textbox.handle() then
return true
end
else
return Strategies.useItem({item="bicycle"})
end
end
2015-04-06 00:50:00 -07:00
-- Route
strategyFunctions.squirtleIChooseYou = function()
2015-04-06 01:18:46 -07:00
if Pokemon.inParty("squirtle") then
Bridge.caught("squirtle")
2015-04-06 00:50:00 -07:00
return true
end
2015-04-06 01:18:46 -07:00
if Player.face("Up") then
Textbox.name("A")
2015-04-06 00:50:00 -07:00
end
end
strategyFunctions.fightBulbasaur = function()
2015-04-06 01:18:46 -07:00
if status.tries < 9000 and Pokemon.index(0, "level") == 6 then
2015-04-06 00:50:00 -07:00
if status.tries > 200 then
stats.squirtle = {
attack = Pokemon.index(0, "attack"),
defense = Pokemon.index(0, "defense"),
speed = Pokemon.index(0, "speed"),
special = Pokemon.index(0, "special"),
}
if stats.squirtle.attack < 11 and stats.squirtle.special < 12 then
return Strategies.reset("Bad Squirtle - "..stats.squirtle.attack.." attack, "..stats.squirtle.special.." special")
2015-04-06 00:50:00 -07:00
end
status.tries = 9001
else
status.tries = status.tries + 1
end
end
2015-04-11 13:05:47 -07:00
if Battle.isActive() and Memory.double("battle", "opponent_hp") > 0 and Strategies.resetTime("bulbasaur", "beat Bulbasaur") then
2015-04-06 00:50:00 -07:00
return true
end
2015-04-06 01:18:46 -07:00
return Strategies.buffTo("tail_whip", 6)
2015-04-06 00:50:00 -07:00
end
-- dodgePalletBoy
strategyFunctions.shopViridianPokeballs = function()
2015-04-06 01:18:46 -07:00
return Shop.transaction{
2015-04-06 00:50:00 -07:00
buy = {{name="pokeball", index=0, amount=8}}
}
end
strategyFunctions.catchNidoran = function()
2015-04-10 16:45:15 -07:00
if Strategies.initialize() then
status.path = 0
end
2015-04-06 01:18:46 -07:00
if not Control.canCatch() then
2015-04-06 00:50:00 -07:00
return true
end
2015-04-06 01:18:46 -07:00
local pokeballs = Inventory.count("pokeball")
local caught = Memory.value("player", "party_size") - 1
2015-04-06 00:50:00 -07:00
if pokeballs < 5 - caught * 2 then
2015-04-06 01:18:46 -07:00
return Strategies.reset("Ran too low on PokeBalls", pokeballs)
2015-04-06 00:50:00 -07:00
end
2015-04-06 01:18:46 -07:00
if Battle.isActive() then
local isNidoran = Pokemon.isOpponent("nidoran")
if isNidoran and Memory.value("battle", "opponent_level") > 2 then
if not status.polled then
status.polled = true
2015-04-06 01:18:46 -07:00
Bridge.pollForName()
2015-04-06 00:50:00 -07:00
end
end
2015-04-10 16:45:15 -07:00
status.path = nil
2015-04-06 01:18:46 -07:00
if Memory.value("menu", "text_input") == 240 then
Textbox.name()
elseif Menu.hasTextbox() then
2015-04-06 00:50:00 -07:00
if isNidoran then
2015-04-06 01:18:46 -07:00
Input.press("A")
2015-04-06 00:50:00 -07:00
else
2015-04-06 01:18:46 -07:00
Input.cancel()
2015-04-06 00:50:00 -07:00
end
else
Battle.handle()
2015-04-06 00:50:00 -07:00
end
else
2015-04-10 16:45:15 -07:00
local enableDSum = true
2015-04-06 01:18:46 -07:00
Pokemon.updateParty()
local hasNidoran = Pokemon.inParty("nidoran")
2015-04-06 00:50:00 -07:00
if hasNidoran then
local gotExperience = Pokemon.getExp() > 205
if not status.canProgress then
2015-04-06 01:18:46 -07:00
Bridge.caught("nidoran")
status.canProgress = true
if not gotExperience then
Bridge.chat("is waiting in the grass for a suitable encounter for experience", Pokemon.getExp())
end
2015-04-06 00:50:00 -07:00
end
if gotExperience then
2015-04-09 20:45:37 -07:00
stats.nidoran = {level4=(Pokemon.info("nidoran", "level") == 4)}
2015-04-06 00:50:00 -07:00
return true
end
2015-04-10 16:45:15 -07:00
enableDSum = false
2015-04-06 00:50:00 -07:00
end
local resetMessage
if hasNidoran then
2015-04-11 13:05:47 -07:00
resetMessage = "get an encounter for experience before Brock"
2015-04-06 00:50:00 -07:00
else
resetMessage = "find a suitable Nidoran"
end
2015-04-10 16:45:15 -07:00
local resetLimit = Strategies.getTimeRequirement("nidoran")
if Strategies.resetTime(resetLimit, resetMessage) then
2015-04-06 00:50:00 -07:00
return true
end
2015-04-10 16:45:15 -07:00
if enableDSum then
enableDSum = Control.escaped and not Strategies.overMinute(resetLimit - 0.25)
2015-04-06 00:50:00 -07:00
end
2015-04-10 16:45:15 -07:00
nidoranDSum(enableDSum)
2015-04-06 00:50:00 -07:00
end
end
-- 1: NIDORAN
strategyFunctions.dodgeViridianOldMan = function()
2015-04-06 01:18:46 -07:00
return Strategies.dodgeUp(0x0273, 18, 6, 17, 9)
2015-04-06 00:50:00 -07:00
end
strategyFunctions.grabTreePotion = function()
2015-04-06 01:18:46 -07:00
if Strategies.initialize() then
if Pokemon.info("squirtle", "hp") > 16 then
2015-04-06 00:50:00 -07:00
return true
end
end
2015-04-06 01:18:46 -07:00
if Inventory.contains("potion") then
2015-04-06 00:50:00 -07:00
return true
end
2015-04-06 01:18:46 -07:00
local px, py = Player.position()
2015-04-06 00:50:00 -07:00
if px > 15 then
2015-04-06 01:18:46 -07:00
Walk.step(15, 4)
2015-04-06 00:50:00 -07:00
else
2015-04-06 01:18:46 -07:00
Player.interact("Left")
2015-04-06 00:50:00 -07:00
end
end
strategyFunctions.grabAntidote = function()
2015-04-06 01:18:46 -07:00
local px, py = Player.position()
2015-04-06 00:50:00 -07:00
if py < 11 then
return true
end
-- if Pokemon.info("spearow", "level") == 3 then
-- if px < 26 then
-- px = 26
-- else
-- py = 10
-- end
-- else
if Inventory.contains("antidote") then
2015-04-06 00:50:00 -07:00
py = 10
else
2015-04-06 01:18:46 -07:00
Player.interact("Up")
2015-04-06 00:50:00 -07:00
end
2015-04-06 01:18:46 -07:00
Walk.step(px, py)
2015-04-06 00:50:00 -07:00
end
strategyFunctions.grabForestPotion = function()
2015-04-06 01:18:46 -07:00
if Battle.handleWild() then
local potionCount = Inventory.count("potion")
if Strategies.initialize() then
2015-04-09 20:45:37 -07:00
status.startPotions = potionCount
2015-04-06 00:50:00 -07:00
end
if potionCount > 0 then
2015-04-09 20:45:37 -07:00
if status.startPotions and potionCount > status.startPotions then
status.startPotions = nil
2015-04-06 00:50:00 -07:00
end
if Pokemon.info("squirtle", "hp") <= 14 then
2015-04-06 01:18:46 -07:00
if Menu.pause() then
Inventory.use("potion", "squirtle")
2015-04-06 00:50:00 -07:00
end
elseif Menu.close() then
2015-04-06 00:50:00 -07:00
return true
end
2015-04-09 20:45:37 -07:00
elseif not status.startPotions then
if Menu.close() then
return true
end
2015-04-06 01:18:46 -07:00
elseif Menu.close() then
Player.interact("Up")
2015-04-06 00:50:00 -07:00
end
end
end
strategyFunctions.fightWeedle = function()
2015-04-06 01:18:46 -07:00
if Battle.isTrainer() then
status.canProgress = true
if Memory.value("battle", "our_status") > 0 and not Inventory.contains("antidote") then
2015-04-06 01:18:46 -07:00
return Strategies.reset("Poisoned, but we skipped the antidote")
2015-04-06 00:50:00 -07:00
end
return Strategies.buffTo("tail_whip", 5)
elseif status.canProgress then
2015-04-06 00:50:00 -07:00
return true
end
end
strategyFunctions.equipForBrock = function(data)
2015-04-06 01:18:46 -07:00
if Strategies.initialize() then
if Pokemon.info("squirtle", "level") < 8 then
return Strategies.reset("Did not reach level 8 before Brock", Pokemon.getExp(), true)
2015-04-06 00:50:00 -07:00
end
if data.anti then
2015-04-06 01:18:46 -07:00
local poisoned = Pokemon.info("squirtle", "status") > 0
2015-04-06 00:50:00 -07:00
if not poisoned then
return true
end
2015-04-06 01:18:46 -07:00
if not Inventory.contains("antidote") then
return Strategies.reset("Poisoned, but we risked skipping the antidote")
2015-04-06 00:50:00 -07:00
end
2015-04-06 01:18:46 -07:00
local curr_hp = Pokemon.info("squirtle", "hp")
if Inventory.contains("potion") and curr_hp > 8 and curr_hp < 18 then
2015-04-06 00:50:00 -07:00
return true
end
end
end
2015-04-07 04:58:18 -07:00
return strategyFunctions.swapNidoran()
2015-04-06 00:50:00 -07:00
end
strategyFunctions.fightBrock = function()
2015-04-06 01:18:46 -07:00
local squirtleHP = Pokemon.info("squirtle", "hp")
2015-04-06 00:50:00 -07:00
if squirtleHP == 0 then
2015-04-06 01:18:46 -07:00
return Strategies.death()
2015-04-06 00:50:00 -07:00
end
2015-04-06 01:18:46 -07:00
if Battle.isActive() then
2015-04-06 00:50:00 -07:00
if status.tries < 1 then
status.tries = 1
end
2015-04-06 01:18:46 -07:00
local bubble, turnsToKill, turnsToDie = Combat.bestMove()
if not Pokemon.isDeployed("squirtle") then
Battle.swap("squirtle")
elseif turnsToDie and turnsToDie < 2 and Inventory.contains("potion") then
Inventory.use("potion", "squirtle", true)
2015-04-06 00:50:00 -07:00
else
2015-04-06 01:18:46 -07:00
local bideTurns = Memory.value("battle", "opponent_bide")
if Menu.hasTextbox() and Menu.getCol() == 1 then
2015-04-06 01:18:46 -07:00
Input.press("A")
2015-04-06 00:50:00 -07:00
elseif bideTurns > 0 then
2015-04-06 01:18:46 -07:00
local onixHP = Memory.double("battle", "opponent_hp")
if not status.canProgress then
status.canProgress = onixHP
status.startBide = bideTurns
2015-04-06 00:50:00 -07:00
end
if turnsToKill then
local forced
if turnsToDie < 2 or turnsToKill < 2 or status.startBide - bideTurns > 1 then
-- elseif turnsToKill < 3 and status.startBide == bideTurns then
elseif onixHP == status.canProgress then
2015-04-06 00:50:00 -07:00
forced = "tail_whip"
end
2015-04-06 01:18:46 -07:00
Battle.fight(forced)
2015-04-06 00:50:00 -07:00
else
2015-04-06 01:18:46 -07:00
Input.cancel()
2015-04-06 00:50:00 -07:00
end
elseif Menu.onPokemonSelect() then
2015-04-06 01:18:46 -07:00
Menu.select(Pokemon.indexOf("nidoran"), true)
2015-04-06 00:50:00 -07:00
else
status.canProgress = false
2015-04-06 01:18:46 -07:00
Battle.fight()
2015-04-06 00:50:00 -07:00
end
if status.tries < 9000 then
2015-04-06 01:18:46 -07:00
local nidx = Pokemon.indexOf("nidoran")
if Pokemon.index(nidx, "level") == 8 then
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)
2015-04-06 00:50:00 -07:00
if status.tries > 300 then
stats.nidoran = {
attack = att,
defense = def,
speed = spd,
special = scl,
level4 = stats.nidoran.level4,
rating = 0,
}
p(Pokemon.getDVs("nidoran"))
2015-04-06 00:50:00 -07:00
local resets = att < 15 or spd < 14 or scl < 12 or (att == 15 and spd == 14)
local nStatus = "Att: "..att..", Def: "..def..", Speed: "..spd..", Special: "..scl
if resets then
2015-04-06 01:18:46 -07:00
return Strategies.reset("Bad Nidoran - "..nStatus)
2015-04-06 00:50:00 -07:00
end
status.tries = 9001
local statDiff = (16 - att) + (15 - spd) + (13 - scl)
2015-04-06 00:50:00 -07:00
if def < 12 then
statDiff = statDiff + 1
end
if not stats.nidoran.level4 then
statDiff = statDiff + 1
end
stats.nidoran.rating = statDiff
2015-04-06 00:50:00 -07:00
local superlative
local exclaim = "!"
if statDiff == 0 then
if def == 14 then
superlative = " god"
exclaim = "! Kreygasm"
else
superlative = " perfect"
end
elseif att == 16 and spd == 15 then
if statDiff == 1 then
superlative = " great"
elseif statDiff == 2 then
superlative = " good"
else
superlative = "n okay"
2015-04-06 00:50:00 -07:00
end
elseif statDiff == 1 then
superlative = " good"
elseif statDiff <= 3 then
superlative = "n okay"
exclaim = "."
else
superlative = " min stat"
exclaim = "."
end
Bridge.chat("beat Brock with a"..superlative.." Nidoran"..exclaim.." "..nStatus..", caught at level "..(stats.nidoran.level4 and "4" or "3")..".")
2015-04-06 00:50:00 -07:00
else
status.tries = status.tries + 1
end
end
end
end
elseif status.tries > 0 then
return true
2015-04-06 01:18:46 -07:00
elseif Textbox.handle() then
Player.interact("Up")
2015-04-06 00:50:00 -07:00
end
end
-- 2: BROCK
strategyFunctions.shopPewterMart = function()
2015-04-06 01:18:46 -07:00
return Shop.transaction{
buy = {{name="potion", index=1, amount=10}}
2015-04-06 00:50:00 -07:00
}
end
strategyFunctions.battleModeSet = function()
2015-04-06 01:18:46 -07:00
if Memory.value("setting", "battle_style") == 10 then
if Menu.close() then
2015-04-06 00:50:00 -07:00
return true
end
2015-04-06 01:18:46 -07:00
elseif Menu.pause() then
local main = Memory.value("menu", "main")
2015-04-06 00:50:00 -07:00
if main == 128 then
2015-04-06 01:18:46 -07:00
if Menu.getCol() ~= 11 then
Input.press("B")
2015-04-06 00:50:00 -07:00
else
2015-04-06 01:18:46 -07:00
Menu.select(5, true)
2015-04-06 00:50:00 -07:00
end
elseif main == 228 then
2015-04-06 01:18:46 -07:00
Menu.setOption("battle_style", 8, 10)
2015-04-06 00:50:00 -07:00
else
2015-04-06 01:18:46 -07:00
Input.press("B")
2015-04-06 00:50:00 -07:00
end
end
end
strategyFunctions.bugCatcher = function()
2015-04-06 01:18:46 -07:00
if Battle.isActive() then
status.canProgress = true
2015-04-06 01:18:46 -07:00
local isWeedle = Pokemon.isOpponent("weedle")
if isWeedle and not status.secondCaterpie then
status.secondCaterpie = true
2015-04-06 00:50:00 -07:00
end
if not isWeedle and status.secondCaterpie then
if stats.nidoran.level4 and stats.nidoran.speed >= 14 and Pokemon.index(0, "attack") >= 19 then
2015-04-06 01:18:46 -07:00
-- print("IA "..Pokemon.index(0, "attack"))
Battle.automate()
2015-04-06 00:50:00 -07:00
return
end
end
2015-04-06 01:18:46 -07:00
Strategies.functions.leer({{"caterpie",8}, {"weedle",7}})
elseif status.canProgress then
2015-04-06 00:50:00 -07:00
return true
else
2015-04-06 01:18:46 -07:00
Battle.automate()
2015-04-06 00:50:00 -07:00
end
end
strategyFunctions.shortsKid = function()
2015-04-06 01:18:46 -07:00
local fightingEkans = Pokemon.isOpponent("ekans")
2015-04-06 00:50:00 -07:00
if fightingEkans then
2015-04-10 01:38:35 -07:00
local wrapping = Memory.value("battle", "attack_turns") > 0
2015-04-06 00:50:00 -07:00
if wrapping then
2015-04-06 01:18:46 -07:00
local curr_hp = Memory.double("battle", "our_hp")
if not status.wrappedAt then
status.wrappedAt = curr_hp
2015-04-06 00:50:00 -07:00
end
local wrapDamage = status.wrappedAt - curr_hp
2015-04-06 01:18:46 -07:00
if wrapDamage > 0 and wrapDamage < 7 and curr_hp < 14 and not Strategies.opponentDamaged() then
Inventory.use("potion", nil, true)
2015-04-06 00:50:00 -07:00
return false
end
else
status.wrappedAt = nil
2015-04-06 00:50:00 -07:00
end
end
2015-04-06 01:18:46 -07:00
Control.battlePotion(fightingEkans or Strategies.damaged(2))
return Strategies.functions.leer({{"rattata",9}, {"ekans",10}})
2015-04-06 00:50:00 -07:00
end
strategyFunctions.potionBeforeCocoons = function()
if stats.nidoran.speed >= 15 then
2015-04-06 00:50:00 -07:00
return true
end
2015-04-06 01:18:46 -07:00
return Strategies.functions.potion({hp=6, yolo=3})
2015-04-06 00:50:00 -07:00
end
2015-04-07 04:58:18 -07:00
-- swapHornAttack
2015-04-06 00:50:00 -07:00
strategyFunctions.fightMetapod = function()
2015-04-06 01:18:46 -07:00
if Battle.isActive() then
status.canProgress = true
2015-04-06 01:18:46 -07:00
if Memory.double("battle", "opponent_hp") > 0 and Pokemon.isOpponent("metapod") then
2015-04-06 00:50:00 -07:00
return true
end
2015-04-06 01:18:46 -07:00
Battle.automate()
elseif status.canProgress then
2015-04-06 00:50:00 -07:00
return true
else
2015-04-06 01:18:46 -07:00
Battle.automate()
2015-04-06 00:50:00 -07:00
end
end
2015-04-07 04:58:18 -07:00
-- catchFlierBackup
2015-04-06 00:50:00 -07:00
-- 3: ROUTE 3
2015-04-07 04:58:18 -07:00
-- startMtMoon
2015-04-06 00:50:00 -07:00
2015-04-07 04:58:18 -07:00
-- evolveNidorino
2015-04-06 00:50:00 -07:00
2015-04-07 04:58:18 -07:00
-- evolveNidoking
2015-04-06 00:50:00 -07:00
-- helix
2015-04-07 04:58:18 -07:00
-- reportMtMoon
2015-04-06 00:50:00 -07:00
-- 4: MT. MOON
-- dodgeCerulean
strategyFunctions.rivalSandAttack = function(data)
2015-04-06 01:18:46 -07:00
if Battle.isActive() then
if Battle.redeployNidoking() then
2015-04-06 00:50:00 -07:00
return false
end
2015-04-06 01:18:46 -07:00
local opponent = Battle.opponent()
if Memory.value("battle", "accuracy") < 7 then
2015-04-06 00:50:00 -07:00
local sacrifice
if opponent == "pidgeotto" then
2015-04-06 01:18:46 -07:00
local __, turns = Combat.bestMove()
2015-04-06 00:50:00 -07:00
if turns == 1 then
2015-04-06 01:18:46 -07:00
sacrifice = Pokemon.getSacrifice("pidgey", "spearow", "paras", "oddish", "squirtle")
2015-04-06 00:50:00 -07:00
end
elseif opponent == "raticate" then
2015-04-06 01:18:46 -07:00
sacrifice = Pokemon.getSacrifice("pidgey", "spearow", "oddish")
2015-04-06 00:50:00 -07:00
end
2015-04-06 01:18:46 -07:00
if Battle.sacrifice(sacrifice) then
2015-04-06 00:50:00 -07:00
return false
end
end
if opponent == "pidgeotto" then
2015-04-06 01:18:46 -07:00
Combat.disableThrash = true
2015-04-06 00:50:00 -07:00
elseif opponent == "raticate" then
Combat.disableThrash = Strategies.opponentDamaged() or (not Control.yolo and Combat.hp() < 32) -- RISK
elseif opponent == "kadabra" then
Combat.disableThrash = Combat.hp() < 11
2015-04-06 00:50:00 -07:00
elseif opponent == "ivysaur" then
2015-04-06 01:18:46 -07:00
if not Control.yolo and Strategies.damaged(5) and Inventory.contains("super_potion") then
Inventory.use("super_potion", nil, true)
2015-04-06 00:50:00 -07:00
return false
end
2015-04-06 01:18:46 -07:00
Combat.disableThrash = Strategies.opponentDamaged()
2015-04-06 00:50:00 -07:00
else
2015-04-06 01:18:46 -07:00
Combat.disableThrash = false
2015-04-06 00:50:00 -07:00
end
2015-04-06 01:18:46 -07:00
Battle.automate()
status.canProgress = true
elseif status.canProgress then
2015-04-06 01:18:46 -07:00
Combat.disableThrash = false
2015-04-06 00:50:00 -07:00
return true
else
2015-04-06 01:18:46 -07:00
Textbox.handle()
2015-04-06 00:50:00 -07:00
end
end
-- rareCandyEarly
2015-04-10 00:34:50 -07:00
-- teachThrash
2015-04-06 00:50:00 -07:00
strategyFunctions.potionForMankey = function()
2015-04-06 01:18:46 -07:00
if Strategies.initialize() then
if Pokemon.info("nidoking", "level") > 20 then
2015-04-06 00:50:00 -07:00
return true
end
end
2015-04-06 01:18:46 -07:00
return Strategies.functions.potion({hp=18, yolo=8})
2015-04-06 00:50:00 -07:00
end
strategyFunctions.redbarMankey = function()
2015-04-06 01:18:46 -07:00
if not Strategies.setYolo("mankey") then
2015-04-06 00:50:00 -07:00
return true
end
2015-04-08 01:51:38 -07:00
local curr_hp, red_hp = Combat.hp(), Combat.redHP()
2015-04-06 00:50:00 -07:00
if curr_hp <= red_hp then
return true
end
2015-04-06 01:18:46 -07:00
if Battle.isActive() then
status.canProgress = true
2015-04-06 01:18:46 -07:00
local enemyMove, enemyTurns = Combat.enemyAttack()
2015-04-06 00:50:00 -07:00
if enemyTurns then
if enemyTurns < 2 then
return true
end
local scratchDmg = enemyMove.damage
if curr_hp - scratchDmg >= red_hp then
return true
end
end
2015-04-06 01:18:46 -07:00
Battle.automate("poison_sting")
elseif status.canProgress then
2015-04-06 00:50:00 -07:00
return true
else
2015-04-06 01:18:46 -07:00
Textbox.handle()
2015-04-06 00:50:00 -07:00
end
if Strategies.initialize() then
2015-04-09 20:45:37 -07:00
if Pokemon.info("nidoking", "level") < 23 or Inventory.count("potion") < 4 then -- RISK
return true
end
Bridge.chat("is using Poison Sting to attempt to red-bar off Mankey")
end
2015-04-06 00:50:00 -07:00
end
strategyFunctions.thrashGeodude = function()
2015-04-06 01:18:46 -07:00
if Battle.isActive() then
status.canProgress = true
2015-04-06 01:18:46 -07:00
if Pokemon.isOpponent("geodude") and Pokemon.isDeployed("nidoking") then
2015-04-08 01:53:48 -07:00
if Strategies.initialize() then
status.sacrificeSquirtle = not Control.yolo or Combat.inRedBar()
if not status.sacrificeSquirtle then
Bridge.chat("is attempting to hit through confusion to avoid switching out to Squirtle")
2015-04-08 01:53:48 -07:00
end
end
if status.sacrificeSquirtle and Battle.sacrifice("squirtle") then
2015-04-06 00:50:00 -07:00
return false
end
end
2015-04-06 01:18:46 -07:00
Battle.automate()
elseif status.canProgress then
2015-04-06 00:50:00 -07:00
return true
else
2015-04-06 01:18:46 -07:00
Textbox.handle()
2015-04-06 00:50:00 -07:00
end
end
strategyFunctions.hikerElixer = function()
if Strategies.initialize() then
if not Inventory.contains("antidote") and Inventory.indexOf("tm34") ~= 1 then
return true
end
end
local px, py = Player.position()
if Inventory.contains("elixer") then
if py == 4 then
return true
end
py = 4
elseif py > 2 then
py = 2
else
Player.interact("Up")
return false
end
Walk.step(px, py)
end
strategyFunctions.lassEther = function()
if Strategies.initialize() then
if Inventory.contains("antidote") and Inventory.contains("elixer") then
return true
end
end
return strategyFunctions.interact({dir="Up"})
end
strategyFunctions.potionBeforeMisty = function(data)
2015-04-06 01:18:46 -07:00
if Strategies.initialize() then
if data.goldeen then
Strategies.setYolo("goldeen")
local curr_hp, red_hp = Combat.hp(), Combat.redHP()
2015-04-13 01:18:28 -07:00
if Control.yolo or (not Combat.inRedBar() and curr_hp < red_hp + 6) then
if curr_hp > 7 then
return true
end
end
2015-04-06 00:50:00 -07:00
end
end
local healAmount = data.goldeen and 65 or 70
local canTwoHit = stats.nidoran.attackDV >= (Control.yolo and 6 or 8)
local canSpeedTie = stats.nidoran.speedDV >= 11
2015-04-06 01:18:46 -07:00
if Control.yolo then
if canTwoHit and stats.nidoran.speedDV >= 13 then
2015-04-06 00:50:00 -07:00
healAmount = 45
elseif canTwoHit or canSpeedTie then
2015-04-06 00:50:00 -07:00
healAmount = 65
end
else
if canTwoHit and stats.nidoran.speedDV >= 13 then
2015-04-06 00:50:00 -07:00
healAmount = 45
elseif canTwoHit and canSpeedTie then
2015-04-06 00:50:00 -07:00
healAmount = 65
end
end
healAmount = healAmount - (stats.nidoran.special - 43)
2015-04-06 01:18:46 -07:00
if Strategies.initialize() then
2015-04-06 00:50:00 -07:00
local message
2015-04-06 01:18:46 -07:00
local potionCount = Inventory.count("potion")
local needsToHeal = healAmount - Pokemon.index(0, "hp")
2015-04-06 00:50:00 -07:00
if potionCount * 20 < needsToHeal then
message = "ran too low on potions to adequately heal before Misty D:"
2015-04-06 00:50:00 -07:00
elseif healAmount < 60 then
message = "is limiting heals to attempt to get closer to red-bar off Misty..."
2015-04-06 00:50:00 -07:00
end
if message then
2015-04-06 01:18:46 -07:00
Bridge.chat(message, potionCount)
2015-04-06 00:50:00 -07:00
end
end
return Strategies.functions.potion({hp=healAmount, chain=data.chain})
2015-04-06 00:50:00 -07:00
end
strategyFunctions.fightMisty = function()
2015-04-06 01:18:46 -07:00
if Battle.isActive() then
status.canProgress = true
2015-04-06 01:18:46 -07:00
if Battle.redeployNidoking() then
if status.swappedOut == false then
status.swappedOut = true
2015-04-06 00:50:00 -07:00
end
return false
end
local forced
if not status.swappedOut and Combat.isConfused() then
2015-04-11 13:05:47 -07:00
if status.swappedOut == nil and Control.yolo then
status.swappedOut = true
return false
end
status.swappedOut = false
2015-04-11 13:05:47 -07:00
if Battle.sacrifice("pidgey", "spearow", "squirtle", "paras") then
2015-04-06 00:50:00 -07:00
return false
end
end
2015-04-08 01:53:48 -07:00
Battle.automate(forced)
elseif status.canProgress then
2015-04-06 00:50:00 -07:00
return true
else
2015-04-06 01:18:46 -07:00
Textbox.handle()
2015-04-06 00:50:00 -07:00
end
end
-- 6: MISTY
strategyFunctions.potionBeforeRocket = function()
if stats.nidoran.attackDV >= 12 then
2015-04-06 00:50:00 -07:00
return true
end
return Strategies.functions.potion({hp=13, yolo=11})
2015-04-06 00:50:00 -07:00
end
-- jingleSkip
2015-04-06 00:50:00 -07:00
strategyFunctions.catchOddish = function()
2015-04-06 01:18:46 -07:00
if not Control.canCatch() then
2015-04-06 00:50:00 -07:00
return true
end
2015-04-06 01:18:46 -07:00
local caught = Pokemon.inParty("oddish", "paras")
if Strategies.initialize() then
if caught then
if Pokemon.inParty("oddish") then
Bridge.chat("found an Oddish without having to search in the grass Kreygasm")
end
else
Bridge.chat("is searching for an Oddish in the grass, to teach it Cut")
end
end
2015-04-06 01:18:46 -07:00
local battleValue = Memory.value("game", "battle")
local px, py = Player.position()
2015-04-06 00:50:00 -07:00
if battleValue > 0 then
if battleValue == 2 then
status.tries = 2
2015-04-06 01:18:46 -07:00
Battle.automate()
2015-04-06 00:50:00 -07:00
else
if status.tries == 0 and py == 31 then
status.tries = 1
end
Battle.handle()
2015-04-06 00:50:00 -07:00
end
elseif status.tries == 1 and py == 31 then
2015-04-06 01:18:46 -07:00
Player.interact("Left")
2015-04-06 00:50:00 -07:00
else
local path
if caught then
if not status.caught then
2015-04-06 01:18:46 -07:00
Bridge.caught(Pokemon.inParty("oddish"))
status.caught = true
2015-04-06 00:50:00 -07:00
end
if py < 21 then
py = 21
elseif py < 24 then
if px < 16 then
px = 17
else
py = 24
end
elseif py < 25 then
py = 25
elseif px > 15 then
px = 15
elseif py < 28 then
py = 28
elseif py > 29 then
py = 29
elseif px ~= 11 then
px = 11
elseif py ~= 29 then
py = 29
else
return true
end
2015-04-06 01:18:46 -07:00
Walk.step(px, py)
2015-04-06 00:50:00 -07:00
elseif px == 12 then
local dy
if py == 30 then
dy = 31
else
dy = 30
end
2015-04-06 01:18:46 -07:00
Walk.step(px, dy)
2015-04-06 00:50:00 -07:00
else
local path = {{15,19}, {15,25}, {15,25}, {15,27}, {14,27}, {14,30}, {12,30}}
2015-04-06 01:18:46 -07:00
Walk.custom(path)
2015-04-06 00:50:00 -07:00
end
end
end
strategyFunctions.shopVermilionMart = function()
2015-04-06 01:18:46 -07:00
if Strategies.initialize() then
Strategies.setYolo("vermilion")
2015-04-06 00:50:00 -07:00
end
local sellArray = {{name="tm34"}, {name="nugget"}}
if not Inventory.contains("elixer") then
table.insert(sellArray, 1, {name="antidote"})
2015-04-06 00:50:00 -07:00
end
2015-04-06 01:18:46 -07:00
return Shop.transaction {
2015-04-06 00:50:00 -07:00
sell = sellArray,
buy = {{name="super_potion",index=1,amount=3}, {name="repel",index=5,amount=3}}
2015-04-06 00:50:00 -07:00
}
end
-- rivalSandAttack
strategyFunctions.trashcans = function()
2015-04-06 01:18:46 -07:00
local progress = Memory.value("progress", "trashcans")
if Textbox.isActive() then
if not status.canProgress then
2015-04-06 00:50:00 -07:00
if progress < 2 then
status.tries = status.tries + 1
end
status.canProgress = true
2015-04-06 00:50:00 -07:00
end
2015-04-06 01:18:46 -07:00
Input.cancel()
elseif progress == 3 then
return Strategies.completeCans()
elseif progress == 2 then
if status.canProgress then
status.canProgress = false
Walk.invertCustom()
end
local inverse = {
Up = "Down",
Right = "Left",
Down = "Up",
Left = "Right"
}
Player.interact(inverse[status.direction])
2015-04-06 00:50:00 -07:00
else
local trashPath = {{2,11},{"Left"},{2,11}, {2,12},{4,12},{4,11},{"Right"},{4,11}, {4,9},{"Left"},{4,9}, {4,7},{"Right"},{4,7}, {4,6},{2,6},{2,7},{"Left"},{2,7}, {2,6},{4,6},{4,8},{9,8},{"Up"},{9,8}, {8,8},{8,9},{"Left"},{8,9}, {8,10},{9,10},{"Down"},{9,10},{8,10}}
if status.direction and type(status.direction) == "number" then
2015-04-06 01:18:46 -07:00
local px, py = Player.position()
local dx, dy = px, py
if py < 12 then
dy = 12
elseif status.direction == 1 then
dx = 2
else
dx = 8
2015-04-06 00:50:00 -07:00
end
if px ~= dx or py ~= dy then
Walk.step(dx, dy)
return
2015-04-06 00:50:00 -07:00
end
status.direction = nil
2015-04-06 00:50:00 -07:00
end
status.direction = Walk.custom(trashPath, status.canProgress)
status.canProgress = false
2015-04-06 00:50:00 -07:00
end
end
2015-04-07 14:43:29 -07:00
strategyFunctions.potionBeforeSurge = function()
local yoloHp = 5
if Strategies.initialize() then
if Control.yolo then
local curr_hp = Combat.hp()
if curr_hp > yoloHp and curr_hp <= 21 then
Bridge.chat("is attempting to keep red-bar through Surge", curr_hp)
2015-04-07 14:43:29 -07:00
return true
end
end
end
if Inventory.contains("potion") then
return Strategies.functions.potion({hp=20, yolo=yoloHp, forced="potion", chain=true})
end
return Strategies.functions.potion({hp=8, yolo=yoloHp, chain=true})
end
2015-04-06 00:50:00 -07:00
strategyFunctions.fightSurge = function()
2015-04-06 01:18:46 -07:00
if Battle.isActive() then
status.canProgress = true
2015-04-06 00:50:00 -07:00
local forced
2015-04-06 01:18:46 -07:00
if Pokemon.isOpponent("voltorb") then
Combat.disableThrash = true
local __, enemyTurns = Combat.enemyAttack()
2015-04-06 00:50:00 -07:00
if not enemyTurns or enemyTurns > 2 then
forced = "bubblebeam"
2015-04-06 01:18:46 -07:00
elseif enemyTurns == 2 and not Strategies.opponentDamaged() then
2015-04-08 01:51:38 -07:00
local curr_hp, red_hp = Combat.hp(), Combat.redHP()
2015-04-06 00:50:00 -07:00
local afterHit = curr_hp - 20
if afterHit > 5 and afterHit <= red_hp then
forced = "bubblebeam"
end
end
else
2015-04-06 01:18:46 -07:00
Combat.disableThrash = false
2015-04-06 00:50:00 -07:00
end
2015-04-06 01:18:46 -07:00
Battle.automate(forced)
elseif status.canProgress then
2015-04-06 00:50:00 -07:00
return true
else
2015-04-06 01:18:46 -07:00
Textbox.handle()
2015-04-06 00:50:00 -07:00
end
end
-- 7: SURGE
strategyFunctions.procureBicycle = function()
2015-04-06 01:18:46 -07:00
if Inventory.contains("bicycle") then
if not Textbox.isActive() then
2015-04-06 00:50:00 -07:00
return true
end
2015-04-06 01:18:46 -07:00
Input.cancel()
elseif Textbox.handle() then
Player.interact("Right")
2015-04-06 00:50:00 -07:00
end
end
2015-04-12 11:32:11 -07:00
-- announceFourTurn
2015-04-13 00:47:34 -07:00
-- redbarCubone
2015-04-06 00:50:00 -07:00
strategyFunctions.undergroundElixer = function()
if Strategies.initialize() then
if Inventory.contains("elixer") and Inventory.contains("ether") then
return true
end
end
return strategyFunctions.interact({dir="Left"})
end
2015-04-13 00:47:34 -07:00
-- shopTM07
2015-04-06 00:50:00 -07:00
2015-04-13 00:47:34 -07:00
-- shopRepels
2015-04-06 00:50:00 -07:00
strategyFunctions.dodgeDepartment = function()
if Strategies.initialize() then
status.startPosition = Memory.raw(0x0242)
end
local px, py = Player.position()
local dx, dy = px, py
if status.startPosition > 7 then
dy = 2
else
dy = 5
end
if py == dy then
if px > 14 then
return true
end
dx = 15
end
Walk.step(dx, dy)
end
2015-04-13 00:47:34 -07:00
-- shopPokeDoll
2015-04-06 00:50:00 -07:00
2015-04-13 00:47:34 -07:00
-- shopVending
2015-04-06 00:50:00 -07:00
2015-04-13 00:47:34 -07:00
-- giveWater
2015-04-06 00:50:00 -07:00
2015-04-13 00:47:34 -07:00
-- shopExtraWater
2015-04-06 00:50:00 -07:00
strategyFunctions.shopBuffs = function()
2015-04-06 01:18:46 -07:00
if Strategies.initialize() then
if canRiskGiovanni() then
2015-04-06 00:50:00 -07:00
riskGiovanni = true
print("Giovanni skip strats!")
end
end
local xspecAmt = 4
if riskGiovanni then
xspecAmt = xspecAmt + 1
elseif stats.nidoran.special < 46 then
2015-04-06 00:50:00 -07:00
-- xspecAmt = xspecAmt - 1
end
2015-04-06 01:18:46 -07:00
return Shop.transaction{
2015-04-06 00:50:00 -07:00
direction = "Up",
buy = {{name="x_accuracy", index=0, amount=10}, {name="x_speed", index=5, amount=4}, {name="x_special", index=6, amount=xspecAmt}}
}
end
strategyFunctions.deptElevator = function()
2015-04-06 01:18:46 -07:00
if Textbox.isActive() then
status.canProgress = true
2015-04-13 00:47:34 -07:00
Menu.select(0, false, true)
2015-04-06 00:50:00 -07:00
else
if status.canProgress then
2015-04-06 00:50:00 -07:00
return true
end
2015-04-06 01:18:46 -07:00
Player.interact("Up")
2015-04-06 00:50:00 -07:00
end
end
-- 8: FLY
strategyFunctions.lavenderRival = function()
2015-04-06 01:18:46 -07:00
if Battle.isActive() then
status.canProgress = true
2015-04-06 00:50:00 -07:00
local forced
if stats.nidoran.special > 44 then -- RISK
2015-04-06 01:18:46 -07:00
local __, enemyTurns = Combat.enemyAttack()
if enemyTurns and enemyTurns < 2 and Pokemon.isOpponent("pidgeotto", "gyarados") then
Battle.automate()
2015-04-06 00:50:00 -07:00
return false
end
end
2015-04-06 01:18:46 -07:00
if Pokemon.isOpponent("gyarados") or Strategies.prepare("x_accuracy") then
Battle.automate()
2015-04-06 00:50:00 -07:00
end
elseif status.canProgress then
2015-04-06 00:50:00 -07:00
return true
else
2015-04-06 01:18:46 -07:00
Input.cancel()
2015-04-06 00:50:00 -07:00
end
end
2015-04-13 00:47:34 -07:00
-- digFight
2015-04-06 00:50:00 -07:00
2015-04-13 00:47:34 -07:00
-- pokeDoll
2015-04-06 02:19:25 -07:00
2015-04-06 00:50:00 -07:00
strategyFunctions.thunderboltFirst = function()
local forced
2015-04-06 01:18:46 -07:00
if Pokemon.isOpponent("zubat") then
status.canProgress = true
2015-04-06 00:50:00 -07:00
forced = "thunderbolt"
elseif status.canProgress then
2015-04-06 00:50:00 -07:00
return true
end
2015-04-06 01:18:46 -07:00
Battle.automate(forced)
2015-04-06 00:50:00 -07:00
end
-- 8: POKÉFLUTE
strategyFunctions.swapXSpeeds = function()
local destination = Inventory.contains("ether") and 4 or 5
return strategyFunctions.swap({item="x_speed", dest=destination, chain=true})
end
2015-04-06 00:50:00 -07:00
-- playPokeflute
2015-04-13 00:47:34 -07:00
-- drivebyRareCandy
2015-04-06 00:50:00 -07:00
strategyFunctions.tossInSafari = function()
if Inventory.count() <= (Inventory.contains("full_restore") and 18 or 17) then
return true
end
return Strategies.tossItem("antidote", "pokeball")
end
2015-04-13 00:47:34 -07:00
-- silphElevator
2015-04-06 00:50:00 -07:00
strategyFunctions.fightSilphMachoke = function()
2015-04-06 01:18:46 -07:00
if Battle.isActive() then
status.canProgress = true
if Control.yolo and stats.nidoran.special > 44 then
2015-04-06 01:18:46 -07:00
return Strategies.prepare("x_accuracy")
2015-04-06 00:50:00 -07:00
end
2015-04-06 01:18:46 -07:00
Battle.automate("thrash")
elseif status.canProgress then
2015-04-06 00:50:00 -07:00
return true
else
2015-04-06 01:18:46 -07:00
Textbox.handle()
2015-04-06 00:50:00 -07:00
end
end
strategyFunctions.silphCarbos = function()
if stats.nidoran.speedDV >= 8 then
2015-04-06 00:50:00 -07:00
return true
end
2015-04-06 01:18:46 -07:00
return Strategies.functions.interact({dir="Left"})
2015-04-06 00:50:00 -07:00
end
strategyFunctions.swapXSpecials = function()
local destination = Inventory.contains("ether") and 5 or 6
return strategyFunctions.swap({item="x_special", dest=destination, chain=true})
end
2015-04-06 00:50:00 -07:00
strategyFunctions.silphRival = function()
2015-04-06 01:18:46 -07:00
if Battle.isActive() then
if Strategies.initialize() then
status.gyaradosDamage = Combat.healthFor("RivalGyarados")
if Control.yolo then
2015-04-11 13:05:47 -07:00
Bridge.chat("is attempting to red-bar off Silph Rival. Get ready to spaghetti!")
end
status.canProgress = true
2015-04-06 00:50:00 -07:00
end
if Strategies.prepare("x_accuracy", "x_speed") then
local forced
local opponentName = Battle.opponent()
local curr_hp, red_hp = Combat.hp(), Combat.redHP()
if opponentName == "gyarados" then
if Control.yolo then
if willRedBar(status.gyaradosDamage) then
if not Strategies.prepare("x_special") then
return false
end
local stallTurn = Battle.pp("earthquake") > 8
Control.ignoreMiss = stallTurn
if stallTurn then
forced = "earthquake"
else
forced = "thunderbolt"
end
elseif Strategies.isPrepared("x_special") then
local canPotion = potionForRedBar(status.gyaradosDamage)
if canPotion then
Inventory.use(canPotion, nil, true)
return false
end
forced = "thunderbolt"
elseif curr_hp > status.gyaradosDamage * 0.95 then
if not Strategies.prepare("x_special") then
return false
end
forced = "thunderbolt"
end
2015-04-06 00:50:00 -07:00
end
elseif opponentName == "pidgeot" then
if Control.yolo then
if not willRedBar(status.gyaradosDamage) then
if curr_hp > status.gyaradosDamage * 0.95 then
if not Strategies.prepare("x_special") then
return false
end
forced = "ice_beam"
else
if Inventory.count("super_potion") > 2 and curr_hp + 50 > status.gyaradosDamage and curr_hp + 25 < Pokemon.index(0, "max_hp") then
Inventory.use("super_potion", nil, true)
return false
end
if not potionForRedBar(status.gyaradosDamage) then
forced = "ice_beam"
end
end
end
else
if Battle.pp("horn_drill") < 5 or Strategies.hasHealthFor("KogaWeezing", 5) then
forced = "ice_beam"
end
2015-04-06 00:50:00 -07:00
end
elseif opponentName == "alakazam" or opponentName == "growlithe" then
forced = "earthquake"
end
2015-04-06 01:18:46 -07:00
Battle.automate(forced)
2015-04-06 00:50:00 -07:00
end
elseif status.canProgress then
Control.ignoreMiss = false
2015-04-06 00:50:00 -07:00
return true
else
2015-04-06 01:18:46 -07:00
Textbox.handle()
2015-04-06 00:50:00 -07:00
end
end
strategyFunctions.rareCandyGiovanni = function()
local curr_hp = Combat.hp()
if curr_hp >= 10 and curr_hp < 19 and Pokemon.index(0, "level") > 36 then
if Inventory.count("rare_candy") > 1 then
if Menu.pause() then
Inventory.use("rare_candy")
status.menuOpened = true
end
return false
end
end
return Strategies.closeMenuFor({})
2015-04-06 00:50:00 -07:00
end
strategyFunctions.fightSilphGiovanni = function()
2015-04-06 01:18:46 -07:00
if Battle.isActive() then
status.canProgress = true
2015-04-06 00:50:00 -07:00
local forced
2015-04-06 01:18:46 -07:00
local opponentName = Battle.opponent()
2015-04-06 00:50:00 -07:00
if opponentName == "nidorino" then
2015-04-06 01:18:46 -07:00
if Battle.pp("horn_drill") > 2 then
2015-04-06 00:50:00 -07:00
forced = "horn_drill"
else
forced = "earthquake"
end
elseif opponentName == "rhyhorn" then
forced = "ice_beam"
elseif opponentName == "kangaskhan" or opponentName == "nidoqueen" then
forced = "horn_drill"
end
2015-04-06 01:18:46 -07:00
Battle.automate(forced)
elseif status.canProgress then
2015-04-06 00:50:00 -07:00
return true
else
2015-04-06 01:18:46 -07:00
Textbox.handle()
2015-04-06 00:50:00 -07:00
end
end
-- 9: SILPH CO.
strategyFunctions.potionBeforeHypno = function()
2015-04-08 01:51:38 -07:00
local curr_hp, red_hp = Combat.hp(), Combat.redHP()
2015-04-06 00:50:00 -07:00
local healthUnderRedBar = red_hp - curr_hp
local yoloHP = Combat.healthFor("HypnoHeadbutt") * 0.95
2015-04-06 01:18:46 -07:00
local useRareCandy = Inventory.count("rare_candy") > 2
2015-04-06 00:50:00 -07:00
local healTarget
if healthUnderRedBar >= 0 then
healTarget = "HypnoHeadbutt"
if useRareCandy then
useRareCandy = healthUnderRedBar > 2
end
else
healTarget = "HypnoConfusion"
if useRareCandy then
useRareCandy = Control.yolo and curr_hp < Combat.healthFor("KogaWeezing") * 0.85
2015-04-06 00:50:00 -07:00
end
end
if useRareCandy then
2015-04-06 01:18:46 -07:00
if Menu.pause() then
Inventory.use("rare_candy", nil, false)
2015-04-06 00:50:00 -07:00
end
return false
end
2015-04-06 01:18:46 -07:00
return Strategies.functions.potion({hp=healTarget, yolo=yoloHP, close=true})
2015-04-06 00:50:00 -07:00
end
strategyFunctions.fightHypno = function()
2015-04-06 01:18:46 -07:00
if Battle.isActive() then
2015-04-06 00:50:00 -07:00
local forced
2015-04-06 01:18:46 -07:00
if Pokemon.isOpponent("hypno") then
if Pokemon.info("nidoking", "hp") > Combat.healthFor("KogaWeezing") * 0.9 then
if Combat.isDisabled(85) then
2015-04-06 00:50:00 -07:00
forced = "ice_beam"
else
forced = "thunderbolt"
end
end
end
2015-04-06 01:18:46 -07:00
Battle.automate(forced)
status.canProgress = true
elseif status.canProgress then
2015-04-06 00:50:00 -07:00
return true
else
2015-04-06 01:18:46 -07:00
Textbox.handle()
2015-04-06 00:50:00 -07:00
end
end
strategyFunctions.fightKoga = function()
2015-04-06 01:18:46 -07:00
if Battle.isActive() then
2015-04-06 00:50:00 -07:00
local forced
local opponent = Battle.opponent()
local curr_hp = Combat.hp()
2015-04-06 01:18:46 -07:00
if Pokemon.isOpponent("weezing") then
local drillHp = (Pokemon.index(0, "level") > 40) and 12 or 9
2015-04-12 11:31:45 -07:00
if curr_hp > 0 and curr_hp < drillHp and Battle.pp("horn_drill") > 0 then
forced = "horn_drill"
if not status.drilling then
status.drilling = true
Bridge.chat("is at low enough HP to try Horn Drill on Weezing")
end
Control.ignoreMiss = true
elseif Strategies.opponentDamaged(2) then
2015-04-06 01:18:46 -07:00
Inventory.use("pokeflute", nil, true)
2015-04-06 00:50:00 -07:00
return false
else
if Combat.isDisabled(85) then
forced = "ice_beam"
else
forced = "thunderbolt"
end
Control.canDie(true)
2015-04-06 00:50:00 -07:00
end
else
if Strategies.isPrepared("x_accuracy") then
forced = "horn_drill"
elseif curr_hp > 9 and not Strategies.prepare("x_accuracy") then
return false
end
2015-04-06 00:50:00 -07:00
end
2015-04-06 01:18:46 -07:00
Battle.automate(forced)
status.canProgress = true
elseif status.canProgress then
2015-04-06 01:18:46 -07:00
Strategies.deepRun = true
Control.ignoreMiss = false
2015-04-06 00:50:00 -07:00
return true
else
2015-04-06 01:18:46 -07:00
Textbox.handle()
2015-04-06 00:50:00 -07:00
end
end
-- 10: KOGA
2015-04-13 00:47:34 -07:00
-- dodgeGirl
2015-04-06 00:50:00 -07:00
2015-04-13 00:47:34 -07:00
-- cinnabarCarbos
2015-04-06 00:50:00 -07:00
strategyFunctions.fightErika = function()
2015-04-06 01:18:46 -07:00
if Battle.isActive() then
status.canProgress = true
2015-04-06 00:50:00 -07:00
local forced
if Control.yolo then
local curr_hp, red_hp = Combat.hp(), Combat.redHP()
local razorDamage = 34
if curr_hp > razorDamage and curr_hp - razorDamage < red_hp then
if Strategies.opponentDamaged() then
forced = "thunderbolt"
elseif stats.nidoran.special < 45 then
forced = "ice_beam"
else
forced = "thunderbolt"
end
2015-04-06 00:50:00 -07:00
end
end
2015-04-06 01:18:46 -07:00
Battle.automate(forced)
elseif status.canProgress then
2015-04-06 00:50:00 -07:00
return true
else
2015-04-06 01:18:46 -07:00
Textbox.handle()
2015-04-06 00:50:00 -07:00
end
end
-- 11: ERIKA
strategyFunctions.waitToReceive = function()
2015-04-06 01:18:46 -07:00
local main = Memory.value("menu", "main")
2015-04-06 00:50:00 -07:00
if main == 128 then
if status.canProgress then
2015-04-06 00:50:00 -07:00
return true
end
elseif main == 32 or main == 123 then
status.canProgress = true
2015-04-06 01:18:46 -07:00
Input.cancel()
2015-04-06 00:50:00 -07:00
else
2015-04-06 01:18:46 -07:00
Input.press("Start", 2)
2015-04-06 00:50:00 -07:00
end
end
-- 14: SABRINA
strategyFunctions.earthquakeElixer = function(data)
2015-04-06 01:18:46 -07:00
if Battle.pp("earthquake") >= data.min then
if Strategies.closeMenuFor(data) then
2015-04-06 00:50:00 -07:00
return true
end
return false
end
2015-04-06 01:18:46 -07:00
if Strategies.initialize() then
print("EQ Elixer: "..Control.areaName)
2015-04-06 00:50:00 -07:00
end
2015-04-06 01:18:46 -07:00
return Strategies.useItem({item="elixer", poke="nidoking", chain=data.chain, close=data.close})
2015-04-06 00:50:00 -07:00
end
strategyFunctions.fightGiovanniMachoke = function()
2015-04-06 01:18:46 -07:00
if Strategies.initialize() then
if stats.nidoran.attackDV >= 13 and Battle.pp("earthquake") >= 7 then
status.skipSpecial = true
2015-04-06 00:50:00 -07:00
end
end
if Battle.isActive() then
status.canProgress = true
if Pokemon.isOpponent("machop") then
status.killedMachoke = true
elseif not status.killedMachoke then
if status.skipSpecial and Combat.hp() > 13 and Memory.value("battle", "opponent_last_move") == 116 then
Bridge.chat("got Focus Energy - using an X Special to guarantee the last Machoke")
status.skipSpecial = false
end
if not status.skipSpecial and not Strategies.prepare("x_special") then
return false
end
end
Battle.automate()
elseif status.canProgress then
return true
else
Textbox.handle()
end
2015-04-06 00:50:00 -07:00
end
strategyFunctions.checkGiovanni = function()
2015-04-06 01:18:46 -07:00
local ryhornDamage = math.floor(Combat.healthFor("GiovanniRhyhorn") * 0.95) --RISK
if Strategies.initialize() then
if Battle.pp("earthquake") > 4 then
2015-04-06 00:50:00 -07:00
return true
end
if riskGiovanni then
if Control.yolo or Pokemon.info("nidoking", "hp") >= ryhornDamage then
Bridge.chat("is using risky strats on Giovanni to skip the extra Max Ether...")
return true
end
end
local message = "ran out of Earthquake PP :( "
2015-04-06 01:18:46 -07:00
if Control.yolo then
2015-04-06 00:50:00 -07:00
message = message.."Risking on Giovanni."
else
2015-04-10 00:34:50 -07:00
message = message.."Reverting to standard strats."
2015-04-06 00:50:00 -07:00
end
2015-04-06 01:18:46 -07:00
Bridge.chat(message)
2015-04-06 00:50:00 -07:00
riskGiovanni = false
end
2015-04-06 01:18:46 -07:00
return Strategies.functions.potion({hp=50, yolo=ryhornDamage})
2015-04-06 00:50:00 -07:00
end
strategyFunctions.fightGiovanni = function()
2015-04-06 01:18:46 -07:00
if Battle.isActive() then
if Strategies.initialize() then
2015-04-12 11:31:45 -07:00
status.needsXSpecial = not Combat.inRedBar() or Battle.pp("earthquake") <= (riskGiovanni and 4 or 2)
status.canProgress = true
2015-04-06 00:50:00 -07:00
end
local forced
2015-04-06 00:50:00 -07:00
if riskGiovanni then
if status.needsXSpecial or Battle.pp("earthquake") < 4 then
2015-04-06 00:50:00 -07:00
forced = "ice_beam"
end
else
2015-04-06 01:18:46 -07:00
if Pokemon.isOpponent("rhydon") then
2015-04-06 00:50:00 -07:00
forced = "ice_beam"
end
end
if status.needsXSpecial and not Strategies.prepare("x_special") then
2015-04-06 00:50:00 -07:00
return false
end
2015-04-06 01:18:46 -07:00
Battle.automate(forced)
elseif status.canProgress then
2015-04-06 00:50:00 -07:00
return true
else
2015-04-06 01:18:46 -07:00
Textbox.handle()
2015-04-06 00:50:00 -07:00
end
end
-- 15: GIOVANNI
strategyFunctions.viridianRival = function()
2015-04-06 01:18:46 -07:00
if Battle.isActive() then
2015-04-09 20:45:37 -07:00
status.canProgress = true
if Strategies.prepare("x_accuracy", "x_special") then
2015-04-06 00:50:00 -07:00
local forced
2015-04-06 01:18:46 -07:00
if Pokemon.isOpponent("pidgeot") then
2015-04-06 00:50:00 -07:00
forced = "thunderbolt"
elseif riskGiovanni then
2015-04-06 01:18:46 -07:00
if Pokemon.isOpponent("rhyhorn") or Strategies.opponentDamaged() then
2015-04-06 00:50:00 -07:00
forced = "ice_beam"
2015-04-06 01:18:46 -07:00
elseif Pokemon.isOpponent("gyarados") then
2015-04-06 00:50:00 -07:00
forced = "thunderbolt"
2015-04-06 01:18:46 -07:00
elseif Pokemon.isOpponent("growlithe", "alakazam") then
2015-04-06 00:50:00 -07:00
forced = "earthquake"
end
end
2015-04-06 01:18:46 -07:00
Battle.automate(forced)
2015-04-06 00:50:00 -07:00
end
elseif status.canProgress then
2015-04-06 00:50:00 -07:00
return true
else
2015-04-06 01:18:46 -07:00
Textbox.handle()
2015-04-06 00:50:00 -07:00
end
end
strategyFunctions.checkEther = function()
-- TODO don't skip center if not in redbar
maxEtherSkip = not requiresE4Center()
if not maxEtherSkip then
Bridge.chat("is grabbing the Max Ether to skip the Elite 4 Center")
end
return true
end
2015-04-06 00:50:00 -07:00
strategyFunctions.ether = function(data)
2015-04-06 01:18:46 -07:00
local main = Memory.value("menu", "main")
data.item = status.item
if status.item and Strategies.completedMenuFor(data) then
2015-04-06 01:18:46 -07:00
if Strategies.closeMenuFor(data) then
2015-04-06 00:50:00 -07:00
return true
end
else
if not status.item then
if data.max and maxEtherSkip then
return true
2015-04-06 00:50:00 -07:00
end
status.item = Inventory.contains("ether", "max_ether", "elixer")
if not status.item then
if Strategies.closeMenuFor(data) then
return true
end
print("No Ether - "..Control.areaName)
return false
2015-04-06 00:50:00 -07:00
end
end
if status.item == "elixer" then
return Strategies.useItem({item="elixer", poke="nidoking", chain=data.chain, close=data.close})
2015-04-06 00:50:00 -07:00
end
2015-04-06 01:18:46 -07:00
if Memory.value("menu", "main") == 144 and Menu.getCol() == 5 then
if Menu.hasTextbox() then
2015-04-06 01:18:46 -07:00
Input.cancel()
else
Menu.select(Pokemon.battleMove("horn_drill"), true)
2015-04-06 00:50:00 -07:00
end
2015-04-06 01:18:46 -07:00
elseif Menu.pause() then
2015-04-08 01:51:38 -07:00
Inventory.use(status.item, "nidoking")
status.menuOpened = true
2015-04-06 00:50:00 -07:00
end
end
end
strategyFunctions.tossInVictoryRoad = function()
if Strategies.initialize() then
if maxEtherSkip then
return true
end
if Inventory.count("ether") + Inventory.count("elixer") >= 2 then
return true
end
end
return Strategies.tossItem("antidote", "pokeball")
end
strategyFunctions.grabMaxEther = function()
2015-04-08 01:53:24 -07:00
if Strategies.initialize() then
if maxEtherSkip and (Inventory.count("ether") + Inventory.count("elixer") >= 2) then
return true
end
if Inventory.isFull() then
2015-04-06 00:50:00 -07:00
return true
end
end
2015-04-06 01:18:46 -07:00
if Inventory.contains("max_ether") then
2015-04-06 00:50:00 -07:00
return true
end
2015-04-08 01:53:24 -07:00
local px, py = Player.position()
if px > 7 then
return Strategies.reset("Accidentally walked on the island :(", px, true)
end
if Memory.value("player", "moving") == 0 then
Player.interact("Right")
end
2015-04-06 00:50:00 -07:00
end
-- push
strategyFunctions.potionBeforeLorelei = function()
2015-04-06 01:18:46 -07:00
if Strategies.initialize() then
if requiresE4Center() then
return true
end
2015-04-06 00:50:00 -07:00
local canPotion
2015-04-06 01:18:46 -07:00
if Inventory.contains("potion") and Strategies.hasHealthFor("LoreleiDewgong", 20) then
2015-04-06 00:50:00 -07:00
canPotion = true
2015-04-06 01:18:46 -07:00
elseif Inventory.contains("super_potion") and Strategies.hasHealthFor("LoreleiDewgong", 50) then
2015-04-06 00:50:00 -07:00
canPotion = true
end
if not canPotion then
return true
end
Bridge.chat("is healing before Lorelei to skip the Elite 4 Center...")
2015-04-06 00:50:00 -07:00
end
2015-04-06 01:18:46 -07:00
return Strategies.functions.potion({hp=Combat.healthFor("LoreleiDewgong")})
2015-04-06 00:50:00 -07:00
end
strategyFunctions.depositPokemon = function()
local toSize
if Strategies.hasHealthFor("LoreleiDewgong") or requiresE4Center() then
2015-04-06 00:50:00 -07:00
toSize = 1
else
toSize = 2
end
2015-04-06 01:18:46 -07:00
if Memory.value("player", "party_size") == toSize then
if Menu.close() then
2015-04-06 00:50:00 -07:00
return true
end
else
2015-04-06 01:18:46 -07:00
if not Textbox.isActive() then
Player.interact("Up")
2015-04-06 00:50:00 -07:00
else
2015-04-06 01:18:46 -07:00
local pc = Memory.value("menu", "size")
if not Menu.hasTextbox() and (pc == 2 or pc == 4) then
2015-04-06 01:18:46 -07:00
local menuColumn = Menu.getCol()
2015-04-06 00:50:00 -07:00
if menuColumn == 10 then
2015-04-06 01:18:46 -07:00
Input.press("A")
2015-04-06 00:50:00 -07:00
elseif menuColumn == 5 then
local depositIndex = 1
local depositAllExtras = toSize == 1
2015-04-06 01:18:46 -07:00
if not depositAllExtras and Pokemon.indexOf("pidgey", "spearow") == 1 then
2015-04-06 00:50:00 -07:00
depositIndex = 2
end
2015-04-06 01:18:46 -07:00
Menu.select(depositIndex)
2015-04-06 00:50:00 -07:00
else
2015-04-06 01:18:46 -07:00
Menu.select(1)
2015-04-06 00:50:00 -07:00
end
else
2015-04-06 01:18:46 -07:00
Input.press("A")
2015-04-06 00:50:00 -07:00
end
end
end
end
strategyFunctions.centerSkip = function()
if Strategies.initialize() then
Strategies.setYolo("e4center")
if not requiresE4Center() then
local message = "is skipping the Center and attempting to red-bar "
if Strategies.hasHealthFor("LoreleiDewgong") then
message = message.."off Lorelei..."
else
message = message.."the Elite 4!"
end
Bridge.chat(message)
return true
end
2015-04-06 00:50:00 -07:00
end
return strategyFunctions.confirm({dir="Up"})
2015-04-06 00:50:00 -07:00
end
strategyFunctions.lorelei = function()
2015-04-06 01:18:46 -07:00
if Battle.isActive() then
status.canProgress = true
2015-04-06 01:18:46 -07:00
if Battle.redeployNidoking() then
2015-04-06 00:50:00 -07:00
return false
end
local forced
2015-04-06 01:18:46 -07:00
local opponentName = Battle.opponent()
2015-04-06 00:50:00 -07:00
if opponentName == "dewgong" then
2015-04-06 01:18:46 -07:00
if Battle.sacrifice("pidgey", "spearow", "squirtle", "paras", "oddish") then
2015-04-06 00:50:00 -07:00
return false
end
elseif opponentName == "jinx" then
2015-04-10 00:34:50 -07:00
if Battle.pp("horn_drill") <= 1 then
2015-04-06 00:50:00 -07:00
forced = "earthquake"
end
end
2015-04-06 01:18:46 -07:00
if Strategies.prepare("x_accuracy") then
Battle.automate(forced)
2015-04-06 00:50:00 -07:00
end
elseif status.canProgress then
2015-04-06 00:50:00 -07:00
return true
else
2015-04-06 01:18:46 -07:00
Textbox.handle()
2015-04-06 00:50:00 -07:00
end
end
-- 16: LORELEI
strategyFunctions.bruno = function()
2015-04-06 01:18:46 -07:00
if Battle.isActive() then
status.canProgress = true
2015-04-06 00:50:00 -07:00
local forced
2015-04-06 01:18:46 -07:00
if Pokemon.isOpponent("onix") then
2015-04-06 00:50:00 -07:00
forced = "ice_beam"
-- local curr_hp, red_hp = Pokemon.info("nidoking", "hp"), Combat.redHP()
2015-04-06 00:50:00 -07:00
-- if curr_hp > red_hp then
2015-04-06 01:18:46 -07:00
-- local enemyMove, enemyTurns = Combat.enemyAttack()
2015-04-06 00:50:00 -07:00
-- if enemyTurns and enemyTurns > 1 then
-- local rockDmg = enemyMove.damage
-- if curr_hp - rockDmg <= red_hp then
-- forced = "thunderbolt"
-- end
-- end
-- end
end
2015-04-06 01:18:46 -07:00
if Strategies.prepare("x_accuracy") then
Battle.automate(forced)
2015-04-06 00:50:00 -07:00
end
elseif status.canProgress then
2015-04-06 00:50:00 -07:00
return true
else
2015-04-06 01:18:46 -07:00
Textbox.handle()
2015-04-06 00:50:00 -07:00
end
end
strategyFunctions.agatha = function() --TODO test without x acc
2015-04-06 01:18:46 -07:00
if Battle.isActive() then
status.canProgress = true
2015-04-06 01:18:46 -07:00
if Combat.isSleeping() then
Inventory.use("pokeflute", nil, true)
2015-04-06 00:50:00 -07:00
return false
end
2015-04-06 01:18:46 -07:00
if Pokemon.isOpponent("gengar") then
local currentHP = Pokemon.info("nidoking", "hp")
local xItem1, xItem2
if not Control.yolo then
xItem1, xItem2 = "x_accuracy", "x_speed"
else
xItem1 = "x_speed"
end
if not Control.yolo and currentHP <= 56 and not Strategies.isPrepared(xItem1, xItem2) then
2015-04-06 01:18:46 -07:00
local toPotion = Inventory.contains("full_restore", "super_potion")
2015-04-06 00:50:00 -07:00
if toPotion then
2015-04-06 01:18:46 -07:00
Inventory.use(toPotion, nil, true)
2015-04-06 00:50:00 -07:00
return false
end
end
if not Strategies.prepare(xItem1, xItem2) then
2015-04-06 00:50:00 -07:00
return false
end
end
2015-04-06 01:18:46 -07:00
Battle.automate()
elseif status.canProgress then
2015-04-06 00:50:00 -07:00
return true
else
2015-04-06 01:18:46 -07:00
Textbox.handle()
2015-04-06 00:50:00 -07:00
end
end
strategyFunctions.prepareForLance = function()
local enableFull
2015-04-06 01:18:46 -07:00
if Strategies.hasHealthFor("LanceGyarados", 100) then
enableFull = Inventory.count("super_potion") < 2
elseif Strategies.hasHealthFor("LanceGyarados", 50) then
enableFull = not Inventory.contains("super_potion")
2015-04-06 00:50:00 -07:00
else
enableFull = true
end
2015-04-06 01:18:46 -07:00
local min_recovery = Combat.healthFor("LanceGyarados")
if not Control.yolo then
min_recovery = min_recovery + 2
end
2015-04-06 01:18:46 -07:00
return Strategies.functions.potion({hp=min_recovery, full=enableFull, chain=true})
2015-04-06 00:50:00 -07:00
end
strategyFunctions.lance = function()
2015-04-06 01:18:46 -07:00
if Battle.isActive() then
status.canProgress = true
2015-04-06 00:50:00 -07:00
local xItem
2015-04-06 01:18:46 -07:00
if Pokemon.isOpponent("dragonair") then
2015-04-06 00:50:00 -07:00
xItem = "x_speed"
else
xItem = "x_special"
end
2015-04-06 01:18:46 -07:00
if Strategies.prepare(xItem) then
Battle.automate()
2015-04-06 00:50:00 -07:00
end
elseif status.canProgress then
2015-04-06 00:50:00 -07:00
return true
else
2015-04-06 01:18:46 -07:00
Textbox.handle()
2015-04-06 00:50:00 -07:00
end
end
strategyFunctions.prepareForBlue = function()
2015-04-06 01:18:46 -07:00
if Strategies.initialize() then
Strategies.setYolo("blue")
2015-04-06 00:50:00 -07:00
end
2015-04-06 01:18:46 -07:00
local skyDmg = Combat.healthFor("BlueSky") * 0.925
local wingDmg = Combat.healthFor("BluePidgeot")
return Strategies.functions.potion({hp=skyDmg-50, yolo=wingDmg, full=true})
2015-04-06 00:50:00 -07:00
end
strategyFunctions.blue = function()
2015-04-06 01:18:46 -07:00
if Battle.isActive() then
if not status.canProgress then
status.canProgress = true
if stats.nidoran.specialDV >= 8 and stats.nidoran.speedDV >= 12 and Inventory.contains("x_special") then
status.xItem = "x_special"
2015-04-06 00:50:00 -07:00
else
status.xItem = "x_speed"
2015-04-06 00:50:00 -07:00
end
end
2015-04-06 01:18:46 -07:00
local boostFirst = Pokemon.index(0, "hp") < 55
2015-04-06 00:50:00 -07:00
local firstItem, secondItem
if boostFirst then
firstItem = status.xItem
2015-04-06 00:50:00 -07:00
secondItem = "x_accuracy"
else
firstItem = "x_accuracy"
secondItem = status.xItem
2015-04-06 00:50:00 -07:00
end
local forced = "horn_drill"
2015-04-10 01:38:35 -07:00
if Memory.value("battle", "attack_turns") > 0 then
2015-04-06 01:18:46 -07:00
local skyDamage = Combat.healthFor("BlueSky")
2015-04-06 00:50:00 -07:00
local healCutoff = skyDamage * 0.825
2015-04-06 01:18:46 -07:00
if Strategies.initialize() then
if not Strategies.isPrepared("x_accuracy", status.xItem) then
local msg = " Uh oh... First-turn Sky Attack could end the run here, "
2015-04-06 01:18:46 -07:00
if Pokemon.index(0, "hp") > skyDamage then
2015-04-06 00:50:00 -07:00
msg = msg.."no criticals pls D:"
2015-04-06 01:18:46 -07:00
elseif Strategies.canHealFor(healCutoff) then
2015-04-06 00:50:00 -07:00
msg = msg.."attempting to heal for it"
2015-04-06 01:18:46 -07:00
if not Strategies.canHealFor(skyDamage) then
2015-04-06 00:50:00 -07:00
msg = msg.." (damage range)"
end
msg = msg.."."
else
msg = msg.."and nothing left to heal with BibleThump"
end
2015-04-06 01:18:46 -07:00
Bridge.chat(msg)
2015-04-06 00:50:00 -07:00
end
end
2015-04-06 01:18:46 -07:00
if Strategies.prepare(firstItem) then
if not Strategies.isPrepared(secondItem) then
local toPotion = Strategies.canHealFor(healCutoff)
2015-04-06 00:50:00 -07:00
if toPotion then
2015-04-06 01:18:46 -07:00
Inventory.use(toPotion, nil, true)
2015-04-06 00:50:00 -07:00
return false
end
end
if Strategies.prepare("x_accuracy", status.xItem) then
2015-04-06 01:18:46 -07:00
Battle.automate(forced)
2015-04-06 00:50:00 -07:00
end
end
else
2015-04-06 01:18:46 -07:00
if Strategies.prepare(firstItem, secondItem) then
if Pokemon.isOpponent("alakazam") then
2015-04-10 00:34:50 -07:00
if status.xItem == "x_speed" then
2015-04-06 00:50:00 -07:00
forced = "earthquake"
end
2015-04-06 01:18:46 -07:00
elseif Pokemon.isOpponent("rhydon") then
if status.xItem == "x_special" then
2015-04-06 00:50:00 -07:00
forced = "ice_beam"
end
end
2015-04-06 01:18:46 -07:00
Battle.automate(forced)
2015-04-06 00:50:00 -07:00
end
end
elseif status.canProgress then
2015-04-06 00:50:00 -07:00
return true
else
2015-04-06 01:18:46 -07:00
Textbox.handle()
2015-04-06 00:50:00 -07:00
end
end
strategyFunctions.champion = function()
if status.canProgress then
if status.tries > 2000 then
2015-04-08 01:51:38 -07:00
return Strategies.hardReset("Back to the grind - you can follow on Twitter for updates on our next good run! https://twitter.com/thepokebot")
2015-04-06 00:50:00 -07:00
end
if status.tries == 0 then
if STREAMING_MODE and CUSTOM_SEED ~= nil then
gui.text(0, 0, "PokeBot v"..VERSION)
gui.text(0, 7, "Seed: "..Strategies.seed)
gui.text(0, 14, "Reset for time: "..tostring(RESET_FOR_TIME))
gui.text(0, 21, "Time: "..Utils.elapsedTime())
gui.text(0, 28, "Frames: "..Utils.frames())
client.setscreenshotosd(true)
client.screenshot()
client.setscreenshotosd(false)
gui.cleartext()
end
Strategies.tweetProgress("Beat Pokemon Red in "..status.canProgress.."!")
2015-04-06 01:18:46 -07:00
if Strategies.seed then
print("v"..VERSION..": "..Utils.frames().." frames, with seed "..Strategies.seed)
2015-04-06 00:50:00 -07:00
print("Please save this seed number to share, if you would like proof of your run!")
end
2015-04-12 11:31:45 -07:00
elseif status.tries == 500 then
Bridge.chat("beat the game in "..status.canProgress.." !")
2015-04-06 00:50:00 -07:00
end
status.tries = status.tries + 1
2015-04-06 01:18:46 -07:00
elseif Memory.value("menu", "shop_current") == 252 then
Strategies.functions.split({finished=true})
status.canProgress = Utils.elapsedTime()
2015-04-06 00:50:00 -07:00
else
2015-04-06 01:18:46 -07:00
Input.cancel()
2015-04-06 00:50:00 -07:00
end
end
-- PROCESS
2015-04-06 01:18:46 -07:00
function Strategies.initGame(midGame)
2015-04-06 00:50:00 -07:00
if not STREAMING_MODE then
2015-04-06 01:18:46 -07:00
-- Strategies.setYolo("bulbasaur")
stats.squirtle = {
attack = 11,
defense = 11,
speed = 11,
special = 11,
}
if Pokemon.inParty("nidoking") then
local attDv, defDV, spdDv, sclDV = Pokemon.getDVs("nidoking")
2015-04-10 00:34:50 -07:00
p(attDv, defDV, spdDv, sclDV)
stats.nidoran = {
attack = 55,
defense = 45,
speed = 50,
special = 45,
rating = 1,
attackDV = attDv,
defenseDV = defDV,
speedDV = spdDv,
specialDV = sclDV,
}
riskGiovanni = canRiskGiovanni()
else
stats.nidoran = {
attack = 16,
defense = 12,
speed = 15,
special = 13,
level4 = true,
rating = 1,
}
end
p(stats.nidoran.attack, "x", stats.nidoran.speed, stats.nidoran.special)
2015-04-06 00:50:00 -07:00
end
end
2015-04-06 02:19:25 -07:00
function Strategies.completeGameStrategy()
status = Strategies.status
end
2015-04-06 01:18:46 -07:00
function Strategies.resetGame()
2015-04-06 00:50:00 -07:00
maxEtherSkip = false
2015-04-06 01:18:46 -07:00
status = Strategies.status
stats = Strategies.stats
2015-04-06 00:50:00 -07:00
end
2015-04-06 01:18:46 -07:00
return Strategies