From d291fa8d99cb155b28a48302076ab467660d172a Mon Sep 17 00:00:00 2001 From: Mikolai Fajer Date: Wed, 9 Nov 2011 23:35:50 -0600 Subject: [PATCH 2/2] Added a CURE tactical option for removing detrimental effects. --- game/modules/tome/ai/tactical.lua | 15 ++++++++++- game/modules/tome/data/talents/celestial/light.lua | 2 +- .../data/talents/chronomancy/age-manipulation.lua | 2 +- .../tome/data/talents/chronomancy/paradox.lua | 2 +- .../tome/data/talents/chronomancy/timetravel.lua | 2 +- .../tome/data/talents/misc/inscriptions.lua | 15 ++++++++++- game/modules/tome/data/talents/misc/misc.lua | 10 +++++- game/modules/tome/data/talents/misc/npcs.lua | 9 +++++- game/modules/tome/data/talents/misc/races.lua | 28 ++++++++++++++++++- game/modules/tome/data/talents/spells/fire.lua | 6 +++- game/modules/tome/data/talents/spells/wildfire.lua | 7 ++++- 11 files changed, 85 insertions(+), 13 deletions(-) diff --git a/game/modules/tome/ai/tactical.lua b/game/modules/tome/ai/tactical.lua index 5337659..a49eba1 100644 --- a/game/modules/tome/ai/tactical.lua +++ b/game/modules/tome/ai/tactical.lua @@ -118,7 +118,7 @@ newAI("use_tactical", function(self) end -- Evaluate the tactical weights and weight functions for tact, val in pairs(t.tactical) do - if type(val) == "function" then val = val(self, t, self.ai_target.actor) end + if type(val) == "function" then val = val(self, t, self.ai_target.actor) or 0 end -- Handle damage_types and resistances local nb_foes_hit, nb_allies_hit, nb_self_hit = 0, 0, 0 if type(val) == "table" then @@ -316,6 +316,19 @@ newAI("use_tactical", function(self) table.sort(avail.defend, function(a,b) return a.val > b.val end) want.defend = 1 + need_heal / 2 + nb_foes_seen * 0.5 end + + -- Need cure (remove detrimental effects) + local nb_detrimental_effs = 0 + for eff_id, p in pairs(self.tmp) do + local e = self.tempeffect_def[eff_id] + if e.status == "detrimental" then + nb_detrimental_effs = nb_detrimental_effs + 1 + end + end + if avail.cure and nb_detrimental_effs > 0 then + table.sort(avail.defend, function(a,b) return a.val > b.val end) + want.cure = nb_detrimental_effs + end -- Attacks if avail.attack and self.ai_target.actor then diff --git a/game/modules/tome/data/talents/celestial/light.lua b/game/modules/tome/data/talents/celestial/light.lua index 76100db..806a5bc 100644 --- a/game/modules/tome/data/talents/celestial/light.lua +++ b/game/modules/tome/data/talents/celestial/light.lua @@ -113,7 +113,7 @@ newTalent{ random_ego = "defensive", positive = -20, cooldown = 30, - tactical = { HEAL = 2.5 }, + tactical = { HEAL = 1, CURE = 2 }, getRegeneration = function(self, t) return self:combatTalentSpellDamage(t, 10, 50) end, getDuration = function(self, t) return 2 + math.ceil(self:getTalentLevel(t)) end, action = function(self, t) diff --git a/game/modules/tome/data/talents/chronomancy/age-manipulation.lua b/game/modules/tome/data/talents/chronomancy/age-manipulation.lua index e130b21..4d23e78 100644 --- a/game/modules/tome/data/talents/chronomancy/age-manipulation.lua +++ b/game/modules/tome/data/talents/chronomancy/age-manipulation.lua @@ -157,7 +157,7 @@ newTalent{ points = 5, paradox = 10, cooldown = 10, - tactical = { HEAL = 2 }, + tactical = { HEAL = 2, CURE = 2 }, getHeal = function(self, t) return self:combatTalentSpellDamage(t, 40, 440)*getParadoxModifier(self, pm) end, getRemoveCount = function(self, t) return math.floor(self:getTalentLevel(t)) end, action = function(self, t) diff --git a/game/modules/tome/data/talents/chronomancy/paradox.lua b/game/modules/tome/data/talents/chronomancy/paradox.lua index 2a4fd1c..fe420b5 100644 --- a/game/modules/tome/data/talents/chronomancy/paradox.lua +++ b/game/modules/tome/data/talents/chronomancy/paradox.lua @@ -121,7 +121,7 @@ newTalent{ points = 5, paradox = 10, cooldown = 24, - tactical = { DEFEND = 2 }, + tactical = { DEFEND = 2, CURE = 2 }, getResist = function(self, t) return self:combatTalentSpellDamage(t, 10, 50) * getParadoxModifier(self, pm) end, action = function(self, t) self:setEffect(self.EFF_FADE_FROM_TIME, 10, {power=t.getResist(self, t)}) diff --git a/game/modules/tome/data/talents/chronomancy/timetravel.lua b/game/modules/tome/data/talents/chronomancy/timetravel.lua index 7daaa7b..9e8ffa0 100644 --- a/game/modules/tome/data/talents/chronomancy/timetravel.lua +++ b/game/modules/tome/data/talents/chronomancy/timetravel.lua @@ -161,7 +161,7 @@ newTalent{ points = 5, paradox = 20, cooldown = 50, - tactical = { BUFF = 0.5 }, + tactical = { BUFF = 0.5, CURE = 0.5 }, message = "@Source@ manipulates the flow of time.", getCooldownReduction = function(self, t) return 1 + math.floor(self:getTalentLevel(t) * getParadoxModifier(self, pm)) end, action = function(self, t) diff --git a/game/modules/tome/data/talents/misc/inscriptions.lua b/game/modules/tome/data/talents/misc/inscriptions.lua index e54a994..ff84ceb 100644 --- a/game/modules/tome/data/talents/misc/inscriptions.lua +++ b/game/modules/tome/data/talents/misc/inscriptions.lua @@ -108,7 +108,20 @@ newInscription{ type = {"inscriptions/infusions", 1}, points = 1, no_energy = true, - tactical = { DEFEND = 3 }, + tactical = { + DEFEND = 3, + CURE = function(self, t, target) + local nb = 0 + local data = self:getInscriptionData(t.short_name) + for eff_id, p in pairs(self.tmp) do + local e = self.tempeffect_def[eff_id] + if data.what[e.type] and e.status == "detrimental" then + nb = nb + 1 + end + end + return nb + end + }, action = function(self, t) local data = self:getInscriptionData(t.short_name) diff --git a/game/modules/tome/data/talents/misc/misc.lua b/game/modules/tome/data/talents/misc/misc.lua index c2eca59..40174c4 100644 --- a/game/modules/tome/data/talents/misc/misc.lua +++ b/game/modules/tome/data/talents/misc/misc.lua @@ -192,8 +192,14 @@ newTalent{ points = 5, no_energy = true, cooldown = function(self, t) return 55 - self:getTalentLevel(t) * 5 end, - tactical = { DEFEND = 2 }, - + tactical = { CURE = function(self, t, target) + local nb = 0 + for eff_id, p in pairs(self.tmp) do + local e = self.tempeffect_def[eff_id] + if e.status == "detrimental" then nb = nb + 1 end + end + return nb + end}, action = function(self, t) local target = self local todel = {} diff --git a/game/modules/tome/data/talents/misc/npcs.lua b/game/modules/tome/data/talents/misc/npcs.lua index 2526938..d134ba8 100644 --- a/game/modules/tome/data/talents/misc/npcs.lua +++ b/game/modules/tome/data/talents/misc/npcs.lua @@ -575,7 +575,14 @@ newTalent{ points = 5, mana = 30, cooldown = 15, - tactical = { PROTECT = 1 }, + tactical = { CURE = function(self, t, target) + local nb = 0 + for eff_id, p in pairs(self.tmp) do + local e = self.tempeffect_def[eff_id] + if e.subtype.poison or e.subtype.disease then nb = nb + 1 end + end + return nb + end }, getCureCount = function(self, t) return math.floor(self:getTalentLevel(t)) end, action = function(self, t) local target = self diff --git a/game/modules/tome/data/talents/misc/races.lua b/game/modules/tome/data/talents/misc/races.lua index 50f6435..6953a5f 100644 --- a/game/modules/tome/data/talents/misc/races.lua +++ b/game/modules/tome/data/talents/misc/races.lua @@ -216,7 +216,22 @@ newTalent{ points = 5, no_energy = true, cooldown = function(self, t) return 50 - self:getTalentLevel(t) * 3 end, - tactical = { DEFEND = 2 }, + tactical = { + BUFF = function(self, t, target) + local nb = 0 + for eff_id, p in pairs(self.tmp) do + if e.status == "beneficial" then nb = nb + 1 end + end + return nb + end, + CURE = function(self, t, target) + local nb = 0 + for eff_id, p in pairs(self.tmp) do + if e.status == "detrimental" then nb = nb + 1 end + end + return nb + end, + }, action = function(self, t) local target = self local todel = {} @@ -601,7 +616,16 @@ newTalent{ points = 5, no_energy = true, cooldown = function(self, t) return 50 - self:getTalentLevel(t) * 4 end, - tactical = { DEFEND = 1, HEAL = 2 }, + tactical = { DEFEND = 1, HEAL = 2, CURE = function(self, t, target) + local nb = 0 + for eff_id, p in pairs(target.tmp) do + local e = target.tempeffect_def[eff_id] + if e.status == "detrimental" and (e.type == "physical" or e.type == "magical" or e.type == "mental") then + nb = nb + 1 + end + end + return nb + end }, action = function(self, t) local target = self local effs = {} diff --git a/game/modules/tome/data/talents/spells/fire.lua b/game/modules/tome/data/talents/spells/fire.lua index d925428..d1b74ff 100644 --- a/game/modules/tome/data/talents/spells/fire.lua +++ b/game/modules/tome/data/talents/spells/fire.lua @@ -82,7 +82,11 @@ newTalent{ random_ego = "attack", mana = 30, cooldown = 18, - tactical = { ATTACK = { FIRE = 1 }, DISABLE = { stun = 3 } }, + tactical = { ATTACK = { FIRE = 1 }, DISABLE = { stun = 3 }, CURE = function(self, t, target) + if self:attr("burning_wake") and self:attr("cleansing_flame") then + return 1 + end + end }, range = 0, radius = function(self, t) return 3 + self:getTalentLevelRaw(t) diff --git a/game/modules/tome/data/talents/spells/wildfire.lua b/game/modules/tome/data/talents/spells/wildfire.lua index d816498..2bc50a0 100644 --- a/game/modules/tome/data/talents/spells/wildfire.lua +++ b/game/modules/tome/data/talents/spells/wildfire.lua @@ -24,7 +24,12 @@ newTalent{ points = 5, mana = 12, cooldown = 5, - tactical = { ATTACKAREA = { FIRE = 2 }, DISABLE = { knockback = 2 }, ESCAPE = { knockback = 2 } }, + tactical = { ATTACKAREA = { FIRE = 2 }, DISABLE = { knockback = 2 }, ESCAPE = { knockback = 2 }, + CURE = function(self, t, target) + if self:attr("burning_wake") and self:attr("cleansing_flame") then + return 1 + end + end }, direct_hit = true, requires_target = true, range = 0, -- 1.7.4.1