From f2ab2619599afc10e46b796f4932610dccc7d98c Mon Sep 17 00:00:00 2001 From: Kyle Coburn Date: Mon, 4 May 2015 19:05:41 -0700 Subject: [PATCH] Account for crits carry over for bind/wrap turns --- ai/combat.lua | 12 +++++++++++- data/movelist.lua | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ai/combat.lua b/ai/combat.lua index fc92a14..510da25 100644 --- a/ai/combat.lua +++ b/ai/combat.lua @@ -59,6 +59,12 @@ local function isDisabled(move) end Combat.isDisabled = isDisabled +local function xAccuracy() + local skipAccuracyCheck = 0x1 + return bit.band(Memory.value("battle", "x_accuracy"), skipAccuracyCheck) == skipAccuracyCheck +end +Combat.xAccuracy = xAccuracy + local function calcDamage(move, attacker, defender, rng) if move.fixed then return move.fixed, move.fixed @@ -67,7 +73,7 @@ local function calcDamage(move, attacker, defender, rng) return 0, 0 end if move.power > 9000 then - if Memory.value("battle", "x_accuracy") == 1 and defender.speed < attacker.speed then + if xAccuracy() and defender.speed < attacker.speed then return 9001, 9001 end return 0, 0 @@ -382,6 +388,10 @@ function Combat.inKillRange(draw) if ours.hp <= hpReq then local outsped = enemyAttack.outspeed if outsped and outsped ~= true then + if Memory.value("battle", "critical") == 1 then + hpReq = hpReq * 2 + p("WB crit!", hpReq) + end outsped = Memory.value("battle", "attack_turns") > 0 end if outsped or isConfused or turnsToKill > 1 or ours.speed <= enemy.speed or isSleeping() then diff --git a/data/movelist.lua b/data/movelist.lua index 6fe2fa4..069e2c9 100644 --- a/data/movelist.lua +++ b/data/movelist.lua @@ -179,6 +179,7 @@ local moves = { id = 20, move_type = 'normal', special = false, + outspeed = "turns", power = 15, max_pp = 20, accuracy = 85,