Fix resetting strategy status table

This commit is contained in:
Kyle Coburn 2015-04-06 02:19:25 -07:00
parent f01cb1368c
commit b3bcb2ac3f
3 changed files with 28 additions and 13 deletions

View File

@ -25,6 +25,8 @@ local riskGiovanni, maxEtherSkip
local status = Strategies.status
-- TIME CONSTRAINTS
Strategies.timeRequirements = {
bulbasaur = function()
@ -1489,17 +1491,6 @@ strategyFunctions.lavenderRival = function()
end
end
strategyFunctions.pokeDoll = function()
if Battle.isActive() then
status.canProgress = true
Inventory.use("pokedoll", nil, true)
elseif status.canProgress then
return true
else
Input.cancel()
end
end
strategyFunctions.digFight = function()
if Battle.isActive() then
status.canProgress = true
@ -1524,6 +1515,17 @@ strategyFunctions.digFight = function()
end
end
strategyFunctions.pokeDoll = function()
if Battle.isActive() then
status.canProgress = true
Inventory.use("pokedoll", nil, true)
elseif status.canProgress then
return true
else
Input.cancel()
end
end
strategyFunctions.thunderboltFirst = function()
local forced
if Pokemon.isOpponent("zubat") then
@ -2378,6 +2380,10 @@ function Strategies.initGame(midGame)
end
end
function Strategies.completeGameStrategy()
status = Strategies.status
end
function Strategies.resetGame()
maxEtherSkip = false
status = Strategies.status

View File

@ -683,10 +683,12 @@ strategyFunctions = Strategies.functions
function Strategies.execute(data)
if strategyFunctions[data.s](data) then
status = {tries=0}
Strategies.status = status
Strategies.completeGameStrategy()
-- print(data.s)
if resetting then
return nil
end
-- print(data.s)
return true
end
return false
@ -703,7 +705,8 @@ function Strategies.init(midGame)
end
function Strategies.softReset()
status = {}
status = {tries=0}
Strategies.status = status
splitNumber, splitTime = 0, 0
resetting = nil
Strategies.resetGame()

View File

@ -20,6 +20,8 @@ local pokemon = require "storage.pokemon"
local status = Strategies.status
-- TIME CONSTRAINTS
Strategies.timeRequirements = {}
-- STRATEGIES
@ -34,6 +36,10 @@ function Strategies.initGame(midGame)
end
end
function Strategies.completeGameStrategy()
status = Strategies.status
end
function Strategies.resetGame()
status = Strategies.status
end