Standardize Carbos checking based off number required

This commit is contained in:
Kyle Coburn 2015-05-04 19:34:17 -07:00
parent 1bfa7e9f01
commit 8f1f9fd5cb
2 changed files with 45 additions and 8 deletions

View File

@ -427,6 +427,33 @@ function Strategies.prepare(...)
end end
end end
function Strategies.getsSilphCarbosSpecially()
return Data.yellow and stats.nidoran.speedDV >= 11
end
function Strategies.needsCarbosAtLeast(count)
local speedDV = stats.nidoran.speedDV
local carbosRequired = 0
if Data.yellow then
if speedDV <= 8 then
carbosRequired = 3
elseif speedDV <= 10 then
carbosRequired = 2
else
carbosRequired = 1
end
else
if speedDV <= 6 then
carbosRequired = 3
elseif speedDV <= 7 then
carbosRequired = 2
elseif speedDV <= 9 then
carbosRequired = 1
end
end
return count <= carbosRequired
end
local function nidokingStats() local function nidokingStats()
local att = Pokemon.index(0, "attack") local att = Pokemon.index(0, "attack")
local def = Pokemon.index(0, "defense") local def = Pokemon.index(0, "defense")
@ -1346,7 +1373,7 @@ Strategies.functions = {
lassEther = function() lassEther = function()
if Strategies.initialize() then if Strategies.initialize() then
if Data.yellow then if Data.yellow then
if not Strategies.vaporeon or not Strategies.needs1Carbos() then if not Strategies.vaporeon or not Strategies.getsSilphCarbosSpecially() then
return true return true
end end
if Inventory.contains("pokeball") and Inventory.contains("potion") then if Inventory.contains("pokeball") and Inventory.contains("potion") then
@ -1553,6 +1580,21 @@ Strategies.functions = {
end end
end, end,
silphCarbos = function()
if Strategies.initialize() then
local skipCarbos = not Strategies.needsCarbosAtLeast(2)
if not skipCarbos then
Bridge.chat(" This Nidoking has bad speed, so we need the extra Carbos here.")
elseif Strategies.getsSilphCarbosSpecially() then
skipCarbos = false
end
if skipCarbos then
return true
end
end
return strategyFunctions.interact({dir="Left"})
end,
playPokeFlute = function() playPokeFlute = function()
if Battle.isActive() then if Battle.isActive() then
return true return true
@ -1607,8 +1649,7 @@ Strategies.functions = {
Strategies.setYolo("safari_carbos") Strategies.setYolo("safari_carbos")
status.carbos = Inventory.count("carbos") status.carbos = Inventory.count("carbos")
local minDV = Data.yellow and 9 or 7 if not Strategies.needsCarbosAtLeast(3) then
if stats.nidoran.speedDV >= minDV then
return true return true
end end
Bridge.chat(" This Nidoking has bad speed, so we'll need to go out of our way for the extra Carbos here.") Bridge.chat(" This Nidoking has bad speed, so we'll need to go out of our way for the extra Carbos here.")
@ -1681,7 +1722,7 @@ Strategies.functions = {
cinnabarCarbos = function() cinnabarCarbos = function()
local minDV = Data.yellow and 11 or 10 local minDV = Data.yellow and 11 or 10
local skipsCarbos = stats.nidoran.speedDV >= minDV local skipsCarbos = not Strategies.needsCarbosAtLeast(Data.yellow and 2 or 1)
if Strategies.initialize() then if Strategies.initialize() then
status.startCount = Inventory.count("carbos") status.startCount = Inventory.count("carbos")
if not skipsCarbos then if not skipsCarbos then

View File

@ -282,10 +282,6 @@ function Strategies.requiresE4Center()
return Combat.hp() < 100 return Combat.hp() < 100
end end
function Strategies.needs1Carbos()
return stats.nidoran.speedDV >= 11
end
-- STRATEGIES -- STRATEGIES
strategyFunctions.gotPikachu = function() strategyFunctions.gotPikachu = function()