Jump to content

[patch] Implementing implicit targets 64,66,67


Guest qsa
 Share

Recommended Posts

What bug does the patch fix? What features does the patch add?

Implementing implicit targets 64,66,67

TARGET_INFRONT_OF_VICTIM(64),TARGET_RIGHT_FROM_VICTIM(66),TARGET_LEFT_FROM_VICTIM(67)

15 spells overall

 id    spellname_0
36577    Warp Storm
36602    Summon Thorny Growth
36603    Summon Thorny Growth
36847    Mirror Image
40944    Mirror Image
43424    Exploding Rune
43425    Exploding Rune
43554    Summon Ivy Growth
43555    Summon Ivy Growth
45639    Sidestep
47095    Summon Huntsman
47514    Summon Mole Machine
49028    Dancing Rune Weapon
54026    Place Seaforium Charge
56541    Jokkum Summon

Note: CONTACT_DISTANCE is used for behind case and not the actual range since it is used in shadowstep and alike, porting you just little bit out of melee hit range.

For which repository revision was the patch created?

8542

Who has been writing this patch? Please include either forum user names or email addresses.

Me

diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h
index d8ac7fb..f341a7d 100644
--- a/src/game/SharedDefines.h
+++ b/src/game/SharedDefines.h
@@ -1052,7 +1052,10 @@ enum Targets
    TARGET_NARROW_FRONTAL_CONE         = 60,
    TARGET_AREAEFFECT_PARTY_AND_CLASS  = 61,
    TARGET_DUELVSPLAYER_COORDINATES    = 63,
+    TARGET_INFRONT_OF_VICTIM           = 64,
    TARGET_BEHIND_VICTIM               = 65,                // used in teleport behind spells, caster/target dependent from spell effect
+    TARGET_RIGHT_FROM_VICTIM           = 66,
+    TARGET_LEFT_FROM_VICTIM            = 67,
    TARGET_RANDOM_NEARBY_LOC           = 72,                // used in teleport onto nearby locations
    TARGET_RANDOM_CIRCUMFERENCE_POINT  = 73,
    TARGET_DYNAMIC_OBJECT_COORDINATES  = 76,
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 3137f39..4508027 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -1992,7 +1992,10 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)
                sLog.outError( "SPELL: unknown target coordinates for spell ID %u", m_spellInfo->Id );
            break;
        }
+        case TARGET_INFRONT_OF_VICTIM:
        case TARGET_BEHIND_VICTIM:
+        case TARGET_RIGHT_FROM_VICTIM:
+        case TARGET_LEFT_FROM_VICTIM:
        {
            Unit *pTarget = NULL;

@@ -2007,8 +2010,19 @@ void Spell::SetTargetMap(uint32 effIndex,uint32 targetMode,UnitList& TagUnitMap)

            if(pTarget)
            {
+                float angle = 0.0f;
+                float dist = (radius && targetMode != TARGET_BEHIND_VICTIM) ? radius : CONTACT_DISTANCE;
+
+                switch(targetMode)
+                {
+                    case TARGET_INFRONT_OF_VICTIM:                   break;
+                    case TARGET_BEHIND_VICTIM:      angle = M_PI;    break;
+                    case TARGET_RIGHT_FROM_VICTIM:  angle = -M_PI/2;  break;
+                    case TARGET_LEFT_FROM_VICTIM:   angle = M_PI/2; break;
+                }
+
                float _target_x, _target_y, _target_z;
-                pTarget->GetClosePoint(_target_x, _target_y, _target_z, m_caster->GetObjectSize(), CONTACT_DISTANCE, M_PI);
+                pTarget->GetClosePoint(_target_x, _target_y, _target_z, pTarget->GetObjectSize(), dist, angle);
                if(pTarget->IsWithinLOS(_target_x, _target_y, _target_z))
                {
                    TagUnitMap.push_back(m_caster);

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