Merge pull request #254 from noudess/master

Changes so that blind effects like those in Flash of Light work.
This commit is contained in:
Michael Cook (mackal)
2014-09-29 14:26:51 -04:00
5 changed files with 17 additions and 5 deletions
+7 -1
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;
+1
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);
+1
View File
@@ -1190,6 +1190,7 @@ protected:
float fear_walkto_y;
float fear_walkto_z;
bool curfp;
bool is_blind;
// Pathing
//
+2 -2
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
{
+6 -2
View File
@@ -1269,8 +1269,8 @@ 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?
else
is_blind = true;
break;
}
@@ -3995,6 +3995,10 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
break;
}
case SE_Blind:
is_blind = false;
break;
case SE_Fear:
{
if(RuleB(Combat, EnableFearPathing)){