I did not find anything similar in any vaniila or addon talent.
So here is what I tried in the talent code.
The idea is to have a callback in the default projector that reduces the original damage and projects the new converted mind damage on the grid.
Code: Select all
callbackOnTakeDamage = function(self, t, src, x, y, type, dam, tmp)
local ff = self:isTalentActive(t.id)
if not ff then return dam end
if type == DamageType.MIND then return dam end
local mdam = dam * t.getMindConvert(self,t)
DamageType:get(DamageType.MIND).projector(src, x, y, DamageType.MIND, mdam)
game:delayedLogDamage(self, self, 0, "#YELLOW_GREEN##Target# displaced some damage to its mind!")
dam = dam - mdam
return {dam=dam}
end,
There are indeed two different problems:
1/ there is lua error with this code. The problem obviously comes from the call to a projector in the callback.
Code: Select all
Lua Error: /engine/interface/ActorTalents.lua:322: /engine/interface/ActorTalents.lua:295: /engine/interface/ActorTalents.lua:162: /data/damage_types.lu
a:477: attempt to index local 'ret' (a number value)
stack traceback:
/data/damage_types.lua:477: in function 'projector'
/data-mentalist/talents/psionic/mental-resilience.lua:59: in function 'callTalent'
/mod/class/Actor.lua:5247: in function 'cb'
/data/damage_types.lua:475: in function 'defaultProjector'
/data/damage_types.lua:703: in function 'projector'
/mod/class/interface/Combat.lua:600: in function 'attackTargetWith'
/mod/class/interface/Combat.lua:225: in function 'attackTarget'
/data/talents/misc/misc.lua:75: in function </data/talents/misc/misc.lua:54>
[C]: in function 'xpcall'
/engine/interface/ActorTalents.lua:160: in function </engine/interface/ActorTalents.lua:149>
At [C]:-1
At [C]:-1 error
At /engine/interface/ActorTalents.lua:322 useTalent
At /mod/class/interface/Combat.lua:37 attack
...
2/ Actually, what I would like to use is callbackOnTakeDamageBeforeResists, instead of callbackOnTakeDamage in order to avoid the double resists application for the original damage and the converted mind damage. If I replace in the talent with callbackOnTakeDamageBeforeResists, absolutely nothing happens. The callback seems to be completely ignored.
I 'grep -r' in the source tree and the callback is only used in one place for an effect that I never noticed (chromatic resonance). Does anybody knows if there is problem with the callback or if I use it incorrectly?