Code: Select all
callbackOnMeleeAttack = function(self, t, target, hitted, crit, weapon, damtype, mult, dam)
[b]local shield = self:hasShield()[/b]
if hitted and not target.dead and shield and not self.turn_procs.shield_of_light then
self.turn_procs.shield_of_light = true
self:attackTargetWith(target, [b]shield.special_combat[/b], DamageType.LIGHT, t.getShieldDamage(self, t))
end
end,
or better like this (damage of Lightning_Web)
Code: Select all
newDamageType{
name = "lightning web", type = "LIGHTNING_WEB",
projector = function(src, x, y, type, dam, state)
state = initState(state)
useImplicitCrit(src, state)
local target = game.level.map(x, y, Map.ACTOR)
if target then
if src:reactionToward(target) < 0 then
[b]local shield, shield_combat = src:hasShield()[/b]
if not shield then return nil end
src:attackTargetWith(target,[b] shield_combat[/b], DamageType.LIGHTNING, dam.dam)
else
target:setEffect(target.EFF_LIGHTNING_WEB, 1, { src=src, power=dam.block } )
end
end
end,
}
Unfortunately, the whole Magnetism talent tree except the example above lacks definition of shield_combat while using it as a parameter.
The following codes are a part of the definition of talent Magnetic Field
Code: Select all
action = function(self, t)
local tg = self:getTalentTarget(t)
[b]if not self:hasShield() then return end[/b]
self:project(tg, self.x, self.y, function(px, py)
local target = game.level.map(px, py, Map.ACTOR)
if not target then return end
self:attackTargetWith(target, [b]shield_combat[/b], DamageType.LIGHTNING, t.getDamage(self,t))
if target:canBe("knockback") then target:knockback(self.x, self.y, self:getTalentRadius(t)) end
end)
To prove what I said, you can try play a adventurer character with a steamsaw(can be considered as a shield) in mainhand and with the tentacle talent. You will see that the attacks from Static Shock wont trigger tentacle attacks(but they do trigger other procs, and the same with attacks from Shield of Light), since there is an extra condition check for tentacle attacks:
Code: Select all
local attackTargetWith = _M.attackTargetWith
function _M:attackTargetWith(target, weapon, damtype, ...)
local speed, hit, dam = attackTargetWith(self, target, weapon, damtype, ...)
[b]if weapon[/b] and self:knowTalent(self.T_MUTATED_HAND) and not self:attr("tentacle_hand_prevent") and self:callTalent(self.T_MUTATED_HAND, "canTentacleCombat") and weapon.talented ~= "tentacles" then