landsandboat/scripts/mixins/fomor_hate.lua
2026-05-17 20:58:21 -04:00

32 lines
1.1 KiB
Lua

-----------------------------------
require('scripts/globals/mixins')
-----------------------------------
g_mixins = g_mixins or {}
g_mixins.fomor_hate = function(fomorMob)
fomorMob:addListener('DEATH', 'FOMOR_HATE_DEATH', function(mob, player)
if player then
local alliance = player:getAlliance()
for _, member in pairs(alliance) do
if member:getZoneID() == player:getZoneID() then
local hate = member:getCharVar('FOMOR_HATE')
local adj = mob:getLocalVar('fomorHateAdj')
if adj == 0 then
adj = 2 -- default: most fomor add 2 hate
end
-- if not a fomor then decrease hate instead of increase
-- Note cannot use negatives in fomorHateAdj because local vars can only be positive
if mob:getFamily() ~= xi.mobFamily.FOMOR then
adj = -adj
end
member:setCharVar('FOMOR_HATE', utils.clamp(hate + adj, 0, 60))
end
end
end
end)
end
return g_mixins.fomor_hate