Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- action = function(self, t)
- local target = self
- if self:getTalentLevel(t) >= 3 then
- local tg = {type="hit", range=self:getTalentRange(t)}
- local tx, ty = self:getTarget(tg)
- if tx and ty and game.level.map(tx, ty, Map.ACTOR) then
- local _ _, tx, ty = self:canProject(tg, tx, ty)
- if not tx then return nil end
- target = game.level.map(tx, ty, Map.ACTOR)
- if not target then return nil end
- target = game.level.map(tx, ty, Map.ACTOR)
- else return nil
- end
- end
- local effs = {}
- -- Go through all spell effects
- if self:reactionToward(target) < 0 then
- for eff_id, p in pairs(target.tmp) do
- local e = target.tempeffect_def[eff_id]
- if e.type == "magical" and e.status == "beneficial" then
- effs[#effs+1] = {"effect", eff_id}
- end
- end
- -- Go through all sustained spells
- for tid, act in pairs(target.sustain_talents) do
- if act then
- local talent = target:getTalentFromId(tid)
- if talent.is_spell then effs[#effs+1] = {"talent", tid} end
- end
- end
- else
- for eff_id, p in pairs(target.tmp) do
- local e = target.tempeffect_def[eff_id]
- if e.type == "magical" and e.status == "detrimental" then
- effs[#effs+1] = {"effect", eff_id}
- end
- end
- end
- for i = 1, t.getRemoveCount(self, t) do
- if #effs == 0 then break end
- local eff = rng.tableRemove(effs)
- if eff[1] == "effect" then
- target:removeEffect(eff[2])
- else
- target:forceUseTalent(eff[2], {ignore_energy=true})
- end
- end
- game:playSoundNear(self, "talents/spell_generic")
- return true
- end,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement