Add strategy to switch for sand-attack under severe circumstances

This commit is contained in:
Kyle Coburn 2015-05-17 20:56:43 -07:00
parent 335f9ddd4e
commit 7bdb47322c
1 changed files with 21 additions and 1 deletions

View File

@ -558,7 +558,27 @@ end
-- 4: Mt. Moon
strategyFunctions.rivalSandAttack = function()
return true --TODO swap at low acc
if Strategies.trainerBattle() then
if Battle.redeployNidoking() then
local sacrifice = Battle.deployed()
if sacrifice then
Strategies.chat("sacrificed", "got Sand-Attacked... Swapping out "..Utils.capitalize(sacrifice).." to restore accuracy.")
end
return false
end
if Pokemon.isOpponent("sandshrew") and Memory.value("battle", "accuracy") < 6 then --TODO
local __, turnsToKill = Combat.bestMove()
if turnsToKill and turnsToKill == 1 then
local sacrifice = Pokemon.getSacrifice("pidgey")
if sacrifice and Pokemon.info(sacrifice, "level") < 6 and Battle.sacrifice(sacrifice) then
return false
end
end
end
Battle.automate()
elseif status.foughtTrainer then
return true
end
end
strategyFunctions.acquireCharmander = function()