From 35b1272e6c24e2f2d0f9305da2643a830c8ec97f Mon Sep 17 00:00:00 2001 From: Kyle Coburn Date: Mon, 27 Apr 2015 23:25:39 -0700 Subject: [PATCH] Update potioning at Shorts Kid and Misty --- ai/red/strategies.lua | 7 ++++++- data/opponents.lua | 25 +++++++++++++++++++++++++ util/utils.lua | 2 +- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/ai/red/strategies.lua b/ai/red/strategies.lua index fdd1c3a..b9157b3 100644 --- a/ai/red/strategies.lua +++ b/ai/red/strategies.lua @@ -673,6 +673,11 @@ strategyFunctions.bugCatcher = function() end end +strategyFunctions.potionBeforeShorts = function() + local potionHP = Combat.healthFor("ShortsRattata") * 2 + return strategyFunctions.potion({hp=potionHP}) +end + strategyFunctions.shortsKid = function() local fightingEkans = Pokemon.isOpponent("ekans") if fightingEkans then @@ -953,7 +958,7 @@ strategyFunctions.potionBeforeMisty = function(data) local isSpeedTie = stats.nidoran.speedDV == 11 local canSpeedTie = stats.nidoran.speedDV >= 11 if Control.yolo then - if canTwoHit and stats.nidoran.speedDV >= 13 then + if canTwoHit and stats.nidoran.speedDV >= 12 then healAmount = 46 elseif canTwoHit or canSpeedTie then healAmount = 66 diff --git a/data/opponents.lua b/data/opponents.lua index f5bf856..d7887fe 100644 --- a/data/opponents.lua +++ b/data/opponents.lua @@ -1,5 +1,30 @@ local Opponents = { + ShortsRattata = { + type2 = "normal", + type1 = "normal", + def = 14, + id = 165, + spec = 12, + hp = 29, + speed = 22, + level = 11, + att = 19, + + moves = { + { + name = "Quick-Attack", + accuracy = 100, + max_pp = 30, + power = 40, + id = 98, + special = false, + outspeed = true, + move_type = "normal", + } + } + }, + RivalGyarados = { type1 = "water", type2 = "flying", diff --git a/util/utils.lua b/util/utils.lua index ea668a4..dfc80a6 100644 --- a/util/utils.lua +++ b/util/utils.lua @@ -114,7 +114,7 @@ function Utils.canPotionWith(potion, forDamage, curr_hp, max_hp) else potion_hp = 20 end - return math.min(curr_hp + potion_hp, max_hp) >= forDamage - 1 + return math.min(curr_hp + potion_hp, max_hp) > forDamage end function Utils.ingame()