PDA

View Full Version : Walkspeed Fix


unicorn97211
07-06-2006, 05:46 PM
The current method of figuring walkspeed does not provide functionality that reflects that of live. After going through the PEQ npc_types table, every single walkspeed is half the runspeed. The following code change to the GetWalkspeed() function will ignore the database walkspeed and use runspeed to calculate it. This allows for snares to effect walkspeed in a way that functions just like live. With this fix in place I am able to Snare/FD split just like I do on live with my necro. SK's should see the same thing when Snare splitting.

Here is the Diff


--- E:\EQEmu815\zone\mob.cpp Tue Jul 04 09:33:18 2006
+++ C:\EQEmuSP\Source\0.7.0\zone\mob.cpp Thu Jul 06 21:39:52 2006
@@ -429,22 +429,28 @@
{
if (IsRooted())
return 0.0f;
- float aa_speed = 1.0f;
- if (IsClient()){
- int32 aa_item = CastToClient()->GetAA(aaInnateRunSpeed);
- if (aa_item > 0 && aa_item < 10){
- aa_speed += aa_item * 0.01;
+ // Everhood - Brings walking in line with live functionality
+ // Are we affected by a movement buff?
+ if (spellbonuses.movementspeed) {
+ // Is it bad like snare?
+ if(spellbonuses.movementspeed<0){
+ // Base walkspeed is always half our runspeed
+ float everhood_walkspeed = runspeed * 0.5f;
+ // This is how much our speed, walk or run, is reduced by the buff
+ float snare_offset = runspeed * ((spellbonuses.movementspeed / 100.0f)* -1.0f);
+ // This is our walkspeed with snare applied
+ float snared_speed = everhood_walkspeed - snare_offset;
+ // we can't walk backwards
+ if(snared_speed<0.0f){
+ return 0.0f;
+ }else{
+ return snared_speed;
}
- //partial implementation of Fleet of Foot
- aa_item = CastToClient()->GetAA(aaFleetofFoot);
- if (aa_item > 0 && aa_item < 10){
- aa_speed += aa_item * 0.04;
}
}
- if (spellbonuses.movementspeed || itembonuses.movementspeed)
- aa_speed += (spellbonuses.movementspeed+itembonuses.movementsp eed) / 100.0f;
-
- return (walkspeed * aa_speed);
+ // we weren't snared so call GetRunspeed so that aa mods etc are applied
+ // and return half of it as our walkspeed
+ return GetRunspeed()*0.5f;
}

float Mob::GetRunspeed()
--- E:\EQEmu815\zone\MobAI.cpp Tue Jul 04 09:33:18 2006
+++ C:\EQEmuSP\Source\0.7.0\zone\MobAI.cpp Thu Jul 06 23:11:25 2006
@@ -870,8 +870,11 @@
}

if(IsNPC())
+ // Everhood - Walkspeed can return 0.0f now
+ if(GetWalkspeed()!=0.0f){
CastToNPC()->AI_DoMovement();
}
+ }

}
} // else if (AImovement_timer->Check())


When testing this, mobs snared with Engulfing Darkness could barely walk away when I FD, mob snared with Dooming Darkness and higher were stuck until aggro'd into a run or snare wore off. This is the same behavior I see currently on live.

fathernitwit
07-08-2006, 07:18 AM
ok,

I took this concept, and redid it a bit. Basically, I changed it to use the same code to calculate run and walkspeed, but walkspeed is given an innate -50% speed penalty. This means that if you stack up another -50% penalty with buffs, the mob will be unable to walk. Once again, I would like you to test what I have done.