Resolve circular dependency in Data
This commit is contained in:
parent
38e2a0b0a6
commit
9a487e57d7
|
@ -234,7 +234,6 @@ function Strategies.buffTo(buff, defLevel)
|
|||
if defLevel and Memory.double("battle", "opponent_defense") > defLevel then
|
||||
forced = buff
|
||||
end
|
||||
Control.ignoreMiss = forced ~= nil
|
||||
Battle.automate(forced, true)
|
||||
elseif status.foughtTrainer then
|
||||
return true
|
||||
|
@ -1768,7 +1767,7 @@ Strategies.functions = {
|
|||
gui.text(0, 14, "Name: "..Textbox.getNamePlaintext())
|
||||
gui.text(0, 21, "Reset for time: "..tostring(RESET_FOR_TIME))
|
||||
gui.text(0, 28, "Time: "..Utils.elapsedTime())
|
||||
gui.text(0, 35, "Frames: "..Data.frames())
|
||||
gui.text(0, 35, "Frames: "..Utils.frames())
|
||||
client.setscreenshotosd(true)
|
||||
client.screenshot()
|
||||
client.setscreenshotosd(false)
|
||||
|
|
|
@ -98,7 +98,7 @@ local function nidoranDSum(enabled)
|
|||
end
|
||||
if status.path then
|
||||
status.pathIndex = 1
|
||||
status.startTime = Data.frames() + 118
|
||||
status.startTime = Utils.frames() + 118
|
||||
else
|
||||
status.path = 0
|
||||
end
|
||||
|
@ -109,7 +109,7 @@ local function nidoranDSum(enabled)
|
|||
local encounterlessSteps = Memory.value("game", "encounterless")
|
||||
if enabled and status.path ~= 0 then
|
||||
local duration = status.path[status.pathIndex]
|
||||
local currentTime = Data.frames()
|
||||
local currentTime = Utils.frames()
|
||||
if (currentTime - status.startTime) / 60 > duration then
|
||||
status.startTime = currentTime
|
||||
if status.pathIndex >= #status.path then
|
||||
|
|
|
@ -30,16 +30,8 @@ end
|
|||
|
||||
-- HELPERS
|
||||
|
||||
function Data.frames()
|
||||
local totalFrames = Memory.value("time", "hours") * 60
|
||||
totalFrames = (totalFrames + Memory.value("time", "minutes")) * 60
|
||||
totalFrames = (totalFrames + Memory.value("time", "seconds")) * 60
|
||||
totalFrames = totalFrames + Memory.value("time", "frames")
|
||||
return totalFrames
|
||||
end
|
||||
|
||||
function Data.setFrames()
|
||||
Data.run.frames = Data.frames()
|
||||
Data.run.frames = require("util.utils").frames()
|
||||
end
|
||||
|
||||
function Data.increment(key)
|
||||
|
|
|
@ -130,6 +130,14 @@ end
|
|||
|
||||
-- TIME
|
||||
|
||||
function Utils.frames()
|
||||
local totalFrames = Memory.value("time", "hours") * 60
|
||||
totalFrames = (totalFrames + Memory.value("time", "minutes")) * 60
|
||||
totalFrames = (totalFrames + Memory.value("time", "seconds")) * 60
|
||||
totalFrames = totalFrames + Memory.value("time", "frames")
|
||||
return totalFrames
|
||||
end
|
||||
|
||||
function Utils.igt()
|
||||
local hours = Memory.value("time", "hours")
|
||||
local mins = Memory.value("time", "minutes")
|
||||
|
|
Loading…
Reference in New Issue