Improve red-barring off Silph Rival through Koga

This commit is contained in:
Kyle Coburn 2015-04-17 13:37:41 -07:00
parent 1c34c3b55c
commit 7dfb5c7978
1 changed files with 17 additions and 6 deletions

View File

@ -206,9 +206,11 @@ local function potionForRedBar(damage)
{"potion", 20}, {"potion", 20},
{"super_potion", 50}, {"super_potion", 50},
} }
for i,potion in ipairs(potions) do for i,potionTable in ipairs(potions) do
if Inventory.contains(potion[1]) then local potion = potionTable[1]
local healTo = math.min(curr_hp + potion[2], max_hp) if Inventory.contains(potion) then
local healsFor = potionTable[2]
local healTo = math.min(curr_hp + healsFor, max_hp)
if healTo > damage and healTo - damage < red_hp then if healTo > damage and healTo - damage < red_hp then
return potion return potion
end end
@ -1423,6 +1425,9 @@ strategyFunctions.silphRival = function()
Inventory.use("super_potion", nil, true) Inventory.use("super_potion", nil, true)
return false return false
end end
if not Strategies.prepare("x_special") then
return false
end
if not potionForRedBar(status.gyaradosDamage) then if not potionForRedBar(status.gyaradosDamage) then
forced = "ice_beam" forced = "ice_beam"
end end
@ -1477,10 +1482,12 @@ strategyFunctions.fightSilphGiovanni = function()
forced = "horn_drill" forced = "horn_drill"
elseif opponentName == "nidoqueen" then elseif opponentName == "nidoqueen" then
if Strategies.hasHealthFor("KogaWeezing") then if Strategies.hasHealthFor("KogaWeezing") then
if not Strategies.opponentDamaged() then if Battle.pp("earthquake") > 4 then
forced = "earthquake" forced = "earthquake"
else
forced = "ice_beam"
end end
else elseif not Strategies.opponentDamaged() then
forced = "horn_drill" forced = "horn_drill"
end end
end end
@ -1502,6 +1509,10 @@ strategyFunctions.potionBeforeHypno = function()
local healTarget local healTarget
if healthUnderRedBar >= 0 then if healthUnderRedBar >= 0 then
if not status.warned then
status.warned = true
Bridge.chat("Attempting to carry red-bar through Koga. Hypno has a 1 in 4 chance to end the run with Confusion here...")
end
healTarget = "HypnoHeadbutt" healTarget = "HypnoHeadbutt"
if useRareCandy then if useRareCandy then
useRareCandy = healthUnderRedBar > 2 useRareCandy = healthUnderRedBar > 2
@ -1525,7 +1536,7 @@ end
strategyFunctions.fightHypno = function() strategyFunctions.fightHypno = function()
if Battle.isActive() then if Battle.isActive() then
local forced local forced
if Pokemon.isOpponent("hypno") then if Pokemon.isOpponent("hypno") and not Strategies.damaged() then
if Pokemon.info("nidoking", "hp") > Combat.healthFor("KogaWeezing") * 0.9 then if Pokemon.info("nidoking", "hp") > Combat.healthFor("KogaWeezing") * 0.9 then
if Combat.isDisabled(85) then if Combat.isDisabled(85) then
forced = "ice_beam" forced = "ice_beam"