Differentiate status changes by bit mask
This commit is contained in:
parent
169626b737
commit
9d05ee343e
|
@ -58,7 +58,7 @@ local function recover()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if Memory.value("battle", "paralyzed") == 64 then
|
if Combat.isParalyzed() then
|
||||||
local heals = Inventory.contains("paralyze_heal", "full_restore")
|
local heals = Inventory.contains("paralyze_heal", "full_restore")
|
||||||
if heals then
|
if heals then
|
||||||
Inventory.use(heals, nil, true)
|
Inventory.use(heals, nil, true)
|
||||||
|
|
|
@ -289,6 +289,18 @@ Combat.activePokemon = activePokemon
|
||||||
|
|
||||||
-- STATUS
|
-- STATUS
|
||||||
|
|
||||||
|
local function checkStatus(target, value)
|
||||||
|
return bit.band(Pokemon.info(target, "status"), value) == value
|
||||||
|
end
|
||||||
|
|
||||||
|
function Combat.isPoisoned(target)
|
||||||
|
return checkStatus(target, 0x8)
|
||||||
|
end
|
||||||
|
|
||||||
|
function Combat.isParalyzed(target)
|
||||||
|
return checkStatus(target, 0x40)
|
||||||
|
end
|
||||||
|
|
||||||
local function isSleeping()
|
local function isSleeping()
|
||||||
return Memory.raw(0x116F) > 1
|
return Memory.raw(0x116F) > 1
|
||||||
end
|
end
|
||||||
|
|
|
@ -484,8 +484,7 @@ strategyFunctions.equipForBrock = function(data)
|
||||||
return Strategies.reset("level8", "Did not reach level 8 before Brock", Pokemon.getExp(), true)
|
return Strategies.reset("level8", "Did not reach level 8 before Brock", Pokemon.getExp(), true)
|
||||||
end
|
end
|
||||||
if data.anti then
|
if data.anti then
|
||||||
local poisoned = Pokemon.info("squirtle", "status") > 0
|
if not Combat.isPoisoned("squirtle") then
|
||||||
if not poisoned then
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
if not Inventory.contains("antidote") then
|
if not Inventory.contains("antidote") then
|
||||||
|
|
|
@ -906,7 +906,7 @@ Strategies.functions = {
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if Pokemon.info("squirtle", "status") > 0 then
|
if Combat.isPoisoned("squirtle")then
|
||||||
Inventory.use("antidote", "squirtle")
|
Inventory.use("antidote", "squirtle")
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
|
@ -198,7 +198,8 @@ function Pokemon.moveIndex(move, pokemon)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Pokemon.info(name, offset)
|
function Pokemon.info(name, offset)
|
||||||
return index(indexOf(name), offset)
|
local targetIndex = name and indexOf(name) or 0
|
||||||
|
return index(targetIndex, offset)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Pokemon.getID(name)
|
function Pokemon.getID(name)
|
||||||
|
|
Loading…
Reference in New Issue