Jump to content

[FIX] Althor's Abacus


Auntie Mangos

Recommended Posts

  • * What bug does the patch fix? What features does the patch add? Fixes Althor's Abacus
    * For which repository revision was the patch created? 9715

  • * Is there a thread in the bug report section or at lighthouse? If yes, please add a link to the thread.

http://getmangos.eu/community/showthread.php?13315-[bug-item]-Althor-s-Abacus

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

caeruleaus

diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index b0acd37..789d381 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -1661,7 +1661,11 @@ void Spell::SetTargetMap(SpellEffectIndex  effIndex, uint32 targetMode, UnitList&
        }
        case TARGET_DUELVSPLAYER_COORDINATES:
        {
-            if(Unit* currentTarget = m_targets.getUnitTarget())
+            if(m_spellInfo->Id == 71610)
+            {
+                break;
+            }
+            else if(Unit* currentTarget = m_targets.getUnitTarget())
            {
                 m_targets.setDestination(currentTarget->GetPositionX(),  currentTarget->GetPositionY(), currentTarget->GetPositionZ());
                targetUnitMap.push_back(currentTarget);
@@ -1724,8 +1728,46 @@ void Spell::SetTargetMap(SpellEffectIndex  effIndex, uint32 targetMode, UnitList&
            }
            break;
        case TARGET_ALL_FRIENDLY_UNITS_IN_AREA:
+            // Echoes of Light
+            if (m_spellInfo->Id == 71610)
+            {
+                CellPair  p(MaNGOS::ComputeCellPair(m_caster->GetPositionX(),  m_caster->GetPositionY()));
+                Cell cell(p);
+                cell.data.Part.reserved = ALL_DISTRICT;
+                cell.SetNoCreate();
+                std::list<Unit*> tempTargetUnitMap;
+                {
+                    MaNGOS::AnyFriendlyUnitInObjectRangeCheck  u_check(m_caster, radius);
+                     MaNGOS::UnitListSearcher<MaNGOS::AnyFriendlyUnitInObjectRangeCheck>  searcher(m_caster, tempTargetUnitMap, u_check);
+
+                     TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyFriendlyUnitInObjectRangeCheck>,  WorldTypeMapContainer > world_unit_searcher(searcher);
+                     TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyFriendlyUnitInObjectRangeCheck>,  GridTypeMapContainer >  grid_unit_searcher(searcher);
+
+                    cell.Visit(p, world_unit_searcher,  *m_caster->GetMap(), *m_caster, radius);
+                    cell.Visit(p, grid_unit_searcher,  *m_caster->GetMap(), *m_caster, radius);
+                }
+
+                if(tempTargetUnitMap.empty())
+                    break;
+
+                tempTargetUnitMap.sort(TargetDistanceOrder(m_caster));
+
+                //Now to get us a random target that's in the initial  range of the spell
+                uint32 t = 0;
+                std::list<Unit*>::iterator itr =  tempTargetUnitMap.begin();
+                while(itr != tempTargetUnitMap.end() &&  (*itr)->IsWithinDist(m_caster, radius))
+                    ++t, ++itr;
+
+                if(!t)
+                    break;
+
+                itr = tempTargetUnitMap.begin();
+                std::advance(itr, rand() % t);
+                Unit *pUnitTarget = *itr;
+                targetUnitMap.push_back(pUnitTarget);
+            }
            // Death Pact (in fact selection by player selection)
-            if (m_spellInfo->Id == 48743)
+            else if (m_spellInfo->Id == 48743)
            {
                // checked in Spell::CheckCast
                if (m_caster->GetTypeId()==TYPEID_PLAYER)

I don't know why it calls implicit target 63 (TARGET_DUELVSPLAYER_COORDINATES) but it does. I did a few checks just to make sure. If i don't add the break there, it casts the spell on the original target as well as the random target in the area. I figured there should be an easier way to find a random target but i couldn't find any other way than copying the first part of the TARGET_RANDOM_CHAIN_FRIEND or whatever it is. I'm just posting this so it gets looked at. It may be kind of hackish (I'm new to the whole submitting patches thing) but i don't really see another way to do it. I still have to look at it's other target type TARGET_GAMEOBJECT but this should work in the case of it healing random players. I couldn't find much info on it but from the few comments I've seen it'll heal a random friendly unit within a certain radius from the person it is being cast on.

Link to comment
Share on other sites

  • 40 years later...
  • 1 month later...
Guest
This topic is now closed to further replies.
×
×
  • 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