From 38bd21b88898e9add042a79a1e152349059c0020 Mon Sep 17 00:00:00 2001 From: Kyle Coburn Date: Fri, 10 Apr 2015 01:38:35 -0700 Subject: [PATCH] Resolve memory table collision --- ai/combat.lua | 8 ++++---- ai/control.lua | 2 +- ai/red/strategies.lua | 4 ++-- data/movelist.lua | 2 +- util/memory.lua | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ai/combat.lua b/ai/combat.lua index a5c44e7..3f20562 100644 --- a/ai/combat.lua +++ b/ai/combat.lua @@ -344,11 +344,11 @@ function Combat.inKillRange(draw) hpReq = hpReq + math.floor(ours.hp * 0.2) end if ours.hp <= hpReq then - local outspeed = enemyAttack.outspeed - if outspeed and outspeed ~= true then - outspeed = Memory.value("battle", "turns") > 0 + local outsped = enemyAttack.outspeed + if outsped and outsped ~= true then + outsped = Memory.value("battle", "attack_turns") > 0 end - if outspeed or isConfused or turnsToKill > 1 or ours.speed <= enemy.speed or isSleeping() then + if outsped or isConfused or turnsToKill > 1 or ours.speed <= enemy.speed or isSleeping() then return ours, hpReq end end diff --git a/ai/control.lua b/ai/control.lua index 2fc699b..9eaec2e 100644 --- a/ai/control.lua +++ b/ai/control.lua @@ -331,7 +331,7 @@ function Control.encounter(battleState) end end elseif Control.inBattle then - if Memory.value("battle", "turns") == 0 then + if Memory.value("battle", "battle_turns") == 0 then Control.escaped = true end Control.inBattle = false diff --git a/ai/red/strategies.lua b/ai/red/strategies.lua index b62d077..2f5d099 100644 --- a/ai/red/strategies.lua +++ b/ai/red/strategies.lua @@ -670,7 +670,7 @@ end strategyFunctions.shortsKid = function() local fightingEkans = Pokemon.isOpponent("ekans") if fightingEkans then - local wrapping = Memory.value("battle", "turns") > 0 + local wrapping = Memory.value("battle", "attack_turns") > 0 if wrapping then local curr_hp = Memory.double("battle", "our_hp") if not status.wrappedAt then @@ -2263,7 +2263,7 @@ strategyFunctions.blue = function() local forced = "horn_drill" - if Memory.value("battle", "turns") > 0 then + if Memory.value("battle", "attack_turns") > 0 then local skyDamage = Combat.healthFor("BlueSky") local healCutoff = skyDamage * 0.825 if Strategies.initialize() then diff --git a/data/movelist.lua b/data/movelist.lua index ab1ef08..1e45323 100644 --- a/data/movelist.lua +++ b/data/movelist.lua @@ -279,7 +279,7 @@ local moves = { id = 31, move_type = 'normal', special = false, - outspeed = true, + outspeed = "turns", power = 15, max_pp = 20, accuracy = 85, diff --git a/util/memory.lua b/util/memory.lua index 16b8dfa..cb54a26 100644 --- a/util/memory.lua +++ b/util/memory.lua @@ -58,7 +58,7 @@ local memoryNames = { exp3 = 0x117B, }, battle = { - turns = 0x1067, + attack_turns = 0x1067, text = 0x1125, menu = 0x0C50, accuracy = 0x0D1E, @@ -72,7 +72,7 @@ local memoryNames = { critical = 0x105E, miss = 0x105F, our_turn = 0x1FF1, - turns = 0x0CD5, + battle_turns = 0x0CD5, opponent_bide = 0x106F, opponent_id = 0x0FE5,