Standardize stat requirements for time limits

This commit is contained in:
Kyle Coburn 2015-04-09 19:55:38 -07:00
parent 267d576d1c
commit cb1163daf9
3 changed files with 64 additions and 42 deletions

View File

@ -25,6 +25,21 @@ local stats = Strategies.stats
-- TIME CONSTRAINTS -- TIME CONSTRAINTS
local function timeForStats()
local timeBonus = (stats.nidoran.attack - 53) * 0.05
if stats.nidoran.attack >= 55 then
timeBonus = timeBonus + 0.05
end
local maxSpeed = math.min(stats.nidoran.speed, 52)
timeBonus = timeBonus + (maxSpeed - 49) * 0.125
if stats.nidoran.special >= 45 then
timeBonus = timeBonus + 0.1
end
return timeBonus
end
Strategies.timeRequirements = { Strategies.timeRequirements = {
bulbasaur = function() bulbasaur = function()
@ -39,11 +54,9 @@ Strategies.timeRequirements = {
return timeLimit return timeLimit
end, end,
brock = function() shorts = function()
local timeLimit = 11 local timeLimit = 14
if stats.nidoran.attack == 16 and stats.nidoran.speed == 15 and stats.nidoran.special == 13 then timeLimit = timeLimit + (3 - stats.nidoran.rating) * 0.2
timeLimit = timeLimit + 0.5
end
if Pokemon.inParty("spearow") then if Pokemon.inParty("spearow") then
timeLimit = timeLimit + 0.5 timeLimit = timeLimit + 0.5
end end
@ -53,7 +66,7 @@ Strategies.timeRequirements = {
mt_moon = function() mt_moon = function()
local timeLimit = 26.75 local timeLimit = 26.75
if stats.nidoran.attack > 15 and stats.nidoran.speed > 14 then if stats.nidoran.attack > 15 and stats.nidoran.speed > 14 then
timeLimit = timeLimit + 0.25 timeLimit = timeLimit + 0.33
end end
if Pokemon.inParty("paras") then if Pokemon.inParty("paras") then
timeLimit = timeLimit + 0.75 timeLimit = timeLimit + 0.75
@ -70,7 +83,7 @@ Strategies.timeRequirements = {
end, end,
goldeen = function() goldeen = function()
local timeLimit = 37.5 local timeLimit = 37 + timeForStats()
if Pokemon.inParty("paras") then if Pokemon.inParty("paras") then
timeLimit = timeLimit + 0.75 timeLimit = timeLimit + 0.75
end end
@ -78,7 +91,7 @@ Strategies.timeRequirements = {
end, end,
misty = function() misty = function()
local timeLimit = 39.5 local timeLimit = 39 + timeForStats()
if Pokemon.inParty("paras") then if Pokemon.inParty("paras") then
timeLimit = timeLimit + 0.75 timeLimit = timeLimit + 0.75
end end
@ -86,25 +99,15 @@ Strategies.timeRequirements = {
end, end,
vermilion = function() vermilion = function()
return 44 return 43.5 + timeForStats()
end, end,
trash = function() trash = function()
local timeLimit = 47 return 47 + timeForStats()
if stats.nidoran.special > 44 then
timeLimit = timeLimit + 0.25
end
if stats.nidoran.attack > 53 then
timeLimit = timeLimit + 0.25
end
if stats.nidoran.attack >= 54 and stats.nidoran.special >= 45 then
timeLimit = timeLimit + 0.25
end
return timeLimit
end, end,
safari_carbos = function() safari_carbos = function()
return 70.5 return 70 + timeForStats()
end, end,
victory_road = function() victory_road = function()
@ -218,38 +221,51 @@ local strategyFunctions = Strategies.functions
-- General -- General
local function tweetBrock(statDiff) strategyFunctions.tweetAfterBrock = function()
if statDiff < 3 then if stats.nidoran.rating < 2 then
local timeLimit = Strategies.getTimeRequirement("brock") if not Strategies.overMinute("shorts") then
if not Strategies.overMinute(timeLimit) then Strategies.updates.brock = true
Strategies.tweetProgress("On pace after Brock with a great Nidoran") Strategies.tweetProgress("On pace after Brock with a great Nidoran", "brock")
end end
end end
return true
end end
strategyFunctions.tweetMisty = function() strategyFunctions.tweetMisty = function()
if not Strategies.setYolo("misty") then if not Strategies.updates.brock and not Strategies.setYolo("misty") then
local timeLimit = Strategies.getTimeRequirement("misty") local timeLimit = Strategies.getTimeRequirement("misty")
if not Strategies.overMinute(timeLimit - 0.5) then if not Strategies.overMinute(timeLimit - 0.25) then
local pbn = "" local pbn = ""
if not Strategies.overMinute(timeLimit - 1) then if not Strategies.overMinute(timeLimit - 1) then
pbn = " (PB pace)" pbn = " (PB pace)"
end end
local elt = Utils.elapsedTime() local elt = Utils.elapsedTime()
Strategies.tweetProgress("Got a run going, just beat Misty "..elt.." in"..pbn) Strategies.tweetProgress("Got a run going, just beat Misty "..elt.." in"..pbn, "misty")
end end
end end
return true return true
end end
strategyFunctions.tweetSurge = function()
if not Strategies.updates.misty and not Control.yolo then
local elt = Utils.elapsedTime()
local pbn = ""
if not Strategies.overMinute("surge") then
pbn = " (PB pace)"
end
Strategies.tweetProgress("Got a run going, just beat Surge "..elt.." in"..pbn, "surge")
end
return true
end
strategyFunctions.tweetVictoryRoad = function() strategyFunctions.tweetVictoryRoad = function()
local elt = Utils.elapsedTime() local elt = Utils.elapsedTime()
local pbn = "" local pbn = ""
if not Strategies.overMinute(Strategies.getTimeRequirement("victory_road")) then if not Strategies.overMinute("victory_road") then
pbn = " (PB pace)" pbn = " (PB pace)"
end end
local elt = Utils.elapsedTime() local elt = Utils.elapsedTime()
Strategies.tweetProgress("Entering Victory Road at "..elt..pbn.." on our way to the Elite Four") Strategies.tweetProgress("Entering Victory Road at "..elt..pbn.." on our way to the Elite Four", "victory")
return true return true
end end
@ -286,7 +302,7 @@ strategyFunctions.fightBulbasaur = function()
status.tries = status.tries + 1 status.tries = status.tries + 1
end end
end end
if Battle.isActive() and Memory.double("battle", "opponent_hp") > 0 and Strategies.resetTime(Strategies.getTimeRequirement("bulbasaur"), "kill Bulbasaur") then if Battle.isActive() and Memory.double("battle", "opponent_hp") > 0 and Strategies.resetTime("bulbasaur", "kill Bulbasaur") then
return true return true
end end
return Strategies.buffTo("tail_whip", 6) return Strategies.buffTo("tail_whip", 6)
@ -2315,7 +2331,7 @@ strategyFunctions.champion = function()
return Strategies.hardReset("Back to the grind - you can follow on Twitter for updates on our next good run! https://twitter.com/thepokebot") return Strategies.hardReset("Back to the grind - you can follow on Twitter for updates on our next good run! https://twitter.com/thepokebot")
end end
if status.tries == 0 then if status.tries == 0 then
Strategies.tweetProgress("Beat Pokemon Red in "..status.canProgress.."!", true) Strategies.tweetProgress("Beat Pokemon Red in "..status.canProgress.."!")
if Strategies.seed then if Strategies.seed then
print("v"..VERSION..": "..Utils.frames().." frames, with seed "..Strategies.seed) print("v"..VERSION..": "..Utils.frames().." frames, with seed "..Strategies.seed)
print("Please save this seed number to share, if you would like proof of your run!") print("Please save this seed number to share, if you would like proof of your run!")

View File

@ -25,6 +25,7 @@ local status = {tries = 0, canProgress = nil, initialized = false}
local stats = {} local stats = {}
Strategies.status = status Strategies.status = status
Strategies.stats = stats Strategies.stats = stats
Strategies.updates = {}
Strategies.deepRun = false Strategies.deepRun = false
local strategyFunctions local strategyFunctions
@ -68,7 +69,7 @@ function Strategies.reset(reason, extra, wait)
end end
resetMessage = resetMessage..separator.." "..reason resetMessage = resetMessage..separator.." "..reason
if status.tweeted then if status.tweeted then
Strategies.tweetProgress(resetMessage, true) Strategies.tweetProgress(resetMessage)
end end
return Strategies.hardReset(resetMessage, extra, wait) return Strategies.hardReset(resetMessage, extra, wait)
end end
@ -88,7 +89,10 @@ function Strategies.death(extra)
end end
function Strategies.overMinute(min) function Strategies.overMinute(min)
return Utils.igt() > min * 60 if type(min) == "string" then
min = Strategies.getTimeRequirement(min)
end
return Utils.igt() > (min * 60)
end end
function Strategies.resetTime(timeLimit, reason, once) function Strategies.resetTime(timeLimit, reason, once)
@ -125,9 +129,9 @@ end
-- HELPERS -- HELPERS
function Strategies.tweetProgress(message, finished) function Strategies.tweetProgress(message, progress)
if not finished then if progress then
status.tweeted = true Strategies.updates[progress] = true
message = message.." http://www.twitch.tv/thepokebot" message = message.." http://www.twitch.tv/thepokebot"
end end
Bridge.tweet(message) Bridge.tweet(message)
@ -890,8 +894,7 @@ Strategies.functions = {
Control.moonEncounters = nil Control.moonEncounters = nil
end end
local timeLimit = Strategies.getTimeRequirement("mt_moon") Strategies.resetTime("mt_moon", "complete Mt. Moon", true)
Strategies.resetTime(timeLimit, "complete Mt. Moon", true)
return true return true
end, end,
@ -976,6 +979,8 @@ function Strategies.softReset()
Strategies.status = status Strategies.status = status
stats = {} stats = {}
Strategies.stats = stats Strategies.stats = stats
Strategies.updates = {}
splitNumber, splitTime = 0, 0 splitNumber, splitTime = 0, 0
resetting = nil resetting = nil
Strategies.deepRun = false Strategies.deepRun = false

View File

@ -68,7 +68,7 @@ local Paths = {
-- Leaving Pewter City -- Leaving Pewter City
{2, {23,18}, {40,18}}, {2, {23,18}, {40,18}},
-- Route 3 -- Route 3
{14, {0,10}, {c="a",a="Route 3"}, {c="catchFlier"}, {c="pp",on=true}, {s="battleModeSet"}, {8,10}, {8,8}, {11,8}, {11,6}, {s="bugCatcher"}, {11,4}, {12,4}, {s="potion",hp=19}, {13,4}, {s="interact",dir="Right"}, {s="shortsKid"}, {13,5}, {s="potionBeforeCocoons"}, {18,5}, {s="interact",dir="Right"}, {s="swapHornAttack"}, {18,6}, {22,6}, {22,5}, {s="potion",hp=4}, {24,5}, {s="interact",dir="Down"}, {s="fightMetapod"}, {27,5}, {27,9}, {s="catchFlierBackup"}, {37,8}, {37,5}, {49,5}, {49,10}, {57,10}, {57,8}, {59,8}, {59,-1}}, {14, {0,10}, {c="a",a="Route 3"}, {c="catchFlier"}, {c="pp",on=true}, {s="battleModeSet"}, {8,10}, {8,8}, {11,8}, {11,6}, {s="bugCatcher"}, {11,4}, {12,4}, {s="potion",hp=19}, {13,4}, {s="interact",dir="Right"}, {s="shortsKid"}, {s="tweetAfterBrock"}, {13,5}, {s="potionBeforeCocoons"}, {18,5}, {s="interact",dir="Right"}, {s="swapHornAttack"}, {18,6}, {22,6}, {22,5}, {s="potion",hp=4}, {24,5}, {s="interact",dir="Down"}, {s="fightMetapod"}, {27,5}, {27,9}, {s="catchFlierBackup"}, {37,8}, {37,5}, {49,5}, {49,10}, {57,10}, {57,8}, {59,8}, {59,-1}},
-- To the Center -- To the Center
{15, {9,16}, {c="pp",on=false}, {12,16}, {12,6}, {11,6}, {11,5}}, {15, {9,16}, {c="pp",on=false}, {12,16}, {12,6}, {11,6}, {11,5}},
-- PP up -- PP up
@ -161,7 +161,7 @@ local Paths = {
-- To Surge -- To Surge
{5, {18,29}, {18,26}, {30,26}, {30,14}, {15,14}, {15,17}, {s="potionBeforeSurge"}, {s="swap",item="repel",dest=0,chain=true}, {s="teach",move="cut",poke="oddish",alt="paras",chain=true}, {s="teach",move="dig",poke="paras",alt="squirtle",chain=true}, {s="skill",move="cut",done=0x0D4D}, {15,20}, {12,20}, {12,19}}, {5, {18,29}, {18,26}, {30,26}, {30,14}, {15,14}, {15,17}, {s="potionBeforeSurge"}, {s="swap",item="repel",dest=0,chain=true}, {s="teach",move="cut",poke="oddish",alt="paras",chain=true}, {s="teach",move="dig",poke="paras",alt="squirtle",chain=true}, {s="skill",move="cut",done=0x0D4D}, {15,20}, {12,20}, {12,19}},
-- Trashcans -- Trashcans
{92, {4,17}, {c="a",a="Surge's Gym"}, {4,16}, {2,16}, {2,11}, {s="trashcans"}, {4,6}, {4,3}, {5,3}, {5,2}, {s="interact",dir="Up"}, {s="fightSurge"}, {s="split"}, {4,2}, {4,13}, {5,13}, {5,18}}, {92, {4,17}, {c="a",a="Surge's Gym"}, {4,16}, {2,16}, {2,11}, {s="trashcans"}, {4,6}, {4,3}, {5,3}, {5,2}, {s="interact",dir="Up"}, {s="fightSurge"}, {s="split"}, {s="tweetSurge"}, {4,2}, {4,13}, {5,13}, {5,18}},
-- 8: SURGE -- 8: SURGE
@ -360,6 +360,7 @@ local Paths = {
-- F1 drop -- F1 drop
{165, {16,14}, {16,15}, {13,15}, {13,20}, {s="cinnabarCarbos"}, {21,23}}, {165, {16,14}, {16,15}, {13,15}, {13,20}, {s="cinnabarCarbos"}, {21,23}},
-- B1 -- B1
--TODO menu cancel for RC
{216, {23,22}, {23,15}, {21,15}, {s="item",item="super_repel",chain=true}, {s="item",item="carbos",poke="nidoking",close=true}, {17,15}, {17,19}, {18,19}, {18,23}, {17,23}, {17,26}, {18,26}, {s="confirm",dir="Up"}, {14,26}, {14,22}, {12,22}, {12,15}, {24,15}, {24,18}, {26,18}, {26,6}, {24,6}, {24,4}, {20,4}, {s="confirm",dir="Up"}, {24,4}, {24,6}, {12,6}, {12,2}, {11,2}, {s="interact",dir="Left"}, {12,2}, {12,7}, {4,7}, {4,9}, {2,9}, {s="interact",dir="Left"}, {5,9}, {5,10}, {s="teach",move="strength",poke="squirtle",replace="tackle",chain=true}, {s="item",item="rare_candy",amount=2,poke="nidoking",close=true}, {5,12}, {s="interact",dir="Down"}, {5,12}, {s="skill",move="dig",map=216}}, {216, {23,22}, {23,15}, {21,15}, {s="item",item="super_repel",chain=true}, {s="item",item="carbos",poke="nidoking",close=true}, {17,15}, {17,19}, {18,19}, {18,23}, {17,23}, {17,26}, {18,26}, {s="confirm",dir="Up"}, {14,26}, {14,22}, {12,22}, {12,15}, {24,15}, {24,18}, {26,18}, {26,6}, {24,6}, {24,4}, {20,4}, {s="confirm",dir="Up"}, {24,4}, {24,6}, {12,6}, {12,2}, {11,2}, {s="interact",dir="Left"}, {12,2}, {12,7}, {4,7}, {4,9}, {2,9}, {s="interact",dir="Left"}, {5,9}, {5,10}, {s="teach",move="strength",poke="squirtle",replace="tackle",chain=true}, {s="item",item="rare_candy",amount=2,poke="nidoking",close=true}, {5,12}, {s="interact",dir="Down"}, {5,12}, {s="skill",move="dig",map=216}},
-- Celadon once again -- Celadon once again
{6, {41,10}, {s="bicycle"}, {41,13}, {36,13}, {36,23}, {25,23}, {25,30}, {35,30}, {35,31}, {s="skill",move="cut",dir="Down",done=0x0D4D}, {35,34}, {5,34}, {5,29}, {12,29}, {12,27}}, {6, {41,10}, {s="bicycle"}, {41,13}, {36,13}, {36,23}, {25,23}, {25,30}, {35,30}, {35,31}, {s="skill",move="cut",dir="Down",done=0x0D4D}, {35,34}, {5,34}, {5,29}, {12,29}, {12,27}},