PokeBot/ai/red/strategies.lua

2086 lines
50 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,
champion = function() --PB
return 110.22
end,
2015-04-06 00:50:00 -07:00
}
-- 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
if opponentLevel == 3 then
status.path = {2, 6, 12}
else
status.path = {3, 6, 12}
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
end
-- STATE
local function canRiskGiovanni()
return stats.nidoran.attackDV >= 11 and stats.nidoran.specialDV >= 4
end
function Strategies.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()
Strategies.setYolo("misty")
if not Strategies.updates.brock and not Control.yolo 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()
2015-04-15 01:38:51 -07:00
Control.preferredPotion = "super"
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
-- tweetVictoryRoad
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
if Battle.isActive() and Battle.opponentAlive() 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
2015-04-16 12:34:13 -07:00
-- 1: RIVAL
2015-04-06 00:50:00 -07:00
-- 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
2015-04-16 12:34:13 -07:00
-- 2: NIDORAN
2015-04-06 00:50:00 -07:00
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 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-15 01:44:59 -07:00
status.previousPotions = potionCount
status.needsExtraPotion = potionCount == 0 or Pokemon.info("squirtle", "hp") <= 16
2015-04-15 01:44:59 -07:00
elseif status.needsExtraPotion then
if potionCount > status.previousPotions then
status.needsExtraPotion = false
else
status.previousPotions = potionCount
2015-04-06 00:50:00 -07:00
end
2015-04-15 01:44:59 -07:00
end
if potionCount > 0 and Pokemon.info("squirtle", "hp") <= 12 then
if Menu.pause() then
Inventory.use("potion", "squirtle")
2015-04-06 00:50:00 -07:00
end
2015-04-15 01:44:59 -07:00
elseif Menu.close() then
if not status.needsExtraPotion then
2015-04-09 20:45:37 -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
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-15 01:47:18 -07:00
local __, turnsToKill, turnsToDie = Combat.bestMove()
2015-04-06 01:18:46 -07:00
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
Pokemon.select("nidoran")
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"))
local resetsForStats = att < 15 or spd < 14 or scl < 12
2015-04-14 14:48:39 -07:00
if not resetsForStats and RESET_FOR_TIME then
resetsForStats = att == 15 and spd == 14
end
local nidoranStatus = "Att: "..att..", Def: "..def..", Speed: "..spd..", Special: "..scl
2015-04-14 14:48:39 -07:00
if resetsForStats then
return Strategies.reset("Bad Nidoran - "..nidoranStatus)
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.." "..nidoranStatus..", 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
2015-04-16 12:34:13 -07:00
-- 3: BROCK
2015-04-06 00:50:00 -07:00
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-14 14:48:39 -07:00
strategyFunctions.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))
2015-04-14 14:48:39 -07:00
return strategyFunctions.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-14 14:48:39 -07:00
return strategyFunctions.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
if Battle.opponentAlive() 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
2015-04-16 12:34:13 -07:00
-- 4: ROUTE 3
2015-04-06 00:50:00 -07:00
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
2015-04-16 12:34:13 -07:00
-- 5: MT. MOON
2015-04-06 00:50:00 -07:00
-- 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-15 01:47:18 -07:00
local __, turnsToKill = Combat.bestMove()
if turnsToKill == 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
if not status.sacrificed then
status.sacrificed = true
Bridge.chat("got Sand-Attacked... Swapping out "..Utils.capitalize(sacrifice).." to restore accuracy (no more trolling please)")
end
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
strategyFunctions.hornAttackCaterpie = function()
if Strategies.initialize() then
if Pokemon.hasMove("thrash") then
return true
end
end
local forced
if Battle.isActive() then
status.canProgress = true
if not Strategies.opponentDamaged() then
forced = "horn_attack"
end
elseif status.canProgress then
return true
end
Battle.automate(forced)
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-14 14:48:39 -07:00
return strategyFunctions.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
2015-04-16 12:34:13 -07:00
-- 6: NUGGET BRIDGE
2015-04-06 00:50:00 -07:00
strategyFunctions.thrashGeodude = function()
2015-04-06 01:18:46 -07:00
if Battle.isActive() then
status.canProgress = true
if Pokemon.isOpponent("geodude") and Battle.opponentAlive() 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()
end
2015-04-15 01:44:34 -07:00
if status.sacrificeSquirtle then
if Battle.sacrifice("squirtle") then
if not status.sacrificed then
status.sacrificed = true
Bridge.chat(" Thrash didn't finish the kill :( swapping to Squirtle for safety")
end
return false
end
2015-04-15 01:44:34 -07:00
elseif not status.confused and Combat.isConfused() then
status.confused = true
Bridge.chat("is attempting to hit through confusion to avoid switching out to Squirtle")
2015-04-06 00:50:00 -07:00
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)
if not status.healed then
status.healed = true
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
2015-04-14 14:48:39 -07:00
return strategyFunctions.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 Battle.opponentAlive() 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
local sacrifice = Pokemon.getSacrifice("pidgey", "spearow", "squirtle", "paras")
if not status.sacrificed then
status.sacrificed = true
local swapMessage = " Thrash didn't finish the kill :( "
if stats.nidoran.speedDV < 11 then
swapMessage = swapMessage.."We're slower than Misty, looks like it's over"
sacrifice = nil
elseif sacrifice then
if Control.yolo then
swapMessage = swapMessage.."Attempting to hit through Confusion to save time"
else
swapMessage = swapMessage.."Swapping out to cure Confusion"
end
else
swapMessage = swapMessage.."We'll have to hit through Confusion here"
end
Bridge.chat(swapMessage)
end
if sacrifice and not Control.yolo and Battle.sacrifice(sacrifice) 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
2015-04-16 12:34:13 -07:00
-- 7: MISTY
2015-04-06 00:50:00 -07:00
strategyFunctions.potionBeforeRocket = function()
if stats.nidoran.attackDV >= 12 then
2015-04-06 00:50:00 -07:00
return true
end
2015-04-14 14:48:39 -07:00
return strategyFunctions.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
2015-04-14 16:55:24 -07:00
elseif status.tries == 1 and py == 31 and Combat.hp() > 12 then
2015-04-06 01:18:46 -07:00
Player.interact("Left")
2015-04-14 16:55:24 -07:00
Strategies.foughtRaticateEarly = true
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
2015-04-14 16:55:24 -07:00
strategyFunctions.potionBeforeRaticate = function()
if Strategies.foughtRaticateEarly then
Strategies.foughtRaticateEarly = nil
return true
end
return strategyFunctions.potion({hp=10, yolo=8})
2015-04-14 16:55:24 -07:00
end
2015-04-06 00:50:00 -07:00
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
2015-04-14 14:48:39 -07:00
return strategyFunctions.potion({hp=20, yolo=yoloHp, forced="potion", chain=true})
2015-04-07 14:43:29 -07:00
end
2015-04-14 14:48:39 -07:00
return strategyFunctions.potion({hp=8, yolo=yoloHp, chain=true})
2015-04-07 14:43:29 -07:00
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
2015-04-15 13:21:25 -07:00
Combat.disableThrash = not Control.yolo or stats.nidoran.attackDV < 9 or Combat.inRedBar()
2015-04-06 01:18:46 -07:00
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
2015-04-14 16:55:24 -07:00
if afterHit > 5 and afterHit <= red_hp - 3 then
2015-04-06 00:50:00 -07:00
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
2015-04-16 12:34:13 -07:00
-- 8: SURGE
2015-04-06 00:50:00 -07:00
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
2015-04-14 16:55:24 -07:00
-- announceOddish
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()
if Menu.isOpened() 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
2015-04-16 12:34:13 -07:00
-- 9: FLY
2015-04-06 00:50:00 -07:00
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
2015-04-16 12:34:13 -07:00
-- 10: POKÉFLUTE
2015-04-06 00:50:00 -07:00
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
2015-04-16 12:23:02 -07:00
-- safariCarbos
-- tossInSafari
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-14 14:48:39 -07:00
return strategyFunctions.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
if Control.yolo then
2015-04-16 12:34:13 -07:00
status.gyaradosDamage = Combat.healthFor("RivalGyarados")
Bridge.chat("is attempting to red-bar off Silph Rival. Get ready to spaghetti!", status.gyaradosDamage.." "..Combat.redHP())
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
2015-04-16 12:34:13 -07:00
if status.gyaradosDamage 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
2015-04-16 12:34:13 -07:00
if status.gyaradosDamage 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" then
2015-04-06 00:50:00 -07:00
forced = "horn_drill"
elseif opponentName == "nidoqueen" then
if Strategies.hasHealthFor("KogaWeezing") then
if not Strategies.opponentDamaged() then
forced = "earthquake"
end
else
forced = "horn_drill"
end
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
2015-04-16 12:34:13 -07:00
-- 11: SILPH CO.
2015-04-06 00:50:00 -07:00
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-14 14:48:39 -07:00
return strategyFunctions.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
2015-04-16 12:34:13 -07:00
-- 12: KOGA
2015-04-06 00:50:00 -07:00
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
2015-04-16 12:34:13 -07:00
-- 13: ERIKA
2015-04-06 00:50:00 -07:00
-- waitToReceive
2015-04-16 12:34:13 -07:00
-- 14: BLAINE
2015-04-06 00:50:00 -07:00
2015-04-16 12:34:13 -07:00
-- 15: SABRINA
2015-04-06 00:50:00 -07:00
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-14 14:48:39 -07:00
return strategyFunctions.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
2015-04-16 12:34:13 -07:00
-- 16: GIOVANNI
2015-04-06 00:50:00 -07:00
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
-- checkEther
-- ether
2015-04-06 00:50:00 -07:00
2015-04-14 14:48:39 -07:00
-- tossInVictoryRoad
-- grabMaxEther
2015-04-06 00:50:00 -07:00
-- push
strategyFunctions.potionBeforeLorelei = function()
2015-04-06 01:18:46 -07:00
if Strategies.initialize() then
if Strategies.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-14 14:48:39 -07:00
return strategyFunctions.potion({hp=Combat.healthFor("LoreleiDewgong")})
2015-04-06 00:50:00 -07:00
end
strategyFunctions.depositPokemon = function()
local toSize
if Strategies.hasHealthFor("LoreleiDewgong") or Strategies.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
if not Menu.isOpened() then
2015-04-06 01:18:46 -07:00
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 Strategies.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
local sacrifice = Pokemon.getSacrifice("pidgey", "spearow", "squirtle", "paras", "oddish")
if Battle.sacrifice(sacrifice) then
if not status.sacrificed then
status.sacrificed = true
Bridge.chat(" Swapping out "..Utils.capitalize(sacrifice).." to tank Aurora Beam into turn 2 Rest. Only a problem if it misses...")
end
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
2015-04-16 12:34:13 -07:00
-- 17: LORELEI
2015-04-06 00:50:00 -07:00
strategyFunctions.bruno = function()
2015-04-06 01:18:46 -07:00
if Battle.isActive() then
status.canProgress = true
2015-04-14 14:48:39 -07:00
2015-04-06 01:18:46 -07:00
if Strategies.prepare("x_accuracy") then
2015-04-14 14:48:39 -07:00
local forced
if Pokemon.isOpponent("onix") then
forced = "ice_beam"
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
2015-04-14 14:48:39 -07:00
strategyFunctions.agatha = 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 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
-- prepareForLance
2015-04-06 00:50:00 -07:00
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-15 01:44:34 -07:00
local skyDmg = Combat.healthFor("BlueSky") * 0.925
local wingDmg = Combat.healthFor("BluePidgeot")
2015-04-06 01:18:46 -07:00
if Strategies.initialize() then
Strategies.setYolo("blue")
2015-04-15 01:44:34 -07:00
local curr_hp, red_hp = Combat.hp(), Combat.redHP()
if Control.yolo and curr_hp < red_hp + 30 then
local message
if curr_hp > wingDmg then
message = "is skipping potioning"
else
message = "is using limited potions"
end
message = message.." to attempt to red-bar off Pidgeot"
Bridge.chat(message)
2015-04-15 01:44:34 -07:00
end
2015-04-06 00:50:00 -07:00
end
2015-04-15 01:44:34 -07:00
2015-04-14 14:48:39 -07:00
return strategyFunctions.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
if not status.skyAttacked then
status.skyAttacked = true
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
-- 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
2015-04-16 12:34:13 -07:00
local attDV, defDV, spdDV, sclDV = Pokemon.getDVs("nidoking")
p(attDV, defDV, spdDV, sclDV)
stats.nidoran = {
attack = 55,
defense = 45,
speed = 50,
special = 45,
rating = 1,
2015-04-16 12:34:13 -07:00
attackDV = attDV,
defenseDV = defDV,
2015-04-16 12:34:13 -07:00
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