From ef01ba5c73b48faac5ca422b67b106d2809da809 Mon Sep 17 00:00:00 2001 From: Kyle Coburn Date: Sat, 11 Apr 2015 10:34:58 -0700 Subject: [PATCH] Standardize tossing, add toss before Max Ether --- ai/red/strategies.lua | 31 +++++++++++++++++++------------ ai/strategies.lua | 16 ++++++++++++++++ data/red/paths.lua | 4 ++-- 3 files changed, 37 insertions(+), 14 deletions(-) diff --git a/ai/red/strategies.lua b/ai/red/strategies.lua index b66101c..5aa5f3c 100644 --- a/ai/red/strategies.lua +++ b/ai/red/strategies.lua @@ -1435,17 +1435,11 @@ strategyFunctions.drivebyRareCandy = function() end end -strategyFunctions.tossAntidote = function() +strategyFunctions.tossInSafari = function() if Inventory.count() <= (Inventory.contains("full_restore") and 18 or 17) then return true end - local tossItem = Inventory.contains("antidote", "pokeball") - if Strategies.initialize() then - p("Tossing "..tossItem.." to make space", Inventory.count()) - end - if not Inventory.useItemOption(tossItem, nil, 1) then - Input.press("A") - end + return Strategies.tossItem("antidote", "pokeball") end strategyFunctions.safariCarbos = function() @@ -1964,6 +1958,7 @@ strategyFunctions.ether = function(data) if Strategies.closeMenuFor(data) then return true end + print("No Ether - "..Control.areaName) return false end end @@ -1983,18 +1978,30 @@ strategyFunctions.ether = function(data) 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() if Strategies.initialize() then - if maxEtherSkip and Inventory.count("ether") + Inventory.count("elixer") >= 2 then + if maxEtherSkip and (Inventory.count("ether") + Inventory.count("elixer") >= 2) then + return true + end + if Inventory.isFull() then return true end end if Inventory.contains("max_ether") then return true end - if Inventory.isFull() then - return true --TODO toss - end local px, py = Player.position() if px > 7 then return Strategies.reset("Accidentally walked on the island :(", px, true) diff --git a/ai/strategies.lua b/ai/strategies.lua index 51f02a9..e4e5144 100644 --- a/ai/strategies.lua +++ b/ai/strategies.lua @@ -281,6 +281,22 @@ function Strategies.useItem(data) end end +function Strategies.tossItem(...) + if not Inventory.isFull() then + return true + end + local tossItem = Inventory.contains(...) + if tossItem ~= status.toss then + status.toss = tossItem + p("Tossing "..tossItem.." to make space", Inventory.count()) + end + if not Inventory.useItemOption(tossItem, nil, 1) then + if Menu.pause() then + Input.press("A") + end + end +end + local function completedSkillFor(data) if data.map then if data.map ~= Memory.value("game", "map") then diff --git a/data/red/paths.lua b/data/red/paths.lua index a58cd9e..9578d1d 100644 --- a/data/red/paths.lua +++ b/data/red/paths.lua @@ -288,7 +288,7 @@ local Paths = { -- Safari 1 {220, {15,25}, {s="bicycle"}, {15,16}, {28,16}, {28,11}, {30,11}}, -- Safari 2 - {217, {0,23}, {4,23}, {4,24}, {20,24}, {20,20}, {s="safariCarbos"}, {12,20}, {12,22}, {11,22}, {10,22}, {s="item",item="super_repel",chain=true}, {s="tossAntidote"}, {s="item",item="carbos",poke="nidoking",close=true}, {9,22}, {9,8}, {12,8}, {12,6}, {17,6}, {17,8}, {20,8}, {s="centerSkipFullRestore"}, {20,3}, {7,3}, {7,5}, {-1,5}}, + {217, {0,23}, {4,23}, {4,24}, {20,24}, {20,20}, {s="safariCarbos"}, {12,20}, {12,22}, {11,22}, {10,22}, {s="item",item="super_repel",chain=true}, {s="tossInSafari"}, {s="item",item="carbos",poke="nidoking",close=true}, {9,22}, {9,8}, {12,8}, {12,6}, {17,6}, {17,8}, {20,8}, {s="centerSkipFullRestore"}, {20,3}, {7,3}, {7,5}, {-1,5}}, -- Safari 3 {218, {39,31}, {22,31}, {22,22}, {16,22}, {16,28}, {13,28}, {13,9}, {28,9}, {28,3}, {3,3}, {3,36}}, -- Safari 4 @@ -413,7 +413,7 @@ local Paths = { -- Pokemon League 1 {193, {4,7}, {4,0}}, -- PL 2 - {34, {7,139}, {s="checkEther"}, {s="ether",max=true,chain=true}, {s="bicycle"}, {7,132}, {14,132}, {14,124}, {9,124}, {9,116}, {10,116}, {10,104}, {s="skill",move="surf",y=103}, {10,92}, {7,92}, {7,90}, {s="grabMaxEther"}, {7,72}, {8,72}, {8,71}, {s="item",item="super_repel",chain=true}, {s="bicycle"}, {8,66}, {10,66}, {10,57}, {12,57}, {12,48}, {6,48}, {6,32}, {4,32}, {4,31}}, + {34, {7,139}, {s="checkEther"}, {s="ether",max=true,chain=true}, {s="tossInVictoryRoad"}, {s="bicycle"}, {7,132}, {14,132}, {14,124}, {9,124}, {9,116}, {10,116}, {10,104}, {s="skill",move="surf",y=103}, {10,92}, {7,92}, {7,90}, {s="grabMaxEther"}, {7,72}, {8,72}, {8,71}, {s="item",item="super_repel",chain=true}, {s="bicycle"}, {8,66}, {10,66}, {10,57}, {12,57}, {12,48}, {6,48}, {6,32}, {4,32}, {4,31}}, -- Victory Road {108, {8,17}, {c="a",a="Victory Road"}, {s="tweetVictoryRoad"}, {8,16}, {4,16}, {4,14}, {5,14}, {s="skill",move="strength"}, {5,15}, {4,15}, {4,16}, {7,16}, {s="push",dir="Right",x=0x0255,y=0x0254}, {7,17}, {9,17}, {9,15}, {8,15}, {8,14}, {15,14}, {15,15}, {16,15}, {16,14}, {s="push",dir="Up",x=0x0255,y=0x0254}, {14,14}, {14,12}, {16,12}, {16,11}, {17,11}, {17,12}, {14,12}, {14,14}, {8,14}, {8,16}, {5,16}, {5,12}, {11,12}, {11,6}, {7,6}, {7,8}, {3,8}, {3,5}, {2,5}, {2,1}, {1,1}}, -- F2