diff --git a/zone/fearpath.cpp b/zone/fearpath.cpp index 636422b3f..592fa2090 100644 --- a/zone/fearpath.cpp +++ b/zone/fearpath.cpp @@ -130,7 +130,7 @@ void Mob::ProcessFlee() { } float Mob::GetFearSpeed() { - if(flee_mode) { + if(flee_mode || is_blind) { //we know ratio < FLEE_HP_RATIO float speed = GetBaseRunspeed(); float ratio = GetHPRatio(); @@ -141,6 +141,12 @@ float Mob::GetFearSpeed() { speed = speed * ratio * multiplier / 100; + // A blinded mob should be pretty slow when running amuck. + if (is_blind) + { + speed = speed/3.0; + } + //NPC will eventually stop. Snares speeds this up. if(speed < 0.09) speed = 0.0001f; diff --git a/zone/mob.cpp b/zone/mob.cpp index 77ff4938a..96153fede 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -114,6 +114,7 @@ Mob::Mob(const char* in_name, fear_walkto_y = -999999; fear_walkto_z = -999999; curfp = false; + is_blind = false; AI_Init(); SetMoving(false); diff --git a/zone/mob.h b/zone/mob.h index 4e72f0264..dcf9ef24d 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -1191,6 +1191,7 @@ protected: float fear_walkto_y; float fear_walkto_z; bool curfp; + bool is_blind; // Pathing // diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 125e1d85f..d1dc18d5d 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1039,7 +1039,7 @@ void Mob::AI_Process() { // Begin: Additions for Wiz Fear Code // if(RuleB(Combat, EnableFearPathing)){ - if(curfp) { + if(curfp || (is_blind && !CombatRange(hate_list.GetClosest(this)))) { if(IsRooted()) { //make sure everybody knows were not moving, for appearance sake if(IsMoving()) @@ -1087,7 +1087,7 @@ void Mob::AI_Process() { if (engaged) { - if (IsRooted()) + if (IsRooted() || is_blind) SetTarget(hate_list.GetClosest(this)); else { diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index a81377f5d..5bddd780a 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -1267,8 +1267,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial) #endif if (spells[spell_id].base[i] == 1) BuffFadeByEffect(SE_Blind); - // handled by client - // TODO: blind flag? + is_blind = true; break; } @@ -3976,6 +3975,10 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses) break; } + case SE_Blind: + is_blind = false; + break; + case SE_Fear: { if(RuleB(Combat, EnableFearPathing)){