From 45388a8518bf8540e339c4c3c706abae80d7bb4b Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Sun, 23 Jan 2011 18:08:19 +0000
Subject: [PATCH] Archery talents now give a correct range

git-svn-id: http://svn.net-core.org/repos/t-engine4@2472 51575b47-30f0-44d4-a5cc-537603b46e54
---
 .../tome/data/talents/techniques/archery.lua        | 13 +++++++------
 game/modules/tome/data/talents/techniques/bow.lua   |  6 +++---
 game/modules/tome/data/talents/techniques/sling.lua |  6 +++---
 .../tome/data/talents/techniques/techniques.lua     |  8 ++++++++
 4 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/game/modules/tome/data/talents/techniques/archery.lua b/game/modules/tome/data/talents/techniques/archery.lua
index 2d33add50b..6bf51da617 100644
--- a/game/modules/tome/data/talents/techniques/archery.lua
+++ b/game/modules/tome/data/talents/techniques/archery.lua
@@ -24,7 +24,7 @@ newTalent{
 	no_energy = "fake",
 	hide = true,
 	points = 1,
-	range = 10,
+	range = archery_range,
 	message = "@Source@ shoots!",
 	requires_target = true,
 	tactical = { ATTACK = 1 },
@@ -49,7 +49,7 @@ newTalent{
 	cooldown = 3,
 	stamina = 8,
 	require = techs_dex_req1,
-	range = 10,
+	range = archery_range,
 	requires_target = true,
 	tactical = { ATTACK = 2 },
 	on_pre_use = function(self, t, silent) if not self:hasArcheryWeapon() then if not silent then game.logPlayer(self, "You require a bow or sling for this talent.") end return false end return true end,
@@ -154,7 +154,7 @@ newTalent{
 	cooldown = 14,
 	stamina = 35,
 	require = techs_dex_req4,
-	range = 10,
+	range = archery_range,
 	requires_target = true,
 	tactical = { ATTACK = 3 },
 	on_pre_use = function(self, t, silent) if not self:hasArcheryWeapon() then if not silent then game.logPlayer(self, "You require a bow or sling for this talent.") end return false end return true end,
@@ -178,6 +178,7 @@ newTalent{
 	points = 5,
 	cooldown = 15,
 	stamina = 15,
+	range = archery_range,
 	require = techs_dex_req1,
 	tactical = { ATTACKAREA = 2, DISABLE = 2 },
 	on_pre_use = function(self, t, silent) if not self:hasArcheryWeapon() then if not silent then game.logPlayer(self, "You require a bow or sling for this talent.") end return false end return true end,
@@ -219,7 +220,7 @@ newTalent{
 	cooldown = 10,
 	stamina = 15,
 	require = techs_dex_req2,
-	range = 10,
+	range = archery_range,
 	tactical = { ATTACK = 1, DISABLE = 1 },
 	requires_target = true,
 	on_pre_use = function(self, t, silent) if not self:hasArcheryWeapon() then if not silent then game.logPlayer(self, "You require a bow or sling for this talent.") end return false end return true end,
@@ -250,7 +251,7 @@ newTalent{
 	cooldown = 10,
 	stamina = 15,
 	require = techs_dex_req3,
-	range = 10,
+	range = archery_range,
 	tactical = { ATTACK = 1, DISABLE = 2 },
 	requires_target = true,
 	on_pre_use = function(self, t, silent) if not self:hasArcheryWeapon() then if not silent then game.logPlayer(self, "You require a bow or sling for this talent.") end return false end return true end,
@@ -284,7 +285,7 @@ newTalent{
 	cooldown = 14,
 	stamina = 15,
 	require = techs_dex_req4,
-	range = 10,
+	range = archery_range,
 	tactical = { ATTACKAREA = 2, DISABLE = 3 },
 	requires_target = true,
 	on_pre_use = function(self, t, silent) if not self:hasArcheryWeapon() then if not silent then game.logPlayer(self, "You require a bow or sling for this talent.") end return false end return true end,
diff --git a/game/modules/tome/data/talents/techniques/bow.lua b/game/modules/tome/data/talents/techniques/bow.lua
index 86033b6692..5bd4f5b0b6 100644
--- a/game/modules/tome/data/talents/techniques/bow.lua
+++ b/game/modules/tome/data/talents/techniques/bow.lua
@@ -36,7 +36,7 @@ newTalent{
 	cooldown = 8,
 	stamina = 15,
 	require = techs_dex_req2,
-	range = 10,
+	range = archery_range,
 	tactical = { ATTACK = 2 },
 	requires_target = true,
 	on_pre_use = function(self, t, silent) if not self:hasArcheryWeapon("bow") then if not silent then game.logPlayer(self, "You require a bow for this talent.") end return false end return true end,
@@ -61,7 +61,7 @@ newTalent{
 	cooldown = 8,
 	stamina = 15,
 	require = techs_dex_req3,
-	range = 10,
+	range = archery_range,
 	tactical = { ATTACKAREA = 1 },
 	requires_target = true,
 	on_pre_use = function(self, t, silent) if not self:hasArcheryWeapon("bow") then if not silent then game.logPlayer(self, "You require a bow for this talent.") end return false end return true end,
@@ -87,7 +87,7 @@ newTalent{
 	cooldown = 12,
 	stamina = 35,
 	require = techs_dex_req4,
-	range = 10,
+	range = archery_range,
 	direct_hit = true,
 	tactical = { ATTACKAREA = 2 },
 	requires_target = true,
diff --git a/game/modules/tome/data/talents/techniques/sling.lua b/game/modules/tome/data/talents/techniques/sling.lua
index b8661c71d3..b75f9886c1 100644
--- a/game/modules/tome/data/talents/techniques/sling.lua
+++ b/game/modules/tome/data/talents/techniques/sling.lua
@@ -36,7 +36,7 @@ newTalent{
 	cooldown = 8,
 	stamina = 15,
 	require = techs_dex_req2,
-	range = 10,
+	range = archery_range,
 	requires_target = true,
 	tactical = { ATTACK = 2, DISABLE = 2 },
 	on_pre_use = function(self, t, silent) if not self:hasArcheryWeapon("sling") then if not silent then game.logPlayer(self, "You require a sling for this talent.") end return false end return true end,
@@ -71,7 +71,7 @@ newTalent{
 	cooldown = 8,
 	stamina = 15,
 	require = techs_dex_req3,
-	range = 10,
+	range = archery_range,
 	requires_target = true,
 	tactical = { ATTACK = 2, DISABLE = 2, ESCAPE = 1 },
 	on_pre_use = function(self, t, silent) if not self:hasArcheryWeapon("sling") then if not silent then game.logPlayer(self, "You require a sling for this talent.") end return false end return true end,
@@ -105,7 +105,7 @@ newTalent{
 	cooldown = 12,
 	stamina = 35,
 	require = techs_dex_req4,
-	range = 10,
+	range = archery_range,
 	requires_target = true,
 	tactical = { ATTACK = 3 },
 	on_pre_use = function(self, t, silent) if not self:hasArcheryWeapon("sling") then if not silent then game.logPlayer(self, "You require a sling for this talent.") end return false end return true end,
diff --git a/game/modules/tome/data/talents/techniques/techniques.lua b/game/modules/tome/data/talents/techniques/techniques.lua
index 49a7a10124..3166b75217 100644
--- a/game/modules/tome/data/talents/techniques/techniques.lua
+++ b/game/modules/tome/data/talents/techniques/techniques.lua
@@ -125,6 +125,14 @@ techs_strdex_req5 = function(self, t) local stat = self:getStr() >= self:getDex(
 	level = function(level) return 16 + (level-1)  end,
 } end
 
+
+-- Archery range talents
+archery_range = function(self, t)
+	local weapon = self:hasArcheryWeapon()
+	if not weapon or not weapon.combat then return 1 end
+	return weapon.combat.range or 6
+end
+
 load("/data/talents/techniques/2hweapon.lua")
 load("/data/talents/techniques/dualweapon.lua")
 load("/data/talents/techniques/weaponshield.lua")
-- 
GitLab