From 93b1b67baf3766f702eac878f78a729e7761fca7 Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Wed, 9 May 2012 21:48:04 +0000
Subject: [PATCH] change

git-svn-id: http://svn.net-core.org/repos/t-engine4@5118 51575b47-30f0-44d4-a5cc-537603b46e54
---
 game/modules/tome/class/interface/Archery.lua |  4 +---
 game/modules/tome/class/interface/Combat.lua  | 14 +++++++-------
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/game/modules/tome/class/interface/Archery.lua b/game/modules/tome/class/interface/Archery.lua
index c120548164..94702b54b2 100644
--- a/game/modules/tome/class/interface/Archery.lua
+++ b/game/modules/tome/class/interface/Archery.lua
@@ -149,9 +149,7 @@ local function archery_projectile(tx, ty, tg, self, tmp)
 		print("[ATTACK ARCHERY] after range", dam)
 
 		local crit
-		if tg.archery.crit_chance then self.combat_physcrit = self.combat_physcrit + tg.archery.crit_chance end
-		dam, crit = self:physicalCrit(dam, ammo, target, atk, def)
-		if tg.archery.crit_chance then self.combat_physcrit = self.combat_physcrit - tg.archery.crit_chance end
+		dam, crit = self:physicalCrit(dam, ammo, target, atk, def, tg.archery.crit_chance or 0, tg.archery.crit_power or 0)
 		print("[ATTACK ARCHERY] after crit", dam)
 
 		dam = dam * mult
diff --git a/game/modules/tome/class/interface/Combat.lua b/game/modules/tome/class/interface/Combat.lua
index a395c691a8..f89d6d005a 100644
--- a/game/modules/tome/class/interface/Combat.lua
+++ b/game/modules/tome/class/interface/Combat.lua
@@ -1131,11 +1131,11 @@ function _M:combatCritReduction()
 end
 
 --- Computes physical crit for a damage
-function _M:physicalCrit(dam, weapon, target, atk, def)
+function _M:physicalCrit(dam, weapon, target, atk, def, add_chance, crit_power_add)
 	local tier_diff = self:getTierDiff(atk, def)
 
-	local chance = self:combatCrit(weapon)
-	local crit_power_add = 0
+	local chance = self:combatCrit(weapon) + (add_chance or 0)
+	crit_power_add = crit_power_add or 0
 	local crit = false
 	if self:knowTalent(self.T_BACKSTAB) and target:attr("stunned") then chance = chance + self:getTalentLevel(self.T_BACKSTAB) * 10 end
 
@@ -1175,8 +1175,8 @@ function _M:physicalCrit(dam, weapon, target, atk, def)
 end
 
 --- Computes spell crit for a damage
-function _M:spellCrit(dam, add_chance)
-	local crit_power_add = 0
+function _M:spellCrit(dam, add_chance, crit_power_add)
+	crit_power_add = crit_power_add or 0
 	local chance = self:combatSpellCrit() + (add_chance or 0)
 	local crit = false
 
@@ -1215,8 +1215,8 @@ function _M:spellCrit(dam, add_chance)
 end
 
 --- Computes mind crit for a damage
-function _M:mindCrit(dam, add_chance)
-	local crit_power_add = 0
+function _M:mindCrit(dam, add_chance, crit_power_add)
+	crit_power_add = crit_power_add or 0
 	local chance = self:combatMindCrit() + (add_chance or 0)
 	local crit = false
 
-- 
GitLab