Use Paras and Squirtle backup vs Ghastly, fix verifying that they didn't faint before the fight

This commit is contained in:
Kyle Coburn 2015-04-04 18:33:47 -07:00
parent e0be7a5fbc
commit 241e4f4b65
1 changed files with 11 additions and 13 deletions

View File

@ -2087,21 +2087,19 @@ strategyFunctions = {
digFight = function()
if battle.isActive() then
canProgress = true
local backupIndex = pokemon.indexOf("paras", "squirtle")
if pokemon.isDeployed("nidoking") then
if pokemon.info("nidoking", "hp") == 0 then
if utils.onPokemonSelect(memory.value("battle", "menu")) then
menu.select(backupIndex, true)
else
input.press("A")
end
else
battle.automate()
local currentlyDead = memory.double("battle", "our_hp") == 0
if currentlyDead then
local backupPokemon = pokemon.getSacrifice("paras", "squirtle")
if not backupPokemon then
return resetDeath()
end
if utils.onPokemonSelect(memory.value("battle", "menu")) then
menu.select(pokemon.indexOf(backupPokemon), true)
else
input.press("A")
end
elseif pokemon.info("nidoking", "hp") == 0 and pokemon.index(backupIndex, "hp") == 0 and pokemon.isDeployed("paras", "squirtle") then
return resetDeath()
else
battle.fight("dig")
battle.automate()
end
elseif canProgress then
return true