aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities/Unit
diff options
context:
space:
mode:
authorMachiavelli <machiavelli.trinity@gmail.com>2011-07-31 19:03:06 +0200
committerMachiavelli <machiavelli.trinity@gmail.com>2011-07-31 21:58:25 +0200
commit58f10c74f72f4bdf00dcf200ce11528d005906cd (patch)
tree36c1239988cde21d760342dad8550b51c02c3c30 /src/server/game/Entities/Unit
parent8753a182631cc7930e7c652092b7176812932435 (diff)
Core/Spells: Change low level bool triggered with bitmask TriggerCastFlags to better manipulate the behaviour of certain triggered spells.
Diffstat (limited to 'src/server/game/Entities/Unit')
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp26
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.h31
2 files changed, 47 insertions, 10 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 0627caee97e..3cba4c678de 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -890,7 +890,12 @@ void Unit::CastStop(uint32 except_spellid)
InterruptSpell(CurrentSpellTypes(i), false);
}
-void Unit::CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
+inline void Unit::CastSpell(Unit* victim, uint32 spellId, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
+{
+ CastSpell(victim, spellId, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
+}
+
+void Unit::CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags /*= TRIGGER_NONE*/, Item* castItem /*= NULL*/, AuraEffect const* triggeredByAura /*= NULL*/, uint64 originalCaster /*= 0*/)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
@@ -900,10 +905,15 @@ void Unit::CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item* castIte
return;
}
- CastSpell(Victim, spellInfo, triggered, castItem, triggeredByAura, originalCaster);
+ CastSpell(victim, spellInfo, triggerFlags, castItem, triggeredByAura, originalCaster);
+}
+
+inline void Unit::CastSpell(Unit* victim, SpellInfo const *spellInfo, bool triggered, Item *castItem/*= NULL*/, AuraEffect const* triggeredByAura /*= NULL*/, uint64 originalCaster /*= 0*/)
+{
+ CastSpell(victim, spellInfo, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
}
-void Unit::CastSpell(Unit* Victim, SpellInfo const* spellInfo, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
+void Unit::CastSpell(Unit* Victim, SpellInfo const* spellInfo, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
{
if (!spellInfo)
{
@@ -924,7 +934,7 @@ void Unit::CastSpell(Unit* Victim, SpellInfo const* spellInfo, bool triggered, I
if (!originalCaster && triggeredByAura)
originalCaster = triggeredByAura->GetCasterGUID();
- Spell* spell = new Spell(this, spellInfo, triggered, originalCaster);
+ Spell* spell = new Spell(this, spellInfo, triggerFlags, originalCaster);
spell->m_CastItem = castItem;
spell->prepare(&targets, triggeredByAura);
@@ -964,7 +974,7 @@ void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit*
if (!originalCaster && triggeredByAura)
originalCaster = triggeredByAura->GetCasterGUID();
- Spell* spell = new Spell(this, spellInfo, triggered, originalCaster);
+ Spell* spell = new Spell(this, spellInfo, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, originalCaster);
if (castItem)
{
@@ -995,7 +1005,7 @@ void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered,
if (!originalCaster && triggeredByAura)
originalCaster = triggeredByAura->GetCasterGUID();
- Spell* spell = new Spell(this, spellInfo, triggered, originalCaster);
+ Spell* spell = new Spell(this, spellInfo, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, originalCaster);
SpellCastTargets targets;
targets.SetDst(x, y, z, GetOrientation());
@@ -1025,7 +1035,7 @@ void Unit::CastSpell(GameObject *go, uint32 spellId, bool triggered, Item* castI
if (!originalCaster && triggeredByAura)
originalCaster = triggeredByAura->GetCasterGUID();
- Spell* spell = new Spell(this, spellInfo, triggered, originalCaster);
+ Spell* spell = new Spell(this, spellInfo, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, originalCaster);
SpellCastTargets targets;
targets.SetGOTarget(go);
@@ -2939,7 +2949,7 @@ void Unit::_UpdateAutoRepeatSpell()
}
// we want to shoot
- Spell* spell = new Spell(this, m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo, true);
+ Spell* spell = new Spell(this, m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo, TRIGGERED_FULL_MASK);
spell->prepare(&(m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_targets));
// all went good, reset attack
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 9f1437b7512..a368309f8cd 100755
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -380,6 +380,31 @@ enum AuraRemoveMode
AURA_REMOVE_BY_DEATH
};
+enum TriggerCastFlags
+{
+ TRIGGERED_NONE = 0x00000000, //! Not triggered
+ TRIGGERED_IGNORE_GCD = 0x00000001, //! Will ignore GCD
+ TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD = 0x00000002, //! Will ignore Spell and Category cooldowns
+ TRIGGERED_IGNORE_POWER_AND_REAGENT_COST = 0x00000004, //! Will ignore power and reagent cost
+ TRIGGERED_IGNORE_CAST_ITEM = 0x00000008, //! Will not take away cast item or update related achievement criteria
+ TRIGGERED_IGNORE_AURA_SCALING = 0x00000010, //! Will ignore aura scaling
+ TRIGGERED_IGNORE_CAST_IN_PROGRESS = 0x00000020, //! Will not check if a current cast is in progress
+ TRIGGERED_IGNORE_COMBO_POINTS = 0x00000040, //! Will ignore combo point requirement
+ TRIGGERED_CAST_DIRECTLY = 0x00000080, //! In Spell::prepare, will be cast directly without setting containers for executed spell
+ TRIGGERED_IGNORE_AURA_INTERRUPT_FLAGS = 0x00000100, //! Will ignore interruptible aura's at cast
+ TRIGGERED_IGNORE_SET_FACING = 0x00000200, //! Will not adjust facing to target (if any)
+ TRIGGERED_IGNORE_SHAPESHIFT = 0x00000400, //! Will ignore shapeshift checks
+ TRIGGERED_IGNORE_CASTER_AURASTATE = 0x00000800, //! Will ignore caster aura states including combat requirements and death state
+ TRIGGERED_IGNORE_TARGET_AURASTATE = 0x00001000, //! Will ignore target aura states
+ TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE = 0x00002000, //! Will ignore mounted/on vehicle restrictions
+ TRIGGERED_IGNORE_TARGET_DETECTABILITY = 0x00004000, //! Will ignore canSeeOrDetect
+ TRIGGERED_IGNORE_LOS = 0x00008000, //! Will ignore LOS to target
+ TRIGGERED_IGNORE_CASTER_AURAS = 0x00010000, //! Will ignore caster aura restrictions or requirements
+ TRIGGERED_ALLOW_PROC_EVENTS = 0x00020000, //! Allows proc events from triggere spell
+ TRIGGERED_DONT_REPORT_CAST_ERROR = 0x00040000, //! Will return SPELL_FAILED_DONT_REPORT in CheckCast functions
+ TRIGGERED_FULL_MASK = 0xFFFFFFFF,
+};
+
enum UnitMods
{
UNIT_MOD_STAT_STRENGTH, // UNIT_MOD_STAT_STRENGTH..UNIT_MOD_STAT_SPIRIT must be in existed order, it's accessed by index values of Stats enum.
@@ -1534,8 +1559,10 @@ class Unit : public WorldObject
void SendEnergizeSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, Powers powertype);
void EnergizeBySpell(Unit *pVictim, uint32 SpellID, uint32 Damage, Powers powertype);
uint32 SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage);
- void CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
- void CastSpell(Unit* Victim, SpellInfo const *spellInfo, bool triggered, Item *castItem= NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
+ void CastSpell(Unit* victim, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
+ void CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
+ void CastSpell(Unit* victim, SpellInfo const *spellInfo, bool triggered, Item *castItem= NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
+ void CastSpell(Unit* victim, SpellInfo const *spellInfo, TriggerCastFlags triggerFlags, Item *castItem= NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0, Unit* originalVictim = 0);
void CastCustomSpell(Unit* Victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem= NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* Victim = NULL, bool triggered = true, Item *castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);