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

Fix underflow for slow mobs and negative mobspeedmod #5603

Merged
merged 1 commit into from
May 11, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion settings/default/map.lua
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ xi.settings.map =
-- Note retail treats the mounted speed as double what it actually is.
MOUNT_SPEED_MOD = 0,

-- Modifier to apply to agro'd monster speed. 0 is the retail accurate default. Negative numbers will reduce it.
-- This is an integer percentage. Modifier to apply to agro'd monster speed (i.e. while engaged in combat). 0 is the retail accurate default. Negative numbers will reduce ALL mobs's speed.
MOB_SPEED_MOD = 0,

-- Allows you to manipulate the constant multiplier in the skill-up rate formulas, having a potent effect on skill-up rates.
Expand Down
8 changes: 7 additions & 1 deletion src/map/ai/helpers/pathfind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,13 @@ float CPathFind::GetRealSpeed()
}
else if (m_POwner->animation == ANIMATION_ATTACK)
{
realSpeed = realSpeed + settings::get<int8>("map.MOB_SPEED_MOD");
auto speedMod = settings::get<int8>("map.MOB_SPEED_MOD");
if (speedMod < -90)
{
speedMod = -90;
}

realSpeed *= 1.0f + speedMod / 100.0f;
}
}

Expand Down
Loading