--角色受到伤害时触发(返回指定伤害数值)
function on_StruckDamage(actor, Target, nPoint)
local actorname = actor:getCharName()
local Targetname = Target:getCharName()
local RaceId = Target:getRace()
if in_array(Target:getRace(),{0,66}) or in_array(Target:getCharName(),{"变异骷髅","变异骷髅1","强化变异骷髅","神兽","月灵","圣兽","圣兽2","强化变异圣兽","强化变异圣兽1","火灵","强化变异火灵","圣兽3","圣兽4"}) then
if RaceId == 0 then
if actorname == "修罗神君" then Target:setVal_N_Ex("对修罗神君的伤害",tostring(nPoint)) end
Target:sendMsg(0,"["..Targetname.."]攻击["..actorname.."],造成伤害:"..tostring(nPoint).."。", -1, -1)
return nPoint--返回指定伤害数值
elseif RaceId == 66 then
local Master = Target:getMaster()
local Mastername = Master:getCharName()
if actorname == "修罗神君" then Master:setVal_N_Ex("对修罗神君的伤害",tostring(nPoint)) end
Target:sendMsg(0,"["..Mastername.."]的英雄["..Targetname .."攻击["..actorname.."],造成伤害:"..tostring(nPoint).."。", -1, -1)
return nPoint--返回指定伤害数值
elseif in_array(Target:getCharName(),{"变异骷髅","变异骷髅1","强化变异骷髅","神兽","月灵","圣兽","圣兽2","强化变异圣兽","强化变异圣兽1","火灵","强化变异火灵","圣兽3","圣兽4"}) then
--由于怪物不支持setVal_N_Ex()方法,而且又不支持获取主人对象,所以导致下属打的伤害无法统计
end
end
end
补充内容 (2021-12-27 14:41):
3、合击打到人身上也不触发回调。 |