I'm at work, so can't test this, but the issue appears to be the logic in
fearpath.cpp Mob::GetFearSpeed().
There is a hardcoded constant in the source, FLEE_HP_MINSPEED, which is set to 10.
The purpose of this is to put a lower limit on the mob's flee speed, i.e. once the
Mobs HP gets down to 10%, it won't slow down any further.
Assuming an unsnared mob with a default runspeed of 1.25 and rule FleeHPRatio
set to 25, FearSpeed will return a flee speed of 0.25 at 25% health.
Because of the logic, as the mobs HP decreases from 25% down to 10%, it will actually
move faster, with a speed of 1.25 when it's HP is exactly 10%.
Below 10% it will run at 0.25 (again, assuming unsnared).
The following drop-in replacement will give you a linear speed decrease, starting at 0.25
at 25% health, down to 0.10 at 10% and below.
Code:
float Mob::GetFearSpeed() {
if(flee_mode) {
//we know ratio < FLEE_HP_RATIO
float speed = GetRunspeed();
float ratio = GetHPRatio();
if(ratio < FLEE_HP_MINSPEED)
ratio = FLEE_HP_MINSPEED;
speed = speed * 0.8 * ratio / 100;
return(speed);
}
return(GetRunspeed());
}
If you want them to move faster or slower in relation to HP%, fiddle with the speed = speed * 0.8 * ratio / 100; statement.
As I said, I can't test it in-game right now, but it works as I described 'in simulation'.
