From 9b8f9a396840860ec73eb3badffdaac89ce44eb5 Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Sun, 23 Jan 2011 22:57:35 +0000
Subject: [PATCH] Archery now correctly uses attack bonus from ammo

git-svn-id: http://svn.net-core.org/repos/t-engine4@2476 51575b47-30f0-44d4-a5cc-537603b46e54
---
 game/modules/tome/class/interface/Archery.lua |  2 +-
 game/modules/tome/class/interface/Combat.lua  | 23 +++++++++----------
 .../modules/tome/data/general/npcs/horror.lua |  2 +-
 3 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/game/modules/tome/class/interface/Archery.lua b/game/modules/tome/class/interface/Archery.lua
index 11121ae60f..4104e22466 100644
--- a/game/modules/tome/class/interface/Archery.lua
+++ b/game/modules/tome/class/interface/Archery.lua
@@ -121,7 +121,7 @@ local function archery_projectile(tx, ty, tg, self)
 	local mult = tg.archery.mult or 1
 
 	-- Does the blow connect? yes .. complex :/
-	local atk, def = self:combatAttack(weapon), target:combatDefenseRanged()
+	local atk, def = self:combatAttack(weapon, ammo), target:combatDefenseRanged()
 	local dam, apr, armor = self:combatDamage(ammo), self:combatAPR(ammo), target:combatArmor()
 	print("[ATTACK ARCHERY] to ", target.name, " :: ", dam, apr, armor, "::", mult)
 	if not self:canSee(target) then atk = atk / 3 end
diff --git a/game/modules/tome/class/interface/Combat.lua b/game/modules/tome/class/interface/Combat.lua
index b16cdca72b..8fc6021868 100644
--- a/game/modules/tome/class/interface/Combat.lua
+++ b/game/modules/tome/class/interface/Combat.lua
@@ -417,32 +417,31 @@ function _M:combatArmor()
 end
 
 --- Gets the attack
-function _M:combatAttack(weapon)
+function _M:combatAttackBase(weapon, ammo)
 	weapon = weapon or self.combat or {}
+	return self.combat_atk + self:getTalentLevel(Talents.T_WEAPON_COMBAT) * 5 + (weapon.atk or 0) + (ammo and ammo.atk or 0) + (self:getLck() - 50) * 0.4
+end
+function _M:combatAttack(weapon, ammo)
 	local stats
 	if self.use_psi_combat then stats = (self:getWil(50) - 5) + (self:getCun(50) - 5)
 	else stats = (self:getStr(50) - 5) + (self:getDex(50) - 5)
 	end
-
-	return self.combat_atk + self:getTalentLevel(Talents.T_WEAPON_COMBAT) * 5 + (weapon.atk or 0) + stats + (self:getLck() - 50) * 0.4
+	return self:combatAttackBase(weapon, ammo) + stats
 end
 
 --- Gets the attack using only strength
-function _M:combatAttackStr(weapon)
-	weapon = weapon or self.combat or {}
-	return self.combat_atk + self:getTalentLevel(Talents.T_WEAPON_COMBAT) * 5 + (weapon.atk or 0) + (self:getStr(100) - 10) + (self:getLck() - 50) * 0.4
+function _M:combatAttackStr(weapon, ammo)
+	return self:combatAttackBase(weapon, ammo) + (self:getStr(100) - 10)
 end
 
 --- Gets the attack using only dexterity
-function _M:combatAttackDex(weapon)
-	weapon = weapon or self.combat or {}
-	return self.combat_atk + self:getTalentLevel(Talents.T_WEAPON_COMBAT) * 5 + (weapon.atk or 0) + (self:getDex(100) - 10) + (self:getLck() - 50) * 0.4
+function _M:combatAttackDex(weapon, ammo)
+	return self:combatAttackBase(weapon, ammo) + (self:getDex(100) - 10)
 end
 
 --- Gets the attack using only magic
-function _M:combatAttackDex(weapon)
-	weapon = weapon or self.combat or {}
-	return self.combat_atk + self:getTalentLevel(Talents.T_WEAPON_COMBAT) * 5 + (weapon.atk or 0) + (self:getMag(100) - 10) + (self:getLck() - 50) * 0.4
+function _M:combatAttackMag(weapon, ammo)
+	return self:combatAttackBase(weapon, ammo) + (self:getMag(100) - 10)
 end
 
 --- Gets the armor penetration
diff --git a/game/modules/tome/data/general/npcs/horror.lua b/game/modules/tome/data/general/npcs/horror.lua
index a0ebca5c65..bc55e07bea 100644
--- a/game/modules/tome/data/general/npcs/horror.lua
+++ b/game/modules/tome/data/general/npcs/horror.lua
@@ -431,7 +431,7 @@ newEntity{ base = "BASE_NPC_HORROR",
 newEntity{ base = "BASE_NPC_HORROR",
 	subtype = "temporal",
 	name = "temporal devourer", color=colors.CRIMSON,
-	desc = "A headless round creature with stubly legs and arms.  It's body seems to be all teeth.",
+	desc = "A headless round creature with stubtly legs and arms.  Its body seems to be all teeth.",
 	level_range = {10, nil}, exp_worth = 1,
 	rarity = 1,
 	rank = 2,
-- 
GitLab