*Trigger spells after dealing damage by spell.

*Take ammo for autorepeat spells.

--HG--
branch : trunk
This commit is contained in:
QAston
2009-04-29 18:05:39 +02:00
parent c5f7ab377d
commit 7897fc16f0
3 changed files with 34 additions and 21 deletions
+1 -1
View File
@@ -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);
}
return true;
}
+31 -19
View File
@@ -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);
+1
View File
@@ -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();