Tem como alguém adaptar para o TFS 0.4?
local config = {
magic_effect = 15, -- magic effect you want to send when critical hit lands
damage_multiplier = 10 -- default damage * 10 = critical damage
}
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
if attacker == nil then
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
if not attacker:isPlayer() then
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
local skill = attacker:getEffectiveSkillLevel(SKILL_SWORD)
local chance = (skill * 0.1)
if math.random(100) <= chance then
attacker:getPosition():sendMagicEffect(config.magic_effect)
return primaryDamage * config.damage_multiplier, primaryType, secondaryDamage, secondaryType
end
return primaryDamage, primaryType, secondaryDamage, secondaryType
end