Changes so that blind effects like those in Flash of Light work.

This commit is contained in:
Paul Coene 2014-09-27 13:00:07 -04:00
parent 1170b57fd5
commit 73a23e9f9d
5 changed files with 16 additions and 5 deletions

View File

@ -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;

View File

@ -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);

View File

@ -1191,6 +1191,7 @@ protected:
float fear_walkto_y;
float fear_walkto_z;
bool curfp;
bool is_blind;
// Pathing
//

View File

@ -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
{

View File

@ -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)){