diff options
Diffstat (limited to 'auto-tune/data')
-rw-r--r-- | auto-tune/data/attune-mindstar.lua | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/auto-tune/data/attune-mindstar.lua b/auto-tune/data/attune-mindstar.lua new file mode 100644 index 0000000..7a4d9a6 --- /dev/null +++ b/auto-tune/data/attune-mindstar.lua @@ -0,0 +1,67 @@ +local Talents = require "engine.interface.ActorTalents" +local DamageType = require "engine.DamageType" + +attune_mindstar = Talents.talents_def.T_ATTUNE_MINDSTAR +if attune_mindstar then + attune_mindstar.hasValidMindstar = function(self, slot) + local o = self:getInven(slot) and self:getInven(slot)[1] + + if not o or not o.combat or not o.combat.talented == "mindstar" then + return nil + -- exclude fixedarts (those that don't teach Attune Mindstar) + elseif not o.wielder or not o.wielder.learn_talent or not o.wielder.learn_talent[self.T_ATTUNE_MINDSTAR] then + return nil + end + + return o + end -- hasValidMindstar + + attune_mindstar.attune = function(self, o, dt) + if not o then return end + o.combat.damtype = dt + game.logPlayer(self, "You attune your %s to deal %s%s#LAST# damage.", o:getName{do_color=1}, DamageType:get(dt).text_color, DamageType:get(dt).name) + end -- attune + + Talents.talents_def.T_ATTUNE_MINDSTAR.action = function(self, t) + -- do nothing if disarmed + if self:attr("disarmed") then + return nil + end + + local mh = t.hasValidMindstar(self, "MAINHAND") + local oh = t.hasValidMindstar(self, "OFFHAND") + local tk = t.hasValidMindstar(self, "PSIONIC_FOCUS") + + -- find the first valid mindstar so we can switch all of them to the opposite of that one + local primary = mh or oh or tk + if not primary then + game.logPlayer(self, "You can't attune a mindstar you're not wielding!") + return + end + + local wanted = DamageType.MIND + if primary.combat.damtype == DamageType.MIND then + wanted = DamageType.NATURE + end + + self._preferred_mindstar_type = wanted + + -- update damage types + t.attune(self, mh, wanted) + t.attune(self, oh, wanted) + t.attune(self, tk, wanted) + end --action + + attune_mindstar.callbackOnWear = function(self, t, o) + if not self._preferred_mindstar_type then return end + if not o or not o.combat or not o.combat.talented == "mindstar" then return end + if not o.wielder or not o.wielder.learn_talent or not o.wielder.learn_talent[self.T_ATTUNE_MINDSTAR] then return end + if o.combat.damtype == self._preferred_mindstar_type then return end + + t.attune(self, o, self._preferred_mindstar_type) + end --callbackOnWear + + attune_mindstar.info = function(self, t) + return ([[Alter the flow of energies of your equipped mindstars, changing their damage type between nature and mind.]]):tformat() + end +end |