diff --git a/ai/red/strategies.lua b/ai/red/strategies.lua index f67e442..5eb7006 100644 --- a/ai/red/strategies.lua +++ b/ai/red/strategies.lua @@ -1192,32 +1192,6 @@ strategyFunctions.procureBicycle = function() end end -strategyFunctions.swapBicycle = function() - local bicycleIdx = Inventory.indexOf("bicycle") - if bicycleIdx < 3 then - return true - end - local main = Memory.value("menu", "main") - if main == 128 then - if Menu.getCol() ~= 5 then - Menu.select(2, true) - else - local selection = Memory.value("menu", "selection_mode") - if selection == 0 then - if Menu.select(0, "accelerate", true, nil, true) then - Input.press("Select") - end - else - if Menu.select(bicycleIdx, "accelerate", true, nil, true) then - Input.press("Select") - end - end - end - else - Menu.pause() - end -end - strategyFunctions.redbarCubone = function() if Battle.isActive() then local forced @@ -1338,32 +1312,6 @@ strategyFunctions.deptElevator = function() end end -strategyFunctions.swapRepels = function() - local repelIdx = Inventory.indexOf("super_repel") - if repelIdx < 3 then - return true - end - local main = Memory.value("menu", "main") - if main == 128 then - if Menu.getCol() ~= 5 then - Menu.select(2, true) - else - local selection = Memory.value("menu", "selection_mode") - if selection == 0 then - if Menu.select(1, "accelerate", true, nil, true) then - Input.press("Select") - end - else - if Menu.select(repelIdx, "accelerate", true, nil, true) then - Input.press("Select") - end - end - end - else - Menu.pause() - end -end - -- 8: FLY strategyFunctions.lavenderRival = function() @@ -1435,6 +1383,11 @@ 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 + -- playPokeflute strategyFunctions.drivebyRareCandy = function() @@ -1534,6 +1487,11 @@ strategyFunctions.silphCarbos = function() return Strategies.functions.interact({dir="Left"}) end +strategyFunctions.swapXSpecials = function() + local destination = Inventory.contains("ether") and 5 or 6 + return strategyFunctions.swap({item="x_special", dest=destination, chain=true}) +end + strategyFunctions.silphRival = function() if Battle.isActive() then if Strategies.initialize() then diff --git a/ai/strategies.lua b/ai/strategies.lua index 39b6e3b..558dd0b 100644 --- a/ai/strategies.lua +++ b/ai/strategies.lua @@ -563,6 +563,44 @@ Strategies.functions = { end end, + swap = function(data) + if Strategies.initialize() then + if not Inventory.contains(data.item) then + return true + end + end + local itemIndex = Inventory.indexOf(data.item) + local destIndex = data.dest + if type(destIndex) == "string" then + destIndex = Inventory.indexOf(destIndex) + end + if itemIndex == destIndex then + if Strategies.closeMenuFor(data) then + return true + end + else + local main = Memory.value("menu", "main") + if main == 128 then + if Menu.getCol() ~= 5 then + Menu.select(2, true) + else + local selection = Memory.value("menu", "selection_mode") + if selection == 0 then + if Menu.select(destIndex, "accelerate", true, nil, true) then + Input.press("Select") + end + else + if Menu.select(itemIndex, "accelerate", true, nil, true) then + Input.press("Select") + end + end + end + else + Menu.pause() + end + end + end, + wait = function() print("Please save state") Input.press("Start", 999999999) diff --git a/data/red/paths.lua b/data/red/paths.lua index 6153221..44c3279 100644 --- a/data/red/paths.lua +++ b/data/red/paths.lua @@ -149,7 +149,7 @@ local Paths = { -- First deck {95, {27,0}, {27,1}, {26,1}, {26,7}, {2,7}, {2,6}}, -- Rival 3 - {96, {2,4}, {2,11}, {3,11}, {3,12}, {37,12}, {37,9}, {s="potion",hp=23,yolo=16,chain=true}, {s="teach",move="bubblebeam",replace="tackle",close=true}, {37,8}, {s="rivalSandAttack"}, {37,5}, {36,5}, {36,4}}, + {96, {2,4}, {2,11}, {3,11}, {3,12}, {37,12}, {37,9}, {s="swap",item="potion",dest=2,chain=true}, {s="potion",hp=23,yolo=16,chain=true}, {s="teach",move="bubblebeam",replace="tackle",close=true}, {37,8}, {s="rivalSandAttack"}, {37,5}, {36,5}, {36,4}}, -- Old man Cut {101, {0,7}, {0,4}, {4,4}, {4,3}, {s="interact",dir="Up"}, {4,5}, {0,5}, {0,7}}, -- Second deck out @@ -159,7 +159,7 @@ local Paths = { -- Departure {94, {14,2}}, -- To Surge - {5, {18,29}, {18,26}, {30,26}, {30,14}, {15,14}, {15,17}, {s="potionBeforeSurge"}, {s="teach",move="cut",poke="oddish",alt="paras",chain=true}, {s="skill",move="cut",done=0x0D4D}, {15,20}, {12,20}, {12,19}}, + {5, {18,29}, {18,26}, {30,26}, {30,14}, {15,14}, {15,17}, {s="potionBeforeSurge"}, {s="swap",item="repel",dest=0,chain=true}, {s="teach",move="cut",poke="oddish",alt="paras",chain=true}, {s="teach",move="dig",poke="paras",alt="squirtle",chain=true}, {s="skill",move="cut",done=0x0D4D}, {15,20}, {12,20}, {12,19}}, -- Trashcans {92, {4,17}, {c="a",a="Surge's Gym"}, {4,16}, {2,16}, {2,11}, {s="trashcans"}, {4,6}, {4,3}, {5,3}, {5,2}, {s="interact",dir="Up"}, {s="fightSurge"}, {s="split"}, {4,2}, {4,13}, {5,13}, {5,18}}, @@ -168,13 +168,13 @@ local Paths = { -- To bicycle house {5, {12,20}, {c="a",a="Bicycle Shop"}, {15,20}, {15,19}, {s="skill",move="cut",done=0x0D4D}, {15,14}, {9,14}, {9,13}}, -- Bicycle cert - {90, {2,7}, {2,5}, {0,5}, {0,1}, {2,1}, {s="confirm",dir="Right"}, {s="teach",move="dig",poke="paras",alt="squirtle",chain=true}, {s="skill",move="dig",map=90}}, + {90, {2,7}, {2,5}, {0,5}, {0,1}, {2,1}, {s="confirm",dir="Right"}, {s="skill",move="dig",map=90}}, -- Cerulean warp {3, {19,18}, {19,23}, {16,23}, {16,26}, {13,26}, {13,25}}, -- Bicycle shop {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}}, + {3, {13,26}, {s="swap",item="bicycle",dest=1,chain=true}, {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 {20, {0,8}, {c="a",a="Route 9"}, {4,8}, {s="skill",move="cut",done=0x0C17,val=2}, {13,8}, {13,9}, {s="interact",dir="Down"}, {12,9}, {12,12}, {23,12}, {23,11}, {29,11}, {29,12}, {41,12}, {41,10}, {40,10}, {40,9}, {s="interact",dir="Up"}, {41,9}, {41,6}, {39,6}, {39,4}, {45,4}, {45,3}, {51,3}, {51,8}, {60,8}}, -- To the cave @@ -237,7 +237,7 @@ local Paths = { -- 9: FLY -- Fly to Lavender - {27, {7,6}, {s="swapRepels"}, {s="teach",move="fly",poke="spearow",alt="pidgey",chain=true}, {s="teach",move="horn_drill",replace="bubblebeam",chain=true}, {s="item",item="super_repel",chain=true}, {s="potion",hp=10,chain=true}, {s="teach",move="rock_slide",replace="poison_sting",chain=true}, {s="fly",dest="lavender",map=4}}, + {27, {7,6}, {s="swap",item="super_repel",dest=1,chain=true}, {s="potion",hp=10,chain=true}, {s="teach",move="horn_drill",replace="bubblebeam",chain=true}, {s="item",item="super_repel",chain=true}, {s="swap",item="x_accuracy",dest=2,chain=true}, {s="teach",move="fly",poke="spearow",alt="pidgey",chain=true}, {s="teach",move="rock_slide",replace="poison_sting",chain=true}, {s="fly",dest="lavender",map=4}}, -- To the tower {4, {3,6}, {c="a",a="Pokemon Tower"}, {14,6}, {14,5}}, -- Pokemon Tower @@ -268,7 +268,7 @@ local Paths = { -- Leave Celadon {6, {41,10}, {c="a",a="Snorlax"}, {s="item",item="super_repel",chain=true}, {s="bicycle"}, {41,11}, {14,11}, {14,14}, {2,14}, {2,18}, {-1,18}}, -- トトロだ! - {27, {39,10}, {27,10}, {s="playPokeflute"}, {23,10}}, + {27, {39,10}, {27,10}, {s="swapXSpeeds"}, {s="playPokeflute"}, {23,10}}, -- Snorlax pass {186, {7,8}, {-1,8}}, -- Bicycle road @@ -312,7 +312,7 @@ local Paths = { -- Elivator {236, {1,3}, {1,2}, {3,2}, {3,1}, {s="silphElevator"}, {2,1}, {2,4}}, -- F10 - {234, {12,1}, {12,3}, {4,3}, {4,9}, {s="fightSilphMachoke"}, {6,9}, {6,11}, {6,14}, {s="silphCarbos"}, {6,16}, {3,16}, {3,14}, {s="interact",dir="Right"}, {3,15}, {1,15}, {s="item",item="carbos",poke="nidoking",full=true}, {1,12}, {s="interact",dir="Right"}, {1,16}, {3,16}, {s="teach",move="surf",poke="squirtle",replace="tail_whip",chain=true}, {s="teach",move="earthquake",replace="thrash",chain=true}, {s="item",item="carbos",poke="nidoking",close=true}, {6,16}, {6,9}, {4,9}, {4,1}, {8,1}, {8,0}}, + {234, {12,1}, {12,3}, {4,3}, {4,9}, {s="fightSilphMachoke"}, {6,9}, {6,11}, {s="silphCarbos"}, {6,16}, {3,16}, {3,14}, {s="interact",dir="Right"}, {3,15}, {1,15}, {1,13}, {s="item",item="carbos",poke="nidoking",full=true}, {1,12}, {s="interact",dir="Right"}, {1,16}, {3,16}, {s="swapXSpecials"}, {s="teach",move="surf",poke="squirtle",replace="tail_whip",chain=true}, {s="teach",move="earthquake",replace="thrash",chain=true}, {s="item",item="carbos",poke="nidoking",close=true}, {6,16}, {6,9}, {4,9}, {4,1}, {8,1}, {8,0}}, -- F9 {233, {14,1}, {14,3}, {24,3}, {24,16}, {17,16}, {17,15}}, -- Warped