-- Everything is funnelled through this
function statChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
if creature:isPlayer() then
-- do stuff
end
return primaryDamage, primaryType, secondaryDamage, secondaryType, origin
end
-- Health
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
if primaryType ~= 128 then -- Ignore health potions
-- This is where we push it through statChange
primaryDamage, primaryType, secondaryDamage, secondaryType, origin = statChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin) -- This is for feeding both onHealthChange and onManaChange through the same damage/buff formula
end
return primaryDamage, primaryType, secondaryDamage, secondaryType, origin
end
-- Mana
function onManaChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
if primaryType ~= 64 then -- Ignore mana potions
-- This is where we push it through statChange
primaryDamage, primaryType, secondaryDamage, secondaryType, origin = statChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin) -- This is for feeding both onHealthChange and onManaChange through the same damage/buff formula
end
return primaryDamage, primaryType, secondaryDamage, secondaryType, origin
end