Describe deaths involving Confusion/Sand-Attack, standardize check for Sand-attack, fix timing of Thrash Confusion messages

This commit is contained in:
Kyle Coburn 2015-04-24 21:09:24 -07:00
parent ba3f8b780e
commit bfc6a8ad0b
4 changed files with 33 additions and 15 deletions

View File

@ -2,9 +2,10 @@ local Combat = {}
local Movelist = require "data.movelist"
local Opponents = require "data.opponents"
local Utils = require "util.utils"
local Memory = require "util.memory"
local Utils = require "util.utils"
local Pokemon = require "storage.pokemon"
local damageMultiplier = { -- http://bulbapedia.bulbagarden.net/wiki/Type_chart#Generation_I
@ -315,6 +316,10 @@ local function isConfused()
end
Combat.isConfused = isConfused
function Combat.sandAttacked()
return Memory.value("battle", "accuracy") < 7
end
-- HP
function Combat.hp()

View File

@ -306,7 +306,7 @@ function Control.encounter(battleState)
if turnMarker == 100 or turnMarker == 128 then
local isMiss = Memory.value("battle", "miss") == 1
if isMiss then
if not Control.ignoreMiss and Battle.accurateAttack and Memory.value("battle", "accuracy") == 7 then
if not Control.ignoreMiss and Battle.accurateAttack and not Combat.sandAttacked() then
local exclaim = Strategies.deepRun and ";_; " or ""
Bridge.chat("gen 1 missed "..exclaim.."(1 in 256 chance)")
end

View File

@ -965,10 +965,15 @@ strategyFunctions.thrashGeodude = function()
Bridge.chat(" Thrash didn't finish the kill :( swapping to Squirtle for safety.")
end
elseif Pokemon.isOpponent("geodude") and Battle.opponentAlive() and Combat.isConfused() then
if Strategies.initialize() then
status.sacrificeSquirtle = not Control.yolo or Combat.inRedBar()
if Menu.onBattleSelect() and Strategies.initialize("shouldSacrifice") then
if not Control.yolo or Combat.inRedBar() then
status.sacrificeSquirtle = true
else
local __, turnsToKill = Combat.bestMove()
status.sacrificeSquirtle = turnsToKill > 1
end
if not status.sacrificeSquirtle then
Bridge.chat("is attempting to hit through confusion to avoid switching out to Squirtle...")
Bridge.chat("is attempting to hit through Confusion to avoid switching out to Squirtle...")
end
end
end
@ -1058,16 +1063,18 @@ strategyFunctions.fightMisty = function()
sacrifice = Pokemon.getSacrifice("pidgey", "spearow", "squirtle", "paras")
end
if Strategies.initialize("sacrificed") then
local swapMessage = " Thrash didn't finish the kill :( "
if sacrifice then
swapMessage = swapMessage.."Swapping out to cure Confusion."
elseif Control.yolo then
swapMessage = swapMessage.."Attempting to hit through Confusion to save time."
else
swapMessage = swapMessage.."We'll have to hit through Confusion here."
if Menu.onBattleSelect() then
if Strategies.initialize("sacrificed") then
local swapMessage = " Thrash didn't finish the kill :( "
if sacrifice then
swapMessage = swapMessage.."Swapping out to cure Confusion."
elseif Control.yolo then
swapMessage = swapMessage.."Attempting to hit through Confusion to save time."
else
swapMessage = swapMessage.."We'll have to hit through Confusion here."
end
Bridge.chat(swapMessage)
end
Bridge.chat(swapMessage)
end
if sacrifice and Battle.sacrifice(sacrifice) then
return false

View File

@ -85,10 +85,16 @@ function Strategies.death(extra)
if Control.missed then
explanation = "Missed"
reason = "miss"
elseif Combat.isConfused() then
explanation = "Confusion'd"
reason = "confusion"
elseif Control.criticaled then
explanation = "Critical'd"
reason = "critical"
elseif Control.yolo and stats.nidoran then
elseif Combat.sandAttacked() then
explanation = "Sand-Attack'd"
reason = "accuracy"
elseif Control.yolo and stats.nidoran and stats.nidoran.attack then
explanation = "Yolo strats"
reason = "yolo"
else