EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Server Code Submissions (https://www.eqemulator.org/forums/forumdisplay.php?f=669)
-   -   Blind effect (https://www.eqemulator.org/forums/showthread.php?t=38487)

noudess 07-14-2014 01:18 PM

Blind effect
 
I noticed that spells like flash of light and eye of confusion's Blindness effect was basically doing nothing.

From my memories of EQ, I recall that using these spells would get the mob to wander aimlessly as long as noone was in combat range. I played with the code for awhile and used some of the fear code, but tweaked target and when it was used. This seems to work ok. I was worried about making these blind spells too powerful, but since the mob attacks again if you get in range, its far less useful than fear. The mobs will also switch to anyone in range after you blind it and move out of range.

Let me know what you think. My code is deverged from the base for over a year, but I think these spots are very close still.

Code:

=== modified file 'zone/MobAI.cpp'
--- zone/MobAI.cpp        2014-07-09 13:07:28 +0000
+++ zone/MobAI.cpp        2014-07-14 16:38:13 +0000
@@ -1013,7 +1013,7 @@
        // 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())
@@ -1062,7 +1062,7 @@
        if (engaged)
        {
                _ZP(Mob_AI_Process_engaged);
-                if (IsRooted())
+                if (IsRooted() || is_blind)
                        SetTarget(hate_list.GetClosest(this));
                else
                {
@@ -1111,7 +1111,7 @@
                {
                        StartEnrage();
                }
-               
+                       
                bool is_combat_range = CombatRange(target);
               
        if (is_combat_range)

=== modified file 'zone/fearpath.cpp'
--- zone/fearpath.cpp        2013-08-27 14:08:21 +0000
+++ zone/fearpath.cpp        2014-07-14 16:49:08 +0000
@@ -130,7 +130,7 @@
 {
 float speed = GetRunspeed();
 
-if(flee_mode)
+if(flee_mode || is_blind)
        {
        //we know ratio < FLEE_HP_RATIO
        float ratio = GetHPRatio();
@@ -148,6 +148,13 @@
 
                ratio = (ratio/100);
                speed = 2.5*(speed * ratio);
+
+                // A blinded mob should be pretty slow when running amuck.
+                if (is_blind)
+                        {
+                        speed = speed/4.0;
+                        mlog(PATHING__DEBUG, "Reducing Speed on Blinded mob to %f.\n", speed);
+                        }
                }
        }
 

=== modified file 'zone/mob.cpp'
--- zone/mob.cpp        2013-07-09 15:28:09 +0000
+++ zone/mob.cpp        2014-07-14 14:42:38 +0000
@@ -136,6 +136,7 @@
        fear_walkto_y = -999999;
        fear_walkto_z = -999999;
        curfp = false;
+        is_blind = false;
 
        AI_Init();
        SetMoving(false);

=== modified file 'zone/mob.h'
--- zone/mob.h        2013-07-09 15:28:09 +0000
+++ zone/mob.h        2014-07-14 14:42:11 +0000
@@ -1529,6 +1529,7 @@
        float fear_walkto_y;
        float fear_walkto_z;
        bool curfp;
+        bool is_blind;
 
        // Pathing
        //

=== modified file 'zone/spell_effects.cpp'
--- zone/spell_effects.cpp        2013-07-09 15:28:09 +0000
+++ zone/spell_effects.cpp        2014-07-14 14:49:10 +0000
@@ -1207,8 +1207,8 @@
 #endif
                                if (spells[spell_id].base[i] == 1)
                                        BuffFadeByEffect(SE_Blind);
-                                // solar: handled by client
-                                // TODO: blind flag?
+                                // solar: handled by client for PC victim
+                                is_blind = true;       
                                break;
                        }
 
@@ -3586,6 +3586,9 @@
                                break;
                        }
 
+                        case SE_Blind:
+                                is_blind = false;
+                                break;
                        case SE_Fear:
                        {
                                if(RuleB(Combat, EnableFearPathing)){


noudess 07-29-2014 09:57 AM

This is working well on my server.


All times are GMT -4. The time now is 11:09 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.