Skip to content

Commit

Permalink
Merge pull request LandSandBoat#5603 from CatsAndBoats/mob_speed_mod
Browse files Browse the repository at this point in the history
Fix underflow for slow mobs and negative mobspeedmod
  • Loading branch information
claywar authored May 11, 2024
2 parents 349c452 + 8231534 commit c1ae7a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
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

0 comments on commit c1ae7a6

Please sign in to comment.