Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lua] Adjust mob add effect to account for edge cases #6678

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions scripts/globals/mobs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,12 @@ xi.mob.onAddEffect = function(mob, target, damage, effect, params)
dMod = 20 + (dMod - 20) / 2
end

-- This is a bad assumption, but it prevents some negative damage (healing) when there otherwise shouldn't be
-- TODO: better understand damage add effects from mobs
if dMod < 0 then
dMod = 0
end

power = dMod + target:getMainLvl() - mob:getMainLvl() + damage / 2
end

Expand All @@ -557,6 +563,7 @@ xi.mob.onAddEffect = function(mob, target, damage, effect, params)
if power < 0 then
if ae.negMsg then
message = ae.negMsg
power = power * -1 -- outgoing action packets only support unsigned integers. The "negative message" will also handle healing automagically deep inside core somewhere.
else
power = 0
end
Expand Down
Loading