aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQAston <none@none>2009-04-29 18:05:39 +0200
committerQAston <none@none>2009-04-29 18:05:39 +0200
commit7897fc16f0abb6d2043a595352236836070b8cd3 (patch)
tree897cbae941382c5321eac31ab2d3bca7bfa7d11f
parentc5f7ab377db14e48d10fb4eab4ea6fffa65b7763 (diff)
*Trigger spells after dealing damage by spell.
*Take ammo for autorepeat spells. --HG-- branch : trunk
-rw-r--r--src/game/Level3.cpp4
-rw-r--r--src/game/Spell.cpp50
-rw-r--r--src/game/Spell.h1
3 files changed, 34 insertions, 21 deletions
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index 11a148c6966..0b222bb9741 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -4094,9 +4094,9 @@ bool ChatHandler::HandleAuraCommand(const char* args)
eff_mask|=1<<i;
}
}
+ Aura *Aur = new Aura(spellInfo, eff_mask, NULL, target);
+ target->AddAura(Aur);
}
- Aura *Aur = new Aura(spellInfo, eff_mask, NULL, target);
- target->AddAura(Aur);
return true;
}
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 782a4722579..7b5bfca3a05 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -916,14 +916,17 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
? PROC_EX_INTERNAL_TRIGGERED : PROC_EX_NONE;
m_spellAura = NULL; // Set aura to null for every target-make sure that pointer is not used for unit without aura applied
+ Unit * spellHitTarget = NULL;
if (missInfo==SPELL_MISS_NONE) // In case spell hit target, do all effect on that target
- DoSpellHitOnUnit(unit, mask);
+ spellHitTarget = unit;
else if (missInfo == SPELL_MISS_REFLECT) // In case spell reflect from target, do all effect on caster (if hit)
{
if (target->reflectResult == SPELL_MISS_NONE) // If reflected spell hit caster -> do all effect on him
- DoSpellHitOnUnit(m_caster, mask);
+ spellHitTarget = m_caster;
}
+ DoSpellHitOnUnit(spellHitTarget, mask);
+
// Do not take combo points on dodge
if (m_needComboPoints && m_targets.getUnitTargetGUID() == target->targetGUID)
if( missInfo != SPELL_MISS_NONE && missInfo != SPELL_MISS_MISS)
@@ -995,6 +998,9 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
caster->ProcDamageAndSpell(unit, procAttacker, procVictim, procEx, 0, m_attackType, m_spellInfo);
}
+ // Needs to be called after dealing damage/healing to not remove breaking on damage auras
+ DoTriggersOnSpellHit(spellHitTarget);
+
// Call scripted function for AI if this spell is casted upon a creature (except pets)
if(IS_CREATURE_GUID(target->targetGUID))
{
@@ -1105,22 +1111,6 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
unit->IncrDiminishing(m_diminishGroup);
}
- // Apply additional spell effects to target
- if (m_preCastSpell)
- {
- // Special spell id
- // TODO: Handle all of special spells in one place?
- if(m_preCastSpell==61988)
- {
- //Cast Forbearance
- m_caster->CastSpell(unit,25771, true, m_CastItem);
- // Cast Avenging Wrath Marker
- m_caster->CastSpell(unit,61987, true, m_CastItem);
- }
- else
- m_caster->CastSpell(unit,m_preCastSpell, true, m_CastItem);
- }
-
uint8 aura_effmask = 0;
for (uint8 i = 0; i < 3; ++i)
if (effectMask & (1<<i) && (m_spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA || IsAreaAuraEffect(m_spellInfo->Effect[i])))
@@ -1172,6 +1162,28 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
if(m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->IsAIEnabled)
((Creature*)m_caster)->AI()->SpellHitTarget(unit, m_spellInfo);
+}
+
+void Spell::DoTriggersOnSpellHit(Unit *unit)
+{
+ if (!unit)
+ return;
+
+ // Apply additional spell effects to target
+ if (m_preCastSpell)
+ {
+ // Special spell id
+ // TODO: Handle all of special spells in one place?
+ if(m_preCastSpell==61988)
+ {
+ //Cast Forbearance
+ m_caster->CastSpell(unit,25771, true, m_CastItem);
+ // Cast Avenging Wrath Marker
+ m_caster->CastSpell(unit,61987, true, m_CastItem);
+ }
+ else
+ m_caster->CastSpell(unit,m_preCastSpell, true, m_CastItem);
+ }
if (m_ChanceTriggerSpells.size())
{
@@ -5592,7 +5604,7 @@ void Spell::CalculateDamageDoneForAllTargets()
}
}
- bool usesAmmo = !m_IsTriggeredSpell;
+ bool usesAmmo = !m_IsTriggeredSpell || m_autoRepeat;
if (usesAmmo)
{
Unit::AuraEffectList const& Auras = m_caster->GetAurasByType(SPELL_AURA_ABILITY_CONSUME_NO_AMMO);
diff --git a/src/game/Spell.h b/src/game/Spell.h
index bdcea410b10..d7bbc119572 100644
--- a/src/game/Spell.h
+++ b/src/game/Spell.h
@@ -589,6 +589,7 @@ class Spell
void AddItemTarget(Item* target, uint32 effIndex);
void DoAllEffectOnTarget(TargetInfo *target);
void DoSpellHitOnUnit(Unit *unit, uint32 effectMask);
+ void DoTriggersOnSpellHit(Unit *unit);
void DoAllEffectOnTarget(GOTargetInfo *target);
void DoAllEffectOnTarget(ItemTargetInfo *target);
bool UpdateChanneledTargetList();