Update dept store movement, add confusion sacrifice to Misty fight, rename shopping strategies for consistency
This commit is contained in:
parent
c7b8f1190b
commit
2764fb9ccf
|
@ -1 +1,2 @@
|
|||
stream/*
|
||||
.dropbox
|
||||
|
|
|
@ -74,5 +74,4 @@ function textbox.handle()
|
|||
input.cancel()
|
||||
end
|
||||
|
||||
|
||||
return textbox
|
||||
|
|
|
@ -96,8 +96,8 @@ local function calcDamage(move, attacker, defender, rng)
|
|||
end
|
||||
|
||||
local function getOpponentType(ty)
|
||||
local t1= types[memory.value("battle", "opponent_type1")]
|
||||
if ty~=0 then
|
||||
local t1 = types[memory.value("battle", "opponent_type1")]
|
||||
if ty ~= 0 then
|
||||
t1 = types[memory.value("battle", "opponent_type2")]
|
||||
if not t1 then
|
||||
return memory.value("battle", "opponent_type2")
|
||||
|
@ -291,6 +291,11 @@ local function isSleeping()
|
|||
end
|
||||
combat.isSleeping = isSleeping
|
||||
|
||||
local function isConfused()
|
||||
return memory.raw(0x106B) > 0
|
||||
end
|
||||
combat.isConfused = isConfused
|
||||
|
||||
-- Combat AI
|
||||
|
||||
function combat.factorPP(enabled)
|
||||
|
@ -319,7 +324,7 @@ function combat.inKillRange(draw)
|
|||
gui.text(0, 28, turnsToDie.." "..ours.hp.." | "..turnsToKill.." "..enemy.hp)
|
||||
end
|
||||
local hpReq = enemyAttack.damage
|
||||
local isConfused = memory.value("battle", "confused") > 0
|
||||
local isConfused = isConfused()
|
||||
if (isConfused) then
|
||||
hpReq = hpReq + math.floor(ours.hp * 0.2)
|
||||
end
|
||||
|
|
|
@ -12,14 +12,13 @@ local utils = require "util.utils"
|
|||
local inventory = require "storage.inventory"
|
||||
local pokemon = require "storage.pokemon"
|
||||
|
||||
local game_controls
|
||||
local potionInBattle = true
|
||||
local fightEncounter, caveFights = 0, 0
|
||||
local encounters = 0
|
||||
|
||||
local shouldFight, minExp
|
||||
local shouldCatch, attackIdx
|
||||
local encounters = 0, extraEncounter
|
||||
local potionInBattle = true
|
||||
local fightEncounter, caveFights = 0, 0
|
||||
local maxEncounters
|
||||
local extraEncounter, maxEncounters
|
||||
local isYolo, battleYolo
|
||||
|
||||
local function battlePotion(enable)
|
||||
|
@ -55,7 +54,7 @@ local controlFunctions = {
|
|||
shouldFight = nil
|
||||
end,
|
||||
|
||||
-- RED
|
||||
-- RED
|
||||
|
||||
viridianExp = function()
|
||||
minExp = 210
|
||||
|
@ -115,7 +114,6 @@ local function isNewFight()
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
function control.shouldFight()
|
||||
if (not shouldFight) then
|
||||
return false
|
||||
|
|
|
@ -793,7 +793,7 @@ strategyFunctions = {
|
|||
return dodgeUp(0x0223, 14, 14, 15, 7)
|
||||
end,
|
||||
|
||||
viridianBuyPokeballs = function()
|
||||
shopViridianPokeballs = function()
|
||||
return shop.transaction{
|
||||
buy = {{name="pokeball", index=0, amount=8}}
|
||||
}
|
||||
|
@ -895,7 +895,8 @@ strategyFunctions = {
|
|||
|
||||
grabForestPotion = function()
|
||||
if (inventory.contains("potion")) then
|
||||
if (pokemon.info("squirtle", "hp") <= 10) then
|
||||
local healthNeeded = (pokemon.info("spearow", "level") == 3) and 6 or 10
|
||||
if (pokemon.info("squirtle", "hp") <= healthNeeded) then
|
||||
if (menu.pause()) then
|
||||
inventory.use("potion", "squirtle")
|
||||
end
|
||||
|
@ -1107,9 +1108,9 @@ strategyFunctions = {
|
|||
|
||||
-- 2: BROCK
|
||||
|
||||
pewterMart = function()
|
||||
shopPewterMart = function()
|
||||
return shop.transaction{
|
||||
buy = {{name="potion", index=1, amount=7}, {name="escape_rope", index=2}}
|
||||
buy = {{name="potion", index=1, amount=8}}
|
||||
}
|
||||
end,
|
||||
|
||||
|
@ -1157,7 +1158,8 @@ strategyFunctions = {
|
|||
end,
|
||||
|
||||
shortsKid = function()
|
||||
control.battlePotion(not pokemon.isOpponent("rattata") or damaged(2))
|
||||
local fightingEkans = pokemon.isOpponent("ekans")
|
||||
control.battlePotion(fightingEkans or damaged(2))
|
||||
return strategyFunctions.leer({{"rattata",9}, {"ekans",10}})
|
||||
end,
|
||||
|
||||
|
@ -1495,7 +1497,6 @@ strategyFunctions = {
|
|||
else
|
||||
textbox.handle()
|
||||
end
|
||||
|
||||
end,
|
||||
|
||||
potionBeforeGoldeen = function()
|
||||
|
@ -1528,6 +1529,24 @@ strategyFunctions = {
|
|||
return strategyFunctions.potion({hp=healAmount})
|
||||
end,
|
||||
|
||||
fightMisty = function()
|
||||
if (battle.isActive()) then
|
||||
canProgress = true
|
||||
if (pokemon.isDeployed("nidoking") and combat.isConfused()) then
|
||||
local sacrifice = pokemon.inParty("paras", "pidgey", "spearow")
|
||||
if (sacrifice and pokemon.info(sacrifice, "hp") > 0) then
|
||||
battle.swap(sacrifice)
|
||||
return false
|
||||
end
|
||||
end
|
||||
battle.automate()
|
||||
elseif (canProgress) then
|
||||
return true
|
||||
else
|
||||
textbox.handle()
|
||||
end
|
||||
end,
|
||||
|
||||
-- 6: MISTY
|
||||
|
||||
potionBeforeRocket = function()
|
||||
|
@ -1621,7 +1640,7 @@ strategyFunctions = {
|
|||
end
|
||||
end,
|
||||
|
||||
vermilionMart = function()
|
||||
shopVermilionMart = function()
|
||||
if (initialize()) then
|
||||
setYolo("vermilion")
|
||||
end
|
||||
|
@ -1639,6 +1658,8 @@ strategyFunctions = {
|
|||
}
|
||||
end,
|
||||
|
||||
-- rivalSandAttack
|
||||
|
||||
trashcans = function()
|
||||
local progress = memory.value("progress", "trashcans")
|
||||
if (textbox.isActive()) then
|
||||
|
@ -1759,26 +1780,6 @@ strategyFunctions = {
|
|||
|
||||
-- 7: SURGE
|
||||
|
||||
dodgeBicycleGirlRight = function()
|
||||
return dodgeH{
|
||||
npc = 0x0222,
|
||||
sx = 4, sy = 5,
|
||||
dodge = 4,
|
||||
offset = -2
|
||||
}
|
||||
end,
|
||||
|
||||
dodgeBicycleGirlLeft = function()
|
||||
return dodgeH{
|
||||
npc = 0x0222,
|
||||
sx = 4, sy = 4,
|
||||
dodge = 5,
|
||||
offset = -2,
|
||||
dist = 0,
|
||||
left = true
|
||||
}
|
||||
end,
|
||||
|
||||
procureBicycle = function()
|
||||
if (inventory.contains("bicycle")) then
|
||||
if (not textbox.isActive()) then
|
||||
|
@ -1786,7 +1787,7 @@ strategyFunctions = {
|
|||
end
|
||||
input.cancel()
|
||||
elseif (textbox.handle()) then
|
||||
player.interact("Up")
|
||||
player.interact("Right")
|
||||
end
|
||||
end,
|
||||
|
||||
|
@ -1847,6 +1848,20 @@ strategyFunctions = {
|
|||
end
|
||||
end,
|
||||
|
||||
shopTM07 = function()
|
||||
return shop.transaction{
|
||||
direction = "Up",
|
||||
buy = {{name="horn_drill", index=3}}
|
||||
}
|
||||
end,
|
||||
|
||||
shopRepels = function()
|
||||
return shop.transaction{
|
||||
direction = "Up",
|
||||
buy = {{name="super_repel", index=3, amount=9}}
|
||||
}
|
||||
end,
|
||||
|
||||
shopPokeDoll = function()
|
||||
return shop.transaction{
|
||||
direction = "Down",
|
||||
|
@ -1854,28 +1869,6 @@ strategyFunctions = {
|
|||
}
|
||||
end,
|
||||
|
||||
shopBuffs = function()
|
||||
local minSpecial = 45
|
||||
if (yolo) then
|
||||
minSpecial = minSpecial - 1
|
||||
end
|
||||
if (nidoAttack >= 54 and nidoSpecial >= minSpecial) then
|
||||
riskGiovanni = true
|
||||
print("Giovanni skip strats!")
|
||||
end
|
||||
|
||||
local xspecAmt = 4
|
||||
if (riskGiovanni) then
|
||||
xspecAmt = xspecAmt + 1
|
||||
elseif (nidoSpecial < 46) then
|
||||
xspecAmt = xspecAmt - 1
|
||||
end
|
||||
return shop.transaction{
|
||||
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,
|
||||
|
||||
shopVending = function()
|
||||
return shop.vend{
|
||||
direction = "Up",
|
||||
|
@ -1907,18 +1900,40 @@ strategyFunctions = {
|
|||
}
|
||||
end,
|
||||
|
||||
shopTM07 = function()
|
||||
shopBuffs = function()
|
||||
if (initialize()) then
|
||||
local minSpecial = 45
|
||||
if (yolo) then
|
||||
minSpecial = minSpecial - 1
|
||||
end
|
||||
if (nidoAttack >= 54 and nidoSpecial >= minSpecial) then
|
||||
riskGiovanni = true
|
||||
print("Giovanni skip strats!")
|
||||
end
|
||||
end
|
||||
|
||||
local xspecAmt = 4
|
||||
if (riskGiovanni) then
|
||||
xspecAmt = xspecAmt + 1
|
||||
elseif (nidoSpecial < 46) then
|
||||
xspecAmt = xspecAmt - 1
|
||||
end
|
||||
return shop.transaction{
|
||||
direction = "Up",
|
||||
buy = {{name="horn_drill", index=3}}
|
||||
buy = {{name="x_accuracy", index=0, amount=10}, {name="x_speed", index=5, amount=4}, {name="x_special", index=6, amount=xspecAmt}}
|
||||
}
|
||||
end,
|
||||
|
||||
shopRepels = function()
|
||||
return shop.transaction{
|
||||
direction = "Up",
|
||||
buy = {{name="super_repel", index=3, amount=9}}
|
||||
}
|
||||
deptElevator = function()
|
||||
if (textbox.isActive()) then
|
||||
canProgress = true
|
||||
menu.select(0, false)
|
||||
else
|
||||
if (canProgress) then
|
||||
return true
|
||||
end
|
||||
player.interact("Up")
|
||||
end
|
||||
end,
|
||||
|
||||
swapRepels = function()
|
||||
|
@ -2588,7 +2603,7 @@ strategyFunctions = {
|
|||
end
|
||||
end,
|
||||
|
||||
agatha = function()
|
||||
agatha = function() --TODO test without x acc
|
||||
if (battle.isActive()) then
|
||||
canProgress = true
|
||||
if (combat.isSleeping()) then
|
||||
|
@ -2597,6 +2612,7 @@ strategyFunctions = {
|
|||
end
|
||||
if (pokemon.isOpponent("gengar")) then
|
||||
local currentHP = pokemon.info("nidoking", "hp")
|
||||
-- if (not yolo and currentHP <= 56 and not isPrepared("x_speed")) then
|
||||
if (not yolo and currentHP <= 56 and not isPrepared("x_accuracy", "x_speed")) then
|
||||
local toPotion = inventory.contains("full_restore", "super_potion")
|
||||
if (toPotion) then
|
||||
|
@ -2604,6 +2620,7 @@ strategyFunctions = {
|
|||
return false
|
||||
end
|
||||
end
|
||||
-- if (not prepare("x_speed")) then
|
||||
if (not prepare("x_accuracy", "x_speed")) then
|
||||
return false
|
||||
end
|
||||
|
@ -2664,7 +2681,7 @@ strategyFunctions = {
|
|||
print(tempDir.." strats")
|
||||
tempDir = "x_speed" -- TODO find min stats, remove override
|
||||
end
|
||||
if (prepare("x_accuracy", "x_speed")) then
|
||||
if (prepare("x_accuracy", tempDir)) then
|
||||
local forced = "horn_drill"
|
||||
if (pokemon.isOpponent("alakazam")) then
|
||||
if (tempDir == "x_speed") then
|
||||
|
|
|
@ -33,7 +33,7 @@ local paths = {
|
|||
-- Back to the Mart
|
||||
{1, {21,35}, {21,30}, {19,30}, {19,20}, {29,20}, {29,19}},
|
||||
-- Viridian Mart redux
|
||||
{42, {3,7}, {3,5}, {2,5}, {s="viridianBuyPokeballs"}, {3,5}, {3,8}},
|
||||
{42, {3,7}, {3,5}, {2,5}, {s="shopViridianPokeballs"}, {3,5}, {3,8}},
|
||||
-- Sidequest
|
||||
{1, {29,20}, {15,20}, {15,17}, {-1, 17}},
|
||||
-- Nidoran
|
||||
|
@ -63,7 +63,7 @@ local paths = {
|
|||
-- To Pewter Mart
|
||||
{2, {16,18}, {c="potion",b=true}, {10,18}, {10,13}, {21,13}, {21,18}, {23,18}, {23,17}},
|
||||
-- Pewter Mart
|
||||
{56, {3,7}, {3,5}, {2,5}, {s="pewterMart"}, {2,6}, {3,6}, {3,8}},
|
||||
{56, {3,7}, {3,5}, {2,5}, {s="shopPewterMart"}, {2,6}, {3,6}, {3,8}},
|
||||
-- Leaving Pewter City
|
||||
{2, {23,18}, {40,18}},
|
||||
-- Route 3
|
||||
|
@ -78,7 +78,7 @@ local paths = {
|
|||
-- 4: ROUTE 3
|
||||
|
||||
-- Mt. Moon F1
|
||||
{59, {14,35}, {s="startMtMoon"}, {c="catchParas"}, {14,22}, {21,22}, {21,15}, {24,15}, {24,27}, {25,27}, {25,31}, {s="interact",dir="Left"}, {25,32}, {33,32}, {33,31}, {34,31}, {s="interact",dir="Right"}, {34,7}, {30,7}, {s="evolveNidorino"}, {c="moon1Exp"}, {28,7}, {16,7}, {16,17}, {2,17}, {2,3}, {s="interact",dir="Up"}, {5,3}, {5,5}},
|
||||
{59, {14,35}, {s="startMtMoon"}, {c="catchParas"}, {14,22}, {21,22}, {21,15}, {24,15}, {24,27}, {25,27}, {25,31}, {s="interact",dir="Left"}, {25,32}, {33,32}, {33,31}, {34,31}, {s="interact",dir="Right"}, {35,31}, {35,23}, {s="interact",dir="Right"}, {35,7}, {30,7}, {s="evolveNidorino"}, {c="moon1Exp"}, {28,7}, {16,7}, {16,17}, {2,17}, {2,3}, {s="interact",dir="Up"}, {5,3}, {5,5}},
|
||||
-- Mt. Moon B2
|
||||
{60, {5,5}, {5,17}, {21,17}},
|
||||
-- Mt. Moon B3
|
||||
|
@ -116,7 +116,7 @@ local paths = {
|
|||
-- To Misty
|
||||
{3, {19,18}, {19,20}, {30,20}, {30,19}},
|
||||
-- Misty
|
||||
{65, {4,13}, {s="a",a="Misty's Gym"}, {c="potion",b=false}, {4,8}, {2,8}, {2,5}, {7,5}, {7,3}, {6,3}, {5,3}, {s="waitToFight"}, {s="potionBeforeMisty"}, {5,2}, {s="waitToFight",dir="Left"}, {s="split"}, {s="tweetMisty"}, {5,3}, {7,3}, {7,5}, {5,5}, {5,14}},
|
||||
{65, {4,13}, {s="a",a="Misty's Gym"}, {c="potion",b=false}, {4,8}, {2,8}, {2,5}, {7,5}, {7,3}, {6,3}, {5,3}, {s="waitToFight"}, {s="potionBeforeMisty"}, {5,2}, {s="interact",dir="Left"}, {s="fightMisty"}, {s="split"}, {s="tweetMisty"}, {5,3}, {7,3}, {7,5}, {5,5}, {5,14}},
|
||||
|
||||
-- 7: MISTY
|
||||
|
||||
|
@ -140,7 +140,7 @@ local paths = {
|
|||
{5, {19,0}, {c="disableCatch"}, {19,6}, {21,6}, {21,14}, {23,14}, {23,13}},
|
||||
-- Vermilion mart
|
||||
-- TODO Bubblebeam split?
|
||||
{91, {3,7}, {3,5}, {2,5}, {s="vermilionMart"}, {3,5}, {s="teach",move="bubblebeam",replace="tackle"}, {3,8}},
|
||||
{91, {3,7}, {3,5}, {2,5}, {s="shopVermilionMart"}, {3,5}, {s="teach",move="bubblebeam",replace="tackle"}, {3,8}},
|
||||
-- To S.S. Anne
|
||||
{5, {23,14}, {30,14}, {30,26}, {18,26}, {18,31}},
|
||||
-- Mew
|
||||
|
@ -171,7 +171,7 @@ local paths = {
|
|||
-- Cerulean warp
|
||||
{3, {19,18}, {19,23}, {16,23}, {16,26}, {13,26}, {13,25}},
|
||||
-- Bicycle shop
|
||||
{66, {2,7}, {2,5}, {4,5}, {s="dodgeBicycleGirlRight"}, {6,4}, {6,4}, {s="procureBicycle"}, {s="dodgeBicycleGirlLeft"}, {3,8}},
|
||||
{66, {2,7}, {2,3}, {4,3}, {4,2}, {s="procureBicycle"}, {4,7}, {3,7}, {3,8}},
|
||||
-- Bicycle out of Cerulean
|
||||
{3, {13,26}, {s="swapBicycle"}, {s="teach",move="thunderbolt",replace="horn_attack",chain=true}, {s="bicycle"}, {19,26}, {19,27}, {s="skill",move="cut",done=0x0D4D}, {19,29}, {36,29}, {36,16}, {40,16}},
|
||||
-- TPP's Bane
|
||||
|
@ -204,31 +204,26 @@ local paths = {
|
|||
{18, {5,14}, {s="bicycle"}, {8,14}, {8,8}, {4,8}, {4,3}, {-1,3}},
|
||||
-- Celadon
|
||||
{6, {49,11}, {s="a",a="Celadon Mart"}, {14,11}, {14,14}, {10,14}, {10,13}},
|
||||
-- Department store
|
||||
--TODO elevator down
|
||||
-- F1: Department store
|
||||
{122, {16,7}, {c="potion",b=true,yolo=true}, {c="pp",on=true}, {16,3}, {12,3}, {12,1}},
|
||||
-- F2
|
||||
{123, {12,2}, {16,2}, {16,1}},
|
||||
{123, {12,2}, {8,2}, {8,5}, {6,5}, {s="shopTM07"}, {5,5}, {s="shopRepels"}, {15,5}, {15,2}, {16,2}, {16,1}},
|
||||
-- F3
|
||||
{124, {16,2}, {12,2}, {12,1}},
|
||||
-- F4: Poke Doll
|
||||
{125, {12,2}, {10,2}, {10,5}, {5,5}, {s="shopPokeDoll"}, {11,5}, {11,2}, {16,2}, {16,1}},
|
||||
-- F5: Buffs
|
||||
{136, {16,2}, {8,2}, {8,5}, {5,5}, {s="shopBuffs"}, {9,5}, {9,2}, {12,2}, {12,1}},
|
||||
-- F5
|
||||
{136, {16,2}, {12,2}, {12,1}},
|
||||
-- Roof
|
||||
{126, {15,3}, {12,3}, {s="shopVending"}, {6,3}, {6,4}, {s="giveWater"}, {6,4}, {7,3}, {12,3}, {s="shopExtraWater"}, {15,3}, {15,2}},
|
||||
-- F5
|
||||
{136, {12,2}, {16,2}, {16,1}},
|
||||
-- F4
|
||||
{125, {16,2}, {12,2}, {12,1}},
|
||||
-- F3
|
||||
{124, {12,2}, {16,2}, {16,1}},
|
||||
-- F2: TM and repel
|
||||
{123, {16,2}, {8,2}, {8,5}, {6,5}, {s="shopTM07"}, {5,5}, {s="shopRepels"}, {9,5}, {9,2}, {12,2}, {12,1}},
|
||||
-- Exit department store
|
||||
{122, {12, 2}, {12,6}, {16,6}, {16,8}},
|
||||
-- F5: Buffs
|
||||
{136, {12,2}, {8,2}, {8,5}, {5,5}, {s="shopBuffs"}, {1,5}, {1,1}},
|
||||
-- Elevator
|
||||
{127, {1,3}, {1,2}, {3,2}, {3,1}, {s="deptElevator"}, {2,1}, {2,4}},
|
||||
-- F1: Exit department store
|
||||
{122, {1, 2}, {1,7}, {2,7}, {2,8}},
|
||||
-- Leave Celadon
|
||||
{6, {10,14}, {s="bicycle"}, {10,15}, {2,15}, {2,18}, {-1,18}},
|
||||
{6, {8,14}, {s="bicycle"}, {8,15}, {2,15}, {2,18}, {-1,18}},
|
||||
-- Cut out of Celadon
|
||||
{27, {39,10}, {34,10}, {s="teach",move="horn_drill",replace="bubblebeam",full=true,chain=true}, {s="skill",move="cut",dir="Up",done=0x0D4D}, {34,6}, {27,6}, {27,4}, {23,4}},
|
||||
-- Old man's hall
|
||||
|
|
6
main.lua
6
main.lua
|
@ -11,6 +11,9 @@ local PAINT_ON = true -- Display contextual information while the bot runs
|
|||
local START_WAIT = 99
|
||||
local VERSION = "1.1"
|
||||
|
||||
YELLOW = GAME_NAME == "yellow"
|
||||
INTERNAL = false
|
||||
|
||||
local battle = require "action.battle"
|
||||
local textbox = require "action.textbox"
|
||||
local walk = require "action.walk"
|
||||
|
@ -29,9 +32,6 @@ local settings = require "util.settings"
|
|||
|
||||
local pokemon = require "storage.pokemon"
|
||||
|
||||
YELLOW = GAME_NAME == "yellow"
|
||||
INTERNAL = false
|
||||
|
||||
local hasAlreadyStartedPlaying = false
|
||||
local inBattle, oldSecs
|
||||
local running = true
|
||||
|
|
|
@ -49,7 +49,6 @@ function utils.igt()
|
|||
return secs + mins * 60 + hours * 3600
|
||||
end
|
||||
|
||||
|
||||
function utils.onPokemonSelect(battleMenu)
|
||||
return battleMenu == 8 or battleMenu == 48 or battleMenu == 184 or battleMenu == 224
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue