Core/Auras: Fix Cold Blood handling on misses and parries.

Patch by dr.tenma.
Fixes issue #2291

--HG--
branch : trunk
This commit is contained in:
silinoron
2010-12-18 13:06:38 -08:00
parent 8ce0abbbc8
commit 41a9d3216c
3 changed files with 15 additions and 2 deletions
+5 -1
View File
@@ -19226,7 +19226,7 @@ void Player::AddSpellMod(SpellModifier* mod, bool apply)
}
// Restore spellmods in case of failed cast
void Player::RestoreSpellMods(Spell * spell)
void Player::RestoreSpellMods(Spell *spell, uint32 ownerAuraId)
{
if (!spell || spell->m_appliedMods.empty())
return;
@@ -19241,6 +19241,10 @@ void Player::RestoreSpellMods(Spell * spell)
if (!mod->ownerAura || !mod->ownerAura->GetCharges())
continue;
// Restore only specific owner aura mods
if (ownerAuraId && (ownerAuraId != mod->ownerAura->GetSpellProto()->Id))
continue;
// check if mod affected this spell
Spell::UsedSpellMods::iterator iterMod = spell->m_appliedMods.find(mod->ownerAura);
if (iterMod == spell->m_appliedMods.end())
+1 -1
View File
@@ -1605,7 +1605,7 @@ class Player : public Unit, public GridObject<Player>
bool IsAffectedBySpellmod(SpellEntry const *spellInfo, SpellModifier *mod, Spell * spell = NULL);
template <class T> T ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell * spell = NULL);
void RemoveSpellMods(Spell * spell);
void RestoreSpellMods(Spell * spell);
void RestoreSpellMods(Spell *spell, uint32 ownerAuraId=0);
void DropModCharge(SpellModifier * mod, Spell * spell);
void SetSpellModTakingSpell(Spell* spell, bool apply);
+9
View File
@@ -1198,7 +1198,16 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
// Do not take combo points on dodge and miss
if (m_needComboPoints && m_targets.getUnitTargetGUID() == target->targetGUID)
if (missInfo != SPELL_MISS_NONE)
{
m_needComboPoints = false;
// Restore spell mods for a miss/dodge/parry Cold Blood
// TODO: check how broad this rule should be
if (m_caster->GetTypeId() == TYPEID_PLAYER)
if ((missInfo == SPELL_MISS_MISS) ||
(missInfo == SPELL_MISS_DODGE) ||
(missInfo == SPELL_MISS_PARRY))
m_caster->ToPlayer()->RestoreSpellMods(this, 14177);
}
// Trigger info was not filled in spell::preparedatafortriggersystem - we do it now
if (canEffectTrigger && !procAttacker && !procVictim)