Standardize move swapping, test swapping Thrash to slot 1

This commit is contained in:
Kyle Coburn 2015-04-16 12:15:50 -07:00
parent ee3babd3db
commit d123cabe75
3 changed files with 27 additions and 15 deletions

View File

@ -111,16 +111,22 @@ Battle.pp = movePP
-- UTILS
function Battle.swapMove(sidx, fidx)
function Battle.swapMove(move, toIndex)
toIndex = toIndex + 1
if openBattleMenu() then
local moveIndex = Pokemon.battleMove(move)
if not moveIndex or moveIndex == toIndex then
return true
end
local selection = Memory.value("menu", "selection_mode")
local swapSelect
if selection == sidx then
swapSelect = fidx
if selection == toIndex then
swapSelect = moveIndex
else
swapSelect = sidx
swapSelect = toIndex
end
if Menu.select(swapSelect, false, false, nil, true, 3) then
local menuSize = Memory.raw(0x101F) == 0 and 3 or 4
if Menu.select(swapSelect, true, false, nil, true, menuSize) then
Input.press("Select")
end
end

View File

@ -749,6 +749,10 @@ Strategies.functions = {
end
end,
swapMove = function(data)
return Battle.swapMove(data.move, data.to)
end,
wait = function()
print("Please save state")
Input.press("Start", 999999999)
@ -904,13 +908,6 @@ Strategies.functions = {
end
end,
swapHornAttack = function()
if Pokemon.battleMove("horn_attack") == 1 then
return true
end
Battle.swapMove(1, 3)
end,
dodgePalletBoy = function()
return Strategies.dodgeUp(0x0223, 14, 14, 15, 7)
end,
@ -1138,8 +1135,17 @@ Strategies.functions = {
nidokingStats()
end
return true
end
end,
swapThrash = function()
if not Battle.isActive() then
if Textbox.handle() and status.canProgress then
return true
end
else
Battle.automate()
status.canProgress = true
return Battle.swapMove("thrash", 0)
end
end,

View File

@ -68,7 +68,7 @@ local Paths = {
-- Leaving Pewter City
{2, {23,18}, {40,18}},
-- Route 3
{14, {0,10}, {c="a",a="Route 3"}, {c="catchFlier"}, {c="pp",on=true}, {s="battleModeSet"}, {8,10}, {8,8}, {11,8}, {11,6}, {s="bugCatcher"}, {11,4}, {12,4}, {s="potion",hp=19}, {13,4}, {s="talk",dir="Right"}, {s="shortsKid"}, {s="tweetAfterBrock"}, {13,5}, {s="potionBeforeCocoons"}, {18,5}, {s="talk",dir="Right"}, {s="swapHornAttack"}, {18,6}, {22,6}, {22,5}, {s="potion",hp=4}, {24,5}, {s="talk",dir="Down"}, {s="fightMetapod"}, {27,5}, {27,9}, {s="catchFlierBackup"}, {37,8}, {37,5}, {49,5}, {49,10}, {57,10}, {57,8}, {59,8}, {59,-1}},
{14, {0,10}, {c="a",a="Route 3"}, {c="catchFlier"}, {c="pp",on=true}, {s="battleModeSet"}, {8,10}, {8,8}, {11,8}, {11,6}, {s="bugCatcher"}, {11,4}, {12,4}, {s="potion",hp=19}, {13,4}, {s="talk",dir="Right"}, {s="shortsKid"}, {s="tweetAfterBrock"}, {13,5}, {s="potionBeforeCocoons"}, {18,5}, {s="talk",dir="Right"}, {s="swapMove",move="horn_attack",to=0}, {18,6}, {22,6}, {22,5}, {s="potion",hp=4}, {24,5}, {s="talk",dir="Down"}, {s="fightMetapod"}, {27,5}, {27,9}, {s="catchFlierBackup"}, {37,8}, {37,5}, {49,5}, {49,10}, {57,10}, {57,8}, {59,8}, {59,-1}},
-- To the Center
{15, {9,16}, {c="pp",on=false}, {12,16}, {12,6}, {11,6}, {11,5}},
-- PP up
@ -106,7 +106,7 @@ local Paths = {
-- Rival 2
{3, {9,12}, {c="a",a="Cerulean Rival"}, {21,12}, {21,6}, {s="rivalSandAttack"}, {21,-1}},
-- Nugget bridge
{35, {11,35}, {c="a",a="Nugget Bridge"}, {11,32}, {s="talk",dir="Up"}, {10,32}, {10,29}, {s="potion",hp=12,yolo=10}, {s="talk",dir="Up"}, {11,29}, {11,27}, {s="rareCandyEarly",close=true}, {s="potion",hp=10,yolo=8,close=true}, {11,26}, {s="talk",dir="Up"}, {10,26}, {10,24}, {s="teachThrash"}, {s="potion",hp=4}, {10,23}, {s="talk",dir="Up"}, {11,23}, {11,21}, {s="teachThrash"}, {s="potionForMankey"}, {11,20}, {s="talk",dir="Up"}, {s="redbarMankey"}, {10,20}, {10,19}, {s="teachThrash"}, {10,15}, {s="learnThrash"}, {s="teachThrash"}, {s="split"}, {10,8}, {20,8}},
{35, {11,35}, {c="a",a="Nugget Bridge"}, {11,32}, {s="talk",dir="Up"}, {s="hornAttackCaterpie"}, {10,32}, {10,29}, {s="potion",hp=12,yolo=10}, {s="talk",dir="Up"}, {11,29}, {11,27}, {s="rareCandyEarly",close=true}, {s="potion",hp=10,yolo=8,close=true}, {11,26}, {s="talk",dir="Up"}, {s="swapThrash"}, {10,26}, {10,24}, {s="teachThrash"}, {s="potion",hp=4}, {10,23}, {s="talk",dir="Up"}, {s="swapThrash"}, {11,23}, {11,21}, {s="teachThrash"}, {s="potionForMankey"}, {11,20}, {s="talk",dir="Up"}, {s="redbarMankey"}, {s="swapThrash"}, {10,20}, {10,19}, {s="teachThrash"}, {10,15}, {s="learnThrash"}, {s="swapThrash"}, {s="waitToFight"}, {s="teachThrash"}, {s="split"}, {10,8}, {20,8}},
-- 6: NUGGET BRIDGE