aboutsummaryrefslogtreecommitdiff
path: root/src/game/Spell.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Spell.h')
-rw-r--r--src/game/Spell.h263
1 files changed, 159 insertions, 104 deletions
diff --git a/src/game/Spell.h b/src/game/Spell.h
index 21351436e2b..59f21fd6bae 100644
--- a/src/game/Spell.h
+++ b/src/game/Spell.h
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
- * Copyright (C) 2008 Trinity <http://www.trinitycore.org/>
+ * Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,6 +22,7 @@
#define __SPELL_H
#include "GridDefines.h"
+#include "SharedDefines.h"
class Unit;
class Player;
@@ -30,41 +31,52 @@ class Aura;
enum SpellCastTargetFlags
{
- /*TARGET_FLAG_NONE = 0x0000,
- TARGET_FLAG_SWIMMER = 0x0002,
- TARGET_FLAG_ITEM = 0x0010,
- TARGET_FLAG_SOURCE_AREA = 0x0020,
- TARGET_FLAG_DEST_AREA = 0x0040,
- TARGET_FLAG_UNKNOWN = 0x0080,
- TARGET_FLAG_SELF = 0x0100,
- TARGET_FLAG_PVP_CORPSE = 0x0200,
- TARGET_FLAG_MASS_SPIRIT_HEAL = 0x0400,
- TARGET_FLAG_BEAST_CORPSE = 0x0402,
- TARGET_FLAG_OBJECT = 0x4000,
- TARGET_FLAG_RESURRECTABLE = 0x8000*/
-
TARGET_FLAG_SELF = 0x00000000,
+ TARGET_FLAG_UNUSED1 = 0x00000001, // not used in any spells as of 3.0.3 (can be set dynamically)
TARGET_FLAG_UNIT = 0x00000002, // pguid
+ TARGET_FLAG_UNUSED2 = 0x00000004, // not used in any spells as of 3.0.3 (can be set dynamically)
+ TARGET_FLAG_UNUSED3 = 0x00000008, // not used in any spells as of 3.0.3 (can be set dynamically)
TARGET_FLAG_ITEM = 0x00000010, // pguid
TARGET_FLAG_SOURCE_LOCATION = 0x00000020, // 3 float
TARGET_FLAG_DEST_LOCATION = 0x00000040, // 3 float
- TARGET_FLAG_OBJECT_UNK = 0x00000080, // ?
+ TARGET_FLAG_OBJECT_UNK = 0x00000080, // used in 7 spells only
+ TARGET_FLAG_CASTER = 0x00000100, // looks like self target (480 spells)
TARGET_FLAG_PVP_CORPSE = 0x00000200, // pguid
- TARGET_FLAG_OBJECT = 0x00000800, // pguid
- TARGET_FLAG_TRADE_ITEM = 0x00001000, // pguid
- TARGET_FLAG_STRING = 0x00002000, // string
- TARGET_FLAG_UNK1 = 0x00004000, // ?
- TARGET_FLAG_CORPSE = 0x00008000, // pguid
- TARGET_FLAG_UNK2 = 0x00010000 // pguid
+ TARGET_FLAG_UNIT_CORPSE = 0x00000400, // 10 spells (gathering professions)
+ TARGET_FLAG_OBJECT = 0x00000800, // pguid, 2 spells
+ TARGET_FLAG_TRADE_ITEM = 0x00001000, // pguid, 0 spells
+ TARGET_FLAG_STRING = 0x00002000, // string, 0 spells
+ TARGET_FLAG_UNK1 = 0x00004000, // 199 spells, opening object/lock
+ TARGET_FLAG_CORPSE = 0x00008000, // pguid, resurrection spells
+ TARGET_FLAG_UNK2 = 0x00010000, // pguid, not used in any spells as of 3.0.3 (can be set dynamically)
+ TARGET_FLAG_GLYPH = 0x00020000 // used in glyph spells
};
enum SpellCastFlags
{
- CAST_FLAG_UNKNOWN0 = 0x00000001, // stucks spell highlight
+ CAST_FLAG_NONE = 0x00000000,
+ CAST_FLAG_UNKNOWN0 = 0x00000001, // may be pending spell cast
CAST_FLAG_UNKNOWN1 = 0x00000002,
+ CAST_FLAG_UNKNOWN11 = 0x00000004,
+ CAST_FLAG_UNKNOWN12 = 0x00000008,
CAST_FLAG_UNKNOWN2 = 0x00000010,
- CAST_FLAG_AMMO = 0x00000020,
- CAST_FLAG_UNKNOWN3 = 0x00000100
+ CAST_FLAG_AMMO = 0x00000020, // Projectiles visual
+ CAST_FLAG_UNKNOWN8 = 0x00000040,
+ CAST_FLAG_UNKNOWN9 = 0x00000080,
+ CAST_FLAG_UNKNOWN3 = 0x00000100,
+ CAST_FLAG_UNKNOWN13 = 0x00000200,
+ CAST_FLAG_UNKNOWN14 = 0x00000400,
+ CAST_FLAG_POWER_LEFT_SELF = 0x00000800, // wotlk
+ CAST_FLAG_UNKNOWN15 = 0x00001000,
+ CAST_FLAG_UNKNOWN16 = 0x00002000,
+ CAST_FLAG_UNKNOWN17 = 0x00004000,
+ CAST_FLAG_UNKNOWN18 = 0x00008000,
+ CAST_FLAG_UNKNOWN19 = 0x00010000,
+ CAST_FLAG_UNKNOWN4 = 0x00020000, // wotlk
+ CAST_FLAG_UNKNOWN10 = 0x00040000,
+ CAST_FLAG_UNKNOWN5 = 0x00080000, // wotlk
+ CAST_FLAG_UNKNOWN20 = 0x00100000,
+ CAST_FLAG_UNKNOWN7 = 0x00200000 // wotlk, rune cooldown list
};
enum SpellRangeFlag
@@ -93,6 +105,8 @@ namespace Trinity
struct SpellNotifierCreatureAndPlayer;
}
+typedef std::list<Unit*> UnitList;
+
class SpellCastTargets
{
public:
@@ -192,9 +206,11 @@ struct SpellValue
for(uint32 i = 0; i < 3; ++i)
EffectBasePoints[i] = proto->EffectBasePoints[i];
MaxAffectedTargets = proto->MaxAffectedTargets;
+ RadiusMod = 1.0f;
}
int32 EffectBasePoints[3];
uint32 MaxAffectedTargets;
+ float RadiusMod;
};
enum SpellState
@@ -217,6 +233,7 @@ enum ReplenishType
enum SpellTargets
{
+ SPELL_TARGETS_NONE = 0,
SPELL_TARGETS_ALLY,
SPELL_TARGETS_ENEMY,
SPELL_TARGETS_ENTRY,
@@ -245,24 +262,23 @@ class Spell
void EffectHealthLeech(uint32 i);
void EffectQuestComplete(uint32 i);
void EffectCreateItem(uint32 i);
+ void EffectCreateItem2(uint32 i);
+ void EffectCreateRandomItem(uint32 i);
void EffectPersistentAA(uint32 i);
void EffectEnergize(uint32 i);
void EffectOpenLock(uint32 i);
void EffectSummonChangeItem(uint32 i);
- void EffectOpenSecretSafe(uint32 i);
void EffectProficiency(uint32 i);
void EffectApplyAreaAura(uint32 i);
void EffectSummonType(uint32 i);
- void EffectSummon(uint32 i);
void EffectLearnSpell(uint32 i);
void EffectDispel(uint32 i);
void EffectDualWield(uint32 i);
void EffectPickPocket(uint32 i);
void EffectAddFarsight(uint32 i);
- void EffectSummonPossessed(uint32 i);
- void EffectSummonWild(uint32 i);
- void EffectSummonGuardian(uint32 i);
void EffectHealMechanical(uint32 i);
+ void EffectJump(uint32 i);
+ void EffectJump2(uint32 i);
void EffectTeleUnitsFaceCaster(uint32 i);
void EffectLearnSkill(uint32 i);
void EffectAddHonor(uint32 i);
@@ -287,7 +303,7 @@ class Spell
void EffectStuck(uint32 i);
void EffectSummonPlayer(uint32 i);
void EffectActivateObject(uint32 i);
- void EffectSummonTotem(uint32 i);
+ void EffectApplyGlyph(uint32 i);
void EffectEnchantHeldItem(uint32 i);
void EffectSummonObject(uint32 i);
void EffectResurrect(uint32 i);
@@ -304,6 +320,8 @@ class Spell
void EffectSkinning(uint32 i);
void EffectCharge(uint32 i);
void EffectProspecting(uint32 i);
+ void EffectMilling(uint32 i);
+ void EffectRenamePet(uint32 i);
void EffectSendTaxi(uint32 i);
void EffectSummonCritter(uint32 i);
void EffectKnockBack(uint32 i);
@@ -324,28 +342,38 @@ class Spell
void EffectStealBeneficialBuff(uint32 i);
void EffectUnlearnSpecialization(uint32 i);
void EffectHealPct(uint32 i);
- void EffectEnergisePct(uint32 i);
+ void EffectEnergizePct(uint32 i);
void EffectTriggerSpellWithValue(uint32 i);
void EffectTriggerRitualOfSummoning(uint32 i);
void EffectKillCredit(uint32 i);
void EffectQuestFail(uint32 i);
void EffectRedirectThreat(uint32 i);
+ void EffectWMODamage(uint32 i);
+ void EffectWMORepair(uint32 i);
+ void EffectActivateRune(uint32 i);
+ void EffectTitanGrip(uint32 i);
+ void EffectEnchantItemPrismatic(uint32 i);
+
+ typedef std::set<Aura *> UsedSpellMods;
Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID = 0, Spell** triggeringContainer = NULL, bool skipCheck = false );
~Spell();
- void prepare(SpellCastTargets * targets, Aura* triggeredByAura = NULL);
+ void prepare(SpellCastTargets const* targets, AuraEffect* triggeredByAura = NULL);
void cancel();
void update(uint32 difftime);
void cast(bool skipCheck = false);
void finish(bool ok = true);
void TakePower();
+ void TakeAmmo();
+
+ void TakeRunePower();
void TakeReagents();
void TakeCastItem();
void TriggerSpell();
- uint8 CanCast(bool strict);
- int16 PetCanCast(Unit* target);
- bool CanAutoCast(Unit* target);
+
+ SpellCastResult CheckCast(bool strict);
+ SpellCastResult CheckPetCast(Unit* target);
// handlers
void handle_immediate();
@@ -354,10 +382,11 @@ class Spell
void _handle_immediate_phase();
void _handle_finish_phase();
- uint8 CheckItems();
- uint8 CheckRange(bool strict);
- uint8 CheckPower();
- uint8 CheckCasterAuras() const;
+ SpellCastResult CheckItems();
+ SpellCastResult CheckRange(bool strict);
+ SpellCastResult CheckPower();
+ SpellCastResult CheckRuneCost(uint32 runeCostID);
+ SpellCastResult CheckCasterAuras() const;
int32 CalculateDamage(uint8 i, Unit* target) { return m_caster->CalculateSpellDamage(m_spellInfo,i,m_currentBasePoints[i],target); }
int32 CalculatePowerCost();
@@ -365,24 +394,28 @@ class Spell
bool HaveTargetsForEffect(uint8 effect) const;
void Delayed();
void DelayedChannel();
- inline uint32 getState() const { return m_spellState; }
+ uint32 getState() const { return m_spellState; }
void setState(uint32 state) { m_spellState = state; }
void DoCreateItem(uint32 i, uint32 itemtype);
-
void WriteSpellGoTargets( WorldPacket * data );
void WriteAmmoToPacket( WorldPacket * data );
void FillTargetMap();
void SetTargetMap(uint32 i, uint32 cur);
+ void FillRaidOrPartyTargets( UnitList &TagUnitMap, Unit* target, float radius, bool raid, bool withPets, bool withcaster );
+ void FillRaidOrPartyManaPriorityTargets( UnitList &TagUnitMap, Unit* target, float radius, uint32 count, bool raid, bool withPets, bool withcaster );
+ void FillRaidOrPartyHealthPriorityTargets( UnitList &TagUnitMap, Unit* target, float radius, uint32 count, bool raid, bool withPets, bool withcaster );
- Unit* SelectMagnetTarget();
- bool CheckTarget(Unit* target, uint32 eff);
+ template<typename T> WorldObject* FindCorpseUsing();
+ bool CheckTarget( Unit* target, uint32 eff );
+ bool CanAutoCast(Unit* target);
void CheckSrc() { if(!m_targets.HasSrc()) m_targets.setSrc(m_caster); }
void CheckDst() { if(!m_targets.HasDst()) m_targets.setDestination(m_caster); }
- void SendCastResult(uint8 result);
+ static void MANGOS_DLL_SPEC SendCastResult(Player* caster, SpellEntry const* spellInfo, uint8 cast_count, SpellCastResult result);
+ void SendCastResult(SpellCastResult result);
void SendSpellStart();
void SendSpellGo();
void SendSpellCooldown();
@@ -393,7 +426,7 @@ class Spell
void SendResurrectRequest(Player* target);
void SendPlaySpellVisual(uint32 SpellID);
- void HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTarget,uint32 i, float DamageMultiplier = 1.0);
+ void HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTarget,uint32 i);
void HandleThreatSpells(uint32 spellId);
//void HandleAddAura(Unit* Target);
@@ -402,7 +435,12 @@ class Spell
Item* m_CastItem;
uint64 m_castItemGUID;
uint8 m_cast_count;
+ uint32 m_glyphIndex;
+ uint32 m_preCastSpell;
SpellCastTargets m_targets;
+ int8 m_comboPointGain;
+
+ UsedSpellMods m_appliedMods;
int32 GetCastTime() const { return m_casttime; }
bool IsAutoRepeat() const { return m_autoRepeat; }
@@ -410,12 +448,9 @@ class Spell
void ReSetTimer() { m_timer = m_casttime > 0 ? m_casttime : 0; }
bool IsNextMeleeSwingSpell() const
{
- return m_spellInfo->Attributes & (SPELL_ATTR_ON_NEXT_SWING_1|SPELL_ATTR_ON_NEXT_SWING_2);
- }
- bool IsRangedSpell() const
- {
- return m_spellInfo->Attributes & SPELL_ATTR_RANGED;
+ return m_spellInfo->Attributes & SPELL_ATTR_ON_NEXT_SWING;
}
+ bool IsTriggered() const {return m_IsTriggeredSpell;};
bool IsChannelActive() const { return m_caster->GetUInt32Value(UNIT_CHANNEL_SPELL) != 0; }
bool IsMeleeAttackResetSpell() const { return !m_IsTriggeredSpell && (m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_AUTOATTACK); }
bool IsRangedAttackResetSpell() const { return !m_IsTriggeredSpell && /*IsRangedSpell() &&*/ !(m_spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_RESET_AUTOSHOT); }
@@ -423,7 +458,7 @@ class Spell
bool IsDeletable() const { return !m_referencedFromCurrentSpell && !m_executedCurrently; }
void SetReferencedFromCurrent(bool yes) { m_referencedFromCurrentSpell = yes; }
bool IsInterruptable() const { return !m_executedCurrently; }
- void SetExecutedCurrently(bool yes) { m_executedCurrently = yes; }
+ void SetExecutedCurrently(bool yes) {m_executedCurrently = yes;}
uint64 GetDelayStart() const { return m_delayStart; }
void SetDelayStart(uint64 m_time) { m_delayStart = m_time; }
uint64 GetDelayMoment() const { return m_delayMoment; }
@@ -438,8 +473,6 @@ class Spell
void UpdatePointers(); // must be used at call Spell code after time delay (non triggered spell cast/update spell call/etc)
- bool IsAffectedBy(SpellEntry const *spellInfo, uint32 effectId);
-
bool CheckTargetCreatureType(Unit* target) const;
void AddTriggeredSpell(SpellEntry const* spell) { m_TriggerSpells.push_back(spell); }
@@ -447,6 +480,7 @@ class Spell
void CleanupTargetList();
void SetSpellValue(SpellValueMod mod, int32 value);
+ //void SetSpellValue(SpellValueMod mod, float value);
protected:
void SendLoot(uint64 guid, LootType loottype);
@@ -469,9 +503,17 @@ class Spell
int32 m_casttime; // Calculated spell cast time initialized only in Spell::prepare
bool m_canReflect; // can reflect this spell?
bool m_autoRepeat;
+ uint8 m_runesState;
uint8 m_delayAtDamageCount;
- int32 GetNextDelayAtDamageMsTime() { return m_delayAtDamageCount < 5 ? 1000 - (m_delayAtDamageCount++)* 200 : 200; }
+ bool isDelayableNoMore()
+ {
+ if(m_delayAtDamageCount >= 2)
+ return true;
+
+ m_delayAtDamageCount++;
+ return false;
+ }
// Delayed spells system
uint64 m_delayStart; // time of spell delay start, filled by event handler, zero = just started
@@ -482,6 +524,7 @@ class Spell
bool m_referencedFromCurrentSpell; // mark as references to prevent deleted and access by dead pointers
bool m_executedCurrently; // mark as executed to prevent deleted and access by dead pointers
bool m_needSpellLog; // need to send spell log?
+ bool m_needComboPoints;
uint8 m_applyMultiplierMask; // by effect: damage multiplier needed?
float m_damageMultipliers[3]; // by effect: damage multiplier
@@ -490,6 +533,7 @@ class Spell
Item* itemTarget;
GameObject* gameObjTarget;
int32 damage;
+ Aura * m_spellAura; // only used in DoAllEffectOnTarget
// this is set in Spell Hit, but used in Apply Aura handler
DiminishingLevels m_diminishLevel;
@@ -506,17 +550,16 @@ class Spell
//******************************************
// Spell trigger system
//******************************************
- bool m_canTrigger; // Can start trigger (m_IsTriggeredSpell can`t use for this)
uint32 m_procAttacker; // Attacker trigger flags
uint32 m_procVictim; // Victim trigger flags
- void prepareDataForTriggerSystem();
+ uint32 m_procEx;
+ bool m_canTrigger;
+ void prepareDataForTriggerSystem(AuraEffect * triggeredByAura);
//*****************************************
// Spell target subsystem
//*****************************************
// Targets store structures and data
- uint32 m_countOfHit;
- uint32 m_countOfMiss;
struct TargetInfo
{
uint64 targetGUID;
@@ -525,6 +568,7 @@ class Spell
SpellMissInfo reflectResult:8;
uint8 effectMask:8;
bool processed:1;
+ bool alive:1;
int32 damage;
bool crit;
};
@@ -553,11 +597,12 @@ class Spell
void AddGOTarget(uint64 goGUID, uint32 effIndex);
void AddItemTarget(Item* target, uint32 effIndex);
void DoAllEffectOnTarget(TargetInfo *target);
- void DoSpellHitOnUnit(Unit *unit, uint32 effectMask);
+ SpellMissInfo DoSpellHitOnUnit(Unit *unit, uint32 effectMask);
+ void DoTriggersOnSpellHit(Unit *unit);
void DoAllEffectOnTarget(GOTargetInfo *target);
void DoAllEffectOnTarget(ItemTargetInfo *target);
- bool IsAliveUnitPresentInTargetList();
- void SearchAreaTarget(std::list<Unit*> &unitList, float radius, const uint32 type, SpellTargets TargetType, uint32 entry = 0);
+ bool UpdateChanneledTargetList();
+ void SearchAreaTarget(std::list<Unit*> &unitList, float radius, SpellNotifyPushType type, SpellTargets TargetType, uint32 entry = 0);
void SearchChainTarget(std::list<Unit*> &unitList, float radius, uint32 unMaxTargets, SpellTargets TargetType);
WorldObject* SearchNearbyTarget(float range, SpellTargets TargetType);
bool IsValidSingleTargetEffect(Unit const* target, Targets type) const;
@@ -567,6 +612,11 @@ class Spell
void SpellDamageSchoolDmg(uint32 i);
void SpellDamageWeaponDmg(uint32 i);
void SpellDamageHeal(uint32 i);
+
+ void GetSummonPosition(uint32 i, float &x, float &y, float &z, float radius = 0.0f, uint32 count = 0);
+ void SummonGuardian (uint32 entry, SummonPropertiesEntry const *properties);
+
+ SpellCastResult CanOpenLock(uint32 effIndex, uint32 lockid, SkillType& skillid, int32& reqSkillValue, int32& skillValue);
// -------------------------------------------
//List For Triggered Spells
@@ -578,10 +628,6 @@ class Spell
uint32 m_spellState;
uint32 m_timer;
- float m_castPositionX;
- float m_castPositionY;
- float m_castPositionZ;
- float m_castOrientation;
bool m_IsTriggeredSpell;
// if need this can be replaced by Aura copy
@@ -591,6 +637,15 @@ class Spell
uint32 m_customAttr;
bool m_skipCheck;
+ uint32 m_effectMask;
+
+#ifdef MAP_BASED_RAND_GEN
+ int32 irand(int32 min, int32 max) { return int32 (m_caster->GetMap()->mtRand.randInt(max - min)) + min; }
+ uint32 urand(uint32 min, uint32 max) { return m_caster->GetMap()->mtRand.randInt(max - min) + min; }
+ int32 rand32() { return m_caster->GetMap()->mtRand.randInt(); }
+ double rand_norm() { return m_caster->GetMap()->mtRand.randExc(); }
+ double rand_chance() { return m_caster->GetMap()->mtRand.randExc(100.0); }
+#endif
};
namespace Trinity
@@ -599,84 +654,84 @@ namespace Trinity
{
std::list<Unit*> *i_data;
Spell &i_spell;
- const uint32& i_push_type;
+ SpellNotifyPushType i_push_type;
float i_radius, i_radiusSq;
SpellTargets i_TargetType;
- Unit* i_caster;
+ Unit* i_source;
uint32 i_entry;
float i_x, i_y, i_z;
- SpellNotifierCreatureAndPlayer(Spell &spell, std::list<Unit*> &data, float radius, const uint32 &type,
+ SpellNotifierCreatureAndPlayer(Spell &spell, std::list<Unit*> &data, float radius, SpellNotifyPushType type,
SpellTargets TargetType = SPELL_TARGETS_ENEMY, uint32 entry = 0, float x = 0, float y = 0, float z = 0)
: i_data(&data), i_spell(spell), i_push_type(type), i_radius(radius), i_radiusSq(radius*radius)
, i_TargetType(TargetType), i_entry(entry), i_x(x), i_y(y), i_z(z)
{
- i_caster = spell.GetCaster();
+ i_source = spell.GetCaster();
+ assert(i_source);
}
template<class T> inline void Visit(GridRefManager<T> &m)
{
- assert(i_data);
-
- if(!i_caster)
- return;
-
for(typename GridRefManager<T>::iterator itr = m.begin(); itr != m.end(); ++itr)
{
- if( !itr->getSource()->isAlive() || (itr->getSource()->GetTypeId() == TYPEID_PLAYER && ((Player*)itr->getSource())->isInFlight()))
+ Unit *target = (Unit*)itr->getSource();
+
+ // mostly phase check
+ if(!itr->getSource()->IsInMap(i_source))
continue;
switch (i_TargetType)
{
- case SPELL_TARGETS_ALLY:
- if (!itr->getSource()->isAttackableByAOE() || !i_caster->IsFriendlyTo( itr->getSource() ))
- continue;
- break;
case SPELL_TARGETS_ENEMY:
- {
- if(itr->getSource()->GetTypeId()==TYPEID_UNIT && ((Creature*)itr->getSource())->isTotem())
+ if(target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->isTotem())
continue;
- if(!itr->getSource()->isAttackableByAOE())
+ if(!target->isAttackableByAOE())
continue;
-
- Unit* check = i_caster->GetCharmerOrOwnerOrSelf();
-
- if( check->GetTypeId()==TYPEID_PLAYER )
+ if(i_source->IsControlledByPlayer())
{
- if (check->IsFriendlyTo( itr->getSource() ))
+ if(i_source->IsFriendlyTo(target))
continue;
}
else
{
- if (!check->IsHostileTo( itr->getSource() ))
+ if(!i_source->IsHostileTo(target))
continue;
}
- }break;
+ break;
+ case SPELL_TARGETS_ALLY:
+ if(target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->isTotem())
+ continue;
+ if(!target->isAttackableByAOE() || !i_source->IsFriendlyTo(target))
+ continue;
+ break;
case SPELL_TARGETS_ENTRY:
- {
- if(itr->getSource()->GetEntry()!= i_entry)
+ if(target->GetEntry()!= i_entry)
continue;
- }break;
- default: continue;
+ break;
+ default:
+ continue;
}
switch(i_push_type)
{
+ case PUSH_SRC_CENTER:
+ case PUSH_DST_CENTER:
+ case PUSH_CHAIN:
+ default:
+ if((target->GetDistanceSq(i_x, i_y, i_z) < i_radiusSq))
+ i_data->push_back(target);
+ break;
case PUSH_IN_FRONT:
- if(i_caster->isInFront((Unit*)(itr->getSource()), i_radius, M_PI/3 ))
- i_data->push_back(itr->getSource());
+ if(i_source->isInFrontInMap(target, i_radius, M_PI/3))
+ i_data->push_back(target);
break;
case PUSH_IN_BACK:
- if(i_caster->isInBack((Unit*)(itr->getSource()), i_radius, M_PI/3 ))
- i_data->push_back(itr->getSource());
+ if(i_source->isInBackInMap(target, i_radius, M_PI/3))
+ i_data->push_back(target);
break;
case PUSH_IN_LINE:
- if(i_caster->isInLine((Unit*)(itr->getSource()), i_radius ))
- i_data->push_back(itr->getSource());
- break;
- default:
- if((itr->getSource()->GetDistanceSq(i_x, i_y, i_z) < i_radiusSq))
- i_data->push_back(itr->getSource());
+ if(i_source->isInLine(target, i_radius))
+ i_data->push_back(target);
break;
}
}