Support index selection on pokemon menu helper, restrict heal checking to primary pokemon

This commit is contained in:
Kyle Coburn 2015-04-15 11:17:52 -07:00
parent 60d79fb255
commit 19e3874f80
3 changed files with 14 additions and 6 deletions

View File

@ -256,7 +256,7 @@ end
-- Items
function Control.canRecover()
return potionInBattle and (not battleYolo or not Control.yolo)
return potionInBattle and (not battleYolo or not Control.yolo) and Pokemon.mainFighter()
end
function Control.set(data)

View File

@ -119,11 +119,11 @@ function Inventory.teach(item, poke, replaceIdx, altPoke)
elseif column == 15 then
Menu.select(0, true)
else
local idx = 0
local teachIndex = 0
if poke then
idx = Pokemon.indexOf(poke, altPoke)
teachIndex = Pokemon.indexOf(poke, altPoke)
end
Menu.select(idx, true)
Pokemon.select(teachIndex)
end
else
return false

View File

@ -283,6 +283,10 @@ function Pokemon.isDeployed(...)
end
end
function Pokemon.mainFighter()
return Pokemon.index(0) == Memory.value("battle", "our_id")
end
function Pokemon.isEvolving()
return Memory.value("menu", "pokemon") == 144
end
@ -328,7 +332,11 @@ function Pokemon.getDVs(name)
return bit.rshift(attackDefense, 4), bit.band(attackDefense, 15), bit.rshift(speedSpecial, 4), bit.band(speedSpecial, 15)
end
function Pokemon.select(name)
return Menu.select(indexOf(name), true, false, nil, false, Memory.value("player", "party_size"))
function Pokemon.select(target)
if type(target) == "string" then
target = indexOf(target)
end
return Menu.select(target, true, false, nil, false, Memory.value("player", "party_size"))
end
return Pokemon