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

View File

@ -306,7 +306,7 @@ function Control.encounter(battleState)
if turnMarker == 100 or turnMarker == 128 then if turnMarker == 100 or turnMarker == 128 then
local isMiss = Memory.value("battle", "miss") == 1 local isMiss = Memory.value("battle", "miss") == 1
if isMiss then 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 "" local exclaim = Strategies.deepRun and ";_; " or ""
Bridge.chat("gen 1 missed "..exclaim.."(1 in 256 chance)") Bridge.chat("gen 1 missed "..exclaim.."(1 in 256 chance)")
end end

View File

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

View File

@ -85,10 +85,16 @@ function Strategies.death(extra)
if Control.missed then if Control.missed then
explanation = "Missed" explanation = "Missed"
reason = "miss" reason = "miss"
elseif Combat.isConfused() then
explanation = "Confusion'd"
reason = "confusion"
elseif Control.criticaled then elseif Control.criticaled then
explanation = "Critical'd" explanation = "Critical'd"
reason = "critical" 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" explanation = "Yolo strats"
reason = "yolo" reason = "yolo"
else else