From f7eb347772b41ecba8c821aacc23e863a28309b8 Mon Sep 17 00:00:00 2001 From: Hachem_Muche <Hachem_Muche@stanfordalumni.org> Date: Tue, 14 Feb 2017 13:24:15 -0800 Subject: [PATCH] Fix Throwing Knives talent abuse. --- .../talents/techniques/throwing-knives.lua | 22 +++++++++---------- .../modules/tome/data/timed_effects/other.lua | 5 +++-- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/game/modules/tome/data/talents/techniques/throwing-knives.lua b/game/modules/tome/data/talents/techniques/throwing-knives.lua index 5c998d26c5..6ef9e674ff 100644 --- a/game/modules/tome/data/talents/techniques/throwing-knives.lua +++ b/game/modules/tome/data/talents/techniques/throwing-knives.lua @@ -106,15 +106,19 @@ newTalent{ stat = { dex=function(level) return 12 + (level-1) * 2 end }, level = function(level) return 0 + (level-1) * 8 end, }, --- need to fix talent toggling abuse on_learn = function(self, t) venomous_throw_check(self) - local max = self:callTalent(self.T_THROWING_KNIVES, "getNb") - self:setEffect(self.EFF_THROWING_KNIVES, 1, {stacks=max, max_stacks=max }) + self:setEffect(self.EFF_THROWING_KNIVES, 1, {stacks=0, max_stacks=t.getNb(self, t)}) end, on_unlearn = function(self, t) venomous_throw_check(self) - self:removeEffect(self.EFF_THROWING_KNIVES) + if self:knowTalent(t.id) then + if self:hasEffect(self.EFF_THROWING_KNIVES) then + self:setEffect(self.EFF_THROWING_KNIVES, 1, {stacks=0, max_stacks=t.getNb(self, t)}) + end + else + self:removeEffect(self.EFF_THROWING_KNIVES) + end end, speed = "throwing", proj_speed = 10, @@ -126,9 +130,7 @@ newTalent{ end, on_pre_use = function(self, t) local eff = self:hasEffect(self.EFF_THROWING_KNIVES) - if eff then - return true - end + if eff and eff.stacks > 0 then return true end end, callbackOnActBase = function(self, t) if self.resting then @@ -307,7 +309,7 @@ newTalent{ if not hitted or self.turn_procs.quickdraw or core.fov.distance(self.x, self.y, target.x, target.y) > 1 or not rng.percent(t.getChance(self,t)) then return nil end local eff = self:hasEffect(self.EFF_THROWING_KNIVES) - if not eff then return end + if not eff or eff.stacks <= 0 then return end local tg = {type="ball", range=0, radius=7, friendlyfire=false, selffire=false } local tgts = {} @@ -354,9 +356,7 @@ newTalent{ end, on_pre_use = function(self, t) local eff = self:hasEffect(self.EFF_THROWING_KNIVES) - if eff then - return true - end + if eff and eff.stacks > 0 then return true end end, action = function(self, t) local tg = self:getTalentTarget(t) diff --git a/game/modules/tome/data/timed_effects/other.lua b/game/modules/tome/data/timed_effects/other.lua index ad999805a6..03f45edbfa 100644 --- a/game/modules/tome/data/timed_effects/other.lua +++ b/game/modules/tome/data/timed_effects/other.lua @@ -3078,12 +3078,13 @@ newEffect{ display_desc = function(self, eff) return eff.stacks.." Knives" end, long_desc = function(self, eff) return ("Has %d throwing knives prepared:\n\n%s"):format(eff.stacks, self:callTalent(self.T_THROWING_KNIVES, "knivesInfo")) end, type = "other", - subtype = { }, + subtype = { tactic=true }, status = "beneficial", - parameters = { stacks=1, max_stacks=10 }, + parameters = { stacks=1, max_stacks=6 }, charges = function(self, eff) return eff.stacks end, on_merge = function(self, old_eff, new_eff) old_eff.dur = new_eff.dur + old_eff.max_stacks = new_eff.max_stacks old_eff.stacks = util.bound(old_eff.stacks + new_eff.stacks, 1, new_eff.max_stacks) return old_eff end, -- GitLab