Core/Spells: Define and implement SPELL_ATTR4_PROC_ONLY_ON_DUMMY.

Fixes #2685
Fixes #2573
This commit is contained in:
Liberate
2011-10-19 22:08:54 +02:00
parent 1431a5d15c
commit a658d0b592
3 changed files with 12 additions and 13 deletions
@@ -409,7 +409,7 @@ enum SpellAttr3
enum SpellAttr4
{
SPELL_ATTR4_UNK0 = 0x00000001, // 0
SPELL_ATTR4_UNK1 = 0x00000002, // 1 proc on finishing move?
SPELL_ATTR4_PROC_ONLY_ON_DUMMY = 0x00000002, // 1 proc only on SPELL_EFFECT_DUMMY?
SPELL_ATTR4_UNK2 = 0x00000004, // 2
SPELL_ATTR4_UNK3 = 0x00000008, // 3
SPELL_ATTR4_UNK4 = 0x00000010, // 4 This will no longer cause guards to attack on use??
+10 -11
View File
@@ -1201,7 +1201,6 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
m_spellAura = NULL; // Set aura to null for every target-make sure that pointer is not used for unit without aura applied
//Spells with this flag cannot trigger if effect is casted on self
// Slice and Dice, relentless strikes, eviscerate
bool canEffectTrigger = !(m_spellInfo->AttributesEx3 & SPELL_ATTR3_CANT_TRIGGER_PROC) && unitTarget->CanProc() && CanExecuteTriggersOnHit(mask);
Unit* spellHitTarget = NULL;
@@ -1597,12 +1596,12 @@ void Spell::DoTriggersOnSpellHit(Unit* unit, uint8 effMask)
// this is executed after spell proc spells on target hit
// spells are triggered for each hit spell target
// info confirmed with retail sniffs of permafrost and shadow weaving
if (!m_hitTriggerSpells.empty() && CanExecuteTriggersOnHit(effMask))
if (!m_hitTriggerSpells.empty())
{
int _duration = 0;
for (HitTriggerSpells::const_iterator i = m_hitTriggerSpells.begin(); i != m_hitTriggerSpells.end(); ++i)
{
if (roll_chance_i(i->second))
if (CanExecuteTriggersOnHit(effMask, i->first) && roll_chance_i(i->second))
{
m_caster->CastSpell(unit, i->first, true);
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell %d triggered spell %d by SPELL_AURA_ADD_TARGET_TRIGGER aura", m_spellInfo->Id, i->first->Id);
@@ -7092,17 +7091,17 @@ void Spell::CallScriptAfterUnitTargetSelectHandlers(std::list<Unit*>& unitTarget
}
}
bool Spell::CanExecuteTriggersOnHit(uint8 effMask) const
bool Spell::CanExecuteTriggersOnHit(uint8 effMask, SpellInfo const* spellInfo) const
{
// check which effects can trigger proc
// don't allow to proc for dummy-only spell target hits
// prevents triggering/procing effects twice from spells like Eviscerate
for (uint8 i = 0;effMask && i < MAX_SPELL_EFFECTS; ++i)
bool only_on_dummy = (spellInfo && (spellInfo->AttributesEx4 & SPELL_ATTR4_PROC_ONLY_ON_DUMMY));
// If triggered spell has SPELL_ATTR4_PROC_ONLY_ON_DUMMY then it can only proc on a casted spell with SPELL_EFFECT_DUMMY
// If triggered spell doesn't have SPELL_ATTR4_PROC_ONLY_ON_DUMMY then it can NOT proc on SPELL_EFFECT_DUMMY (needs confirmation)
for (uint8 i = 0;i < MAX_SPELL_EFFECTS; ++i)
{
if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_DUMMY)
effMask &= ~(1<<i);
if ((effMask & (1 << i)) && (only_on_dummy == (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_DUMMY)))
return true;
}
return effMask;
return false;
}
void Spell::PrepareTriggersExecutedOnHit()
+1 -1
View File
@@ -633,7 +633,7 @@ class Spell
void CallScriptAfterUnitTargetSelectHandlers(std::list<Unit*>& unitTargets, SpellEffIndex effIndex);
std::list<SpellScript*> m_loadedScripts;
bool CanExecuteTriggersOnHit(uint8 effMask) const;
bool CanExecuteTriggersOnHit(uint8 effMask, SpellInfo const* spellInfo = NULL) const;
void PrepareTriggersExecutedOnHit();
typedef std::list< std::pair<SpellInfo const*, int32> > HitTriggerSpells;
HitTriggerSpells m_hitTriggerSpells;