Jump to content

Fixate Targets


Schmoozerd
 Share

Recommended Posts

Hi all,

this is a small suggestion about a possibility for mobts to fixate a target.

Any opinions are welcome.

Examples where this might be needed are:

AQ40:: Battleguard Saturia

BT: Supremus

Likely there exists a bunch of other cases as well, where an npc should focos on one enemy for some spell duration, maybe Zul'Jin - Claw Rage

These cases also throw the question, if we need an automated system to remove a fixation after some time

From 83881cf2bc1b5a67ce7979909f6fb5139f4338d6 Mon Sep 17 00:00:00 2001
From: Schmoozerd <[email protected]>
Date: Sat, 12 Nov 2011 23:00:36 +0100
Subject: [PATCH] Add Unit::FixateTarget

This allows to fixate a target (as long as it is valid) independend from threat or taunt auras.
If required maybe adding a time argument to automatically remove the fixation can be reasonable.

Signed-off-by: Schmoozerd <[email protected]>
---
src/game/Unit.cpp |   31 +++++++++++++++++++++++++++----
src/game/Unit.h   |    3 +++
2 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 71e5685..b732469 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -8570,6 +8570,8 @@ void Unit::TauntFadeOut(Unit *taunter)

    if (m_ThreatManager.isThreatListEmpty())
    {
+        m_fixateTargetGuid.Clear();
+
        if (((Creature*)this)->AI())
            ((Creature*)this)->AI()->EnterEvadeMode();

@@ -8595,6 +8597,19 @@ void Unit::TauntFadeOut(Unit *taunter)
}

//======================================================================
+/// if pVictim is given, the npc will fixate onto pVictim, if NULL it will remove current fixation
+void Unit::FixateTarget(Unit* pVictim)
+{
+    if (!pVictim)                                           // Remove Fixation
+        m_fixateTargetGuid = ObjectGuid();
+    else if (pVictim->isTargetableForAttack())              // Apply Fixation
+        m_fixateTargetGuid = pVictim->GetObjectGuid();
+
+    // Start attacking the fixated target or the next proper one
+    SelectHostileTarget();
+}
+
+//======================================================================

bool Unit::IsSecondChoiceTarget(Unit* pTarget, bool checkThreatArea)
{
@@ -8626,10 +8641,17 @@ bool Unit::SelectHostileTarget()
    Unit* target = NULL;
    Unit* oldTarget = getVictim();

-    // First checking if we have some taunt on us
-    const AuraList& tauntAuras = GetAurasByType(SPELL_AURA_MOD_TAUNT);
-    if (!tauntAuras.empty())
+    // first check if we should fixate a target
+    if (m_fixateTargetGuid)
+    {
+        Unit* pFixateTarget = GetMap()->GetUnit(m_fixateTargetGuid);
+        if (pFixateTarget && pFixateTarget->isAlive() && !IsSecondChoiceTarget(pFixateTarget, true))
+            target = pFixateTarget;
+    }
+    // then checking if we have some taunt on us
+    if (!target)
    {
+        const AuraList& tauntAuras = GetAurasByType(SPELL_AURA_MOD_TAUNT);
        Unit* caster;

        // Find first available taunter target
@@ -8646,7 +8668,7 @@ bool Unit::SelectHostileTarget()
        }
    }

-    // No taunt aura or taunt aura caster is dead, standard target selection
+    // No valid fixate target, taunt aura or taunt aura caster is dead, standard target selection
    if (!target && !m_ThreatManager.isThreatListEmpty())
        target = m_ThreatManager.getHostileTarget();

@@ -8679,6 +8701,7 @@ bool Unit::SelectHostileTarget()
    }

    // enter in evade mode in other case
+    m_fixateTargetGuid.Clear();
    ((Creature*)this)->AI()->EnterEvadeMode();

    if (InstanceData* mapInstance = GetInstanceData())
diff --git a/src/game/Unit.h b/src/game/Unit.h
index 7e742e8..2d6a0b7 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -1673,6 +1673,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
        bool SelectHostileTarget();
        void TauntApply(Unit* pVictim);
        void TauntFadeOut(Unit *taunter);
+        void FixateTarget(Unit* pVictim);
        ThreatManager& getThreatManager() { return m_ThreatManager; }
        ThreatManager const& getThreatManager() const { return m_ThreatManager; }
        void addHatedBy(HostileReference* pHostileReference) { m_HostileRefManager.insertFirst(pHostileReference); };
@@ -1996,6 +1997,8 @@ class MANGOS_DLL_SPEC Unit : public WorldObject

        ObjectGuid m_TotemSlot[MAX_TOTEM_SLOT];

+        ObjectGuid m_fixateTargetGuid;                      //< Stores the Guid of a fixated target
+
    private:                                                // Error traps for some wrong args using
        // this will catch and prevent build for any cases when all optional args skipped and instead triggered used non boolean type
        // no bodies expected for this declarations
-- 
1.7.6.msysgit.0

Link to comment
Share on other sites

I make ICC 1,5 years ago, and already not remember everything. aura (actually a combination of spells) for 37697 - 70459-70457 (need implementation in the core).

37652 has a similar effect from spells 70215 - 70672.

so that in most cases such an effect - it SPELL_AURA_DUMMY, without any other symptoms. not only in this, in other places too.

Link to comment
Share on other sites

  • 2 months later...

The current system is about to secondize targets which have auras that would be removed by attacking.

This patch is about to ensure that a selected enemy is fixated.

This is required for some bosses - and possible blizz uses auras for this, but even auras would require an internal implementation

Link to comment
Share on other sites

I'm just throwing this out to see if it sticks...

Wouldn't you need to cast a dummy spell first that uses a random target within a radius, then have the fixation aura proc on that one target? Otherwise, what mechanic is used to specify the target?

No technical reason I'm saying this, other than it seems to make sense.

Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use