Fixed an issue that arose from 78ab3471

Reworked how Mob::_GetMovementSpeed worked to fix an issue of walking
with a sufficiently high movemod.

Added a rule Character:BaseRunSpeedCap (default 158) to control the
cap on runspeed from buffs. Hardcapped to 225 for sanity's sake.
This commit is contained in:
Michael Cook 2013-11-17 19:37:49 -05:00
parent 36233538fd
commit 09dd3c1b37
3 changed files with 51 additions and 47 deletions

View File

@ -1,5 +1,9 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------
== 11/17/2013 ==
demonstar55: Rewrote the Mob::_GetMovementSpeed fix an issue that arose from the change on 11/11
- Added the rule Character:BaseRunSpeedCap (default 158) so people can customize what their runspeed cap is. Hardcapped to 225 so stuff doesn't get too crazy.
== 11/16/2013 ==
Leere: Fixed the drinking message for auto-consume, it will again correctly show up for forced consumption instead.
demonstar55: Added Mob::DoCastingChecks() which will check for various fail conditions while the casting bar is up. This is called after Mob::DoCastSpell() starts the casting and before it returns.

View File

@ -98,6 +98,7 @@ RULE_BOOL ( Character, EnableXTargetting, true) // Enable Extended Targetting Wi
RULE_BOOL ( Character, KeepLevelOverMax, false) // Don't delevel a character that has somehow gone over the level cap
RULE_INT ( Character, FoodLossPerUpdate, 35) // How much food/water you lose per stamina update
RULE_INT ( Character, BaseInstrumentSoftCap, 36) // Softcap for instrument mods, 36 commonly referred to as "3.6" as well.
RULE_INT ( Character, BaseRunSpeedCap, 158) // Base Run Speed Cap, on live it's 158% which will give you a runspeed of 1.580 hard capped to 225.
RULE_CATEGORY_END()
RULE_CATEGORY( Mercs )

View File

@ -517,76 +517,75 @@ bool Mob::IsInvisible(Mob* other) const
return(false);
}
float Mob::_GetMovementSpeed(int mod) const {
float Mob::_GetMovementSpeed(int mod) const
{
// List of movement speed modifiers, including AAs & spells:
// http://everquest.allakhazam.com/db/item.html?item=1721;page=1;howmany=50#m10822246245352
if (IsRooted())
return 0.0f;
float aa_mod = 0.0f;
float speed_mod = runspeed;
bool has_horse = false;
if (IsClient())
{
if(CastToClient()->GetGMSpeed())
{
// These two cases ignore the cap, be wise in the DB for horses.
if (IsClient()) {
if (CastToClient()->GetGMSpeed()) {
speed_mod = 3.125f;
}
else
{
Mob* horse = entity_list.GetMob(CastToClient()->GetHorseId());
if(horse)
{
if (mod != 0)
speed_mod += speed_mod * static_cast<float>(mod) / 100.0f;
return speed_mod;
} else {
Mob *horse = entity_list.GetMob(CastToClient()->GetHorseId());
if (horse) {
speed_mod = horse->GetBaseRunspeed();
has_horse = true;
if (mod != 0)
speed_mod += speed_mod * static_cast<float>(mod) / 100.0f;
return speed_mod;
}
}
}
aa_mod += itembonuses.BaseMovementSpeed + spellbonuses.BaseMovementSpeed + aabonuses.BaseMovementSpeed;
int spell_mod = spellbonuses.movementspeed + itembonuses.movementspeed;
int aa_mod = 0;
int spell_mod = 0;
int runspeedcap = RuleI(Character,BaseRunSpeedCap);
int movemod = 0;
float frunspeedcap = 0.0f;
if(spell_mod < 0)
{
runspeedcap += itembonuses.IncreaseRunSpeedCap + spellbonuses.IncreaseRunSpeedCap + aabonuses.IncreaseRunSpeedCap;
aa_mod += itembonuses.BaseMovementSpeed + spellbonuses.BaseMovementSpeed + aabonuses.BaseMovementSpeed;
spell_mod += spellbonuses.movementspeed + itembonuses.movementspeed;
// hard cap
if (runspeedcap > 225)
runspeedcap = 225;
if (spell_mod < 0)
movemod += spell_mod;
}
else if(spell_mod > (aa_mod))
{
else if (spell_mod > aa_mod)
movemod = spell_mod;
}
else
{
movemod = static_cast<int>(aa_mod);
}
movemod = aa_mod;
if(movemod < -85) //cap it at moving very very slow
// cap negative movemods from snares mostly
if (movemod < -85)
movemod = -85;
if(mod != 0) // passing -47 for walking shouldn't be effected by cap above
movemod += mod;
if (movemod != 0)
speed_mod += speed_mod * static_cast<float>(movemod) / 100.0f;
if (!has_horse && movemod != 0)
speed_mod += (speed_mod * float(movemod) / 100.0f);
// runspeed caps
frunspeedcap = static_cast<float>(runspeedcap) / 100.0f;
if (IsClient() && speed_mod > frunspeedcap)
speed_mod = frunspeedcap;
if(speed_mod <= 0.0f)
return (IsClient() ? 0.0001f : 0.0f);
// apply final mod such as the -47 for walking
// use runspeed since it should stack with snares
// and if we get here, we know runspeed was the initial
// value before we applied movemod.
if (mod != 0)
speed_mod += runspeed * static_cast<float>(mod) / 100.0f;
//runspeed cap.
if(IsClient())
{
if (speed_mod > 1.58){
uint8 bonus_IncreaseRunSpeedCap = itembonuses.IncreaseRunSpeedCap + spellbonuses.IncreaseRunSpeedCap + aabonuses.IncreaseRunSpeedCap;
if (bonus_IncreaseRunSpeedCap){
speed_mod += float(bonus_IncreaseRunSpeedCap)/100.0f;
if(speed_mod > 1.74)
speed_mod = 1.74;
}
else
speed_mod = 1.58;
}
}
if (speed_mod <= 0.0f)
speed_mod = IsClient() ? 0.0001f : 0.0f;
return speed_mod;
}