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 -- Items
function Control.canRecover() 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 end
function Control.set(data) function Control.set(data)

View File

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

View File

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