class:bindHook("ToME:load", function(self, data) local Talents = require "engine.interface.ActorTalents" local DamageType = require "engine.DamageType" if Talents.talents_def.T_ATTUNE_MINDSTAR then Talents.talents_def.T_ATTUNE_MINDSTAR.action = function(self, t) -- do nothing if disarmed if self:attr("disarmed") then return nil end local hasValidMindstar = function(who, slot) local o = who:getInven(slot) and who: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[who.T_ATTUNE_MINDSTAR] then return nil end return o end local mh = hasValidMindstar(self, "MAINHAND") local oh = hasValidMindstar(self, "OFFHAND") local tk = 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 -- update damage types local attune = function (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(mh, wanted) attune(oh, wanted) attune(tk, wanted) end end end)