From 18af5a8520f1e3401012324a7c5d763495b8d1ad Mon Sep 17 00:00:00 2001 From: Eric Wykoff <ericwykoff@yahoo.com> Date: Fri, 2 Jan 2015 15:52:09 -0600 Subject: [PATCH] warden weapon swapping now works with Attack and Shoot --- game/modules/tome/class/Actor.lua | 2 ++ game/modules/tome/data/talents/misc/misc.lua | 2 ++ game/modules/tome/data/talents/techniques/archery.lua | 6 ++++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua index af5ad4c398..5de1795835 100644 --- a/game/modules/tome/class/Actor.lua +++ b/game/modules/tome/class/Actor.lua @@ -4029,6 +4029,7 @@ function _M:learnTalent(t_id, force, nb, extra) if t.is_spell then self:attr("has_arcane_knowledge", nb or 1) end if t.is_antimagic then self:attr("forbid_arcane", nb or 1) end + if t.type[1]:find("^chronomancy/bow") or t.type[1]:find("^chronomancy/blade") then self:attr("warden_swap", nb or 1) end if t.dont_provide_pool then return true end @@ -4207,6 +4208,7 @@ function _M:unlearnTalent(t_id, nb, no_unsustain, extra) if t.is_spell then self:attr("has_arcane_knowledge", -nb) end if t.is_antimagic then self:attr("forbid_arcane", -nb) end + if t.type[1]:find("^chronomancy/bow") or t.type[1]:find("^chronomancy/blade") then self:attr("warden_swap", -nb) end -- If we learn mindslayer things we learn telekinetic grasp & beyond the flesh if t.autolearn_mindslayer then diff --git a/game/modules/tome/data/talents/misc/misc.lua b/game/modules/tome/data/talents/misc/misc.lua index 1e947286b0..ebb3c93f02 100644 --- a/game/modules/tome/data/talents/misc/misc.lua +++ b/game/modules/tome/data/talents/misc/misc.lua @@ -52,6 +52,8 @@ newTalent{ speed = 'weapon', is_melee = true, action = function(self, t) + local swap = self:attr("warden_swap") and doWardenWeaponSwap(self, t, 0, "blade") + local tg = self:getTalentTarget(t) local x, y = self:getTarget(tg) if not x then return end diff --git a/game/modules/tome/data/talents/techniques/archery.lua b/game/modules/tome/data/talents/techniques/archery.lua index 090ac2f2dd..cbd4bbabdf 100644 --- a/game/modules/tome/data/talents/techniques/archery.lua +++ b/game/modules/tome/data/talents/techniques/archery.lua @@ -37,7 +37,7 @@ newTalent{ message = "@Source@ shoots!", requires_target = true, tactical = { ATTACK = { weapon = 1 } }, - 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, + on_pre_use = function(self, t, silent) if not (self:attr("warden_swap") and doWardenPreUse(self, "bow")) and 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, no_unlearn_last = true, use_psi_archery = function(self, t) local inven = self:getInven("PSIONIC_FOCUS") @@ -50,6 +50,8 @@ newTalent{ end end, action = function(self, t) + local swap = self:attr("warden_swap") and doWardenWeaponSwap(self, t, 0, "bow") + -- Most of the time use the normal shoot. if not self:hasArcheryWeapon("sling") or not self:isTalentActive("T_SKIRMISHER_BOMBARDMENT") then local targets = self:archeryAcquireTargets(nil, {one_shot=true}) @@ -57,7 +59,7 @@ newTalent{ self:archeryShoot(targets, t, nil, {use_psi_archery = t.use_psi_archery(self, t)}) return true end - + local weapon, ammo, offweapon = self:hasArcheryWeapon() if not weapon then return nil end local infinite = ammo.infinite or self:attr("infinite_ammo") -- GitLab