[7025] Restore work/add new spell post effects

Signed-off-by: DiSlord <dislord@nomail.com>
This commit is contained in:
DiSlord 2009-01-05 01:44:27 +03:00
parent f50083928a
commit d65458b0de
4 changed files with 73 additions and 24 deletions

View file

@ -2670,6 +2670,68 @@ void Spell::finish(bool ok)
((Player*)m_caster)->ClearComboPoints(); ((Player*)m_caster)->ClearComboPoints();
} }
// Post effects apply on spell targets in some spells
if(!m_UniqueTargetInfo.empty())
{
uint32 spellId = 0;
switch(m_spellInfo->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
{
if (m_spellInfo->Mechanic == MECHANIC_BANDAGE) // Bandages
spellId = 11196; // Recently Bandaged
else if(m_spellInfo->SpellIconID == 1662 && m_spellInfo->AttributesEx & 0x20) // Blood Fury (Racial)
spellId = 23230; // Blood Fury - Healing Reduction
break;
}
case SPELLFAMILY_MAGE:
{
if (m_spellInfo->SpellFamilyFlags&0x0000008000000000LL) // Ice Block
spellId = 41425; // Hypothermia
break;
}
case SPELLFAMILY_PRIEST:
{
if (m_spellInfo->Mechanic == MECHANIC_SHIELD &&
m_spellInfo->SpellIconID == 566) // Power Word: Shield
spellId = 6788; // Weakened Soul
break;
}
case SPELLFAMILY_PALADIN:
{
if (m_spellInfo->SpellFamilyFlags&0x0000000000400080LL) // Divine Shield, Divine Protection or Hand of Protection
spellId = 25771; // Forbearance
break;
}
case SPELLFAMILY_SHAMAN:
{
if (m_spellInfo->Id == 2825) // Bloodlust
spellId = 57724; // Sated
else if (m_spellInfo->Id == 32182) // Heroism
spellId = 57723; // Exhaustion
break;
}
default:
break;
}
if (spellId)
{
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
{
Unit* unit = m_caster->GetGUID()==ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);
if (unit)
{
// TODO: fix me use cast spell (now post spell can immune by this spell)
// m_caster->CastSpell(unit, spellId, true, m_CastItem);
SpellEntry const *AdditionalSpellInfo = sSpellStore.LookupEntry(spellId);
if (!AdditionalSpellInfo)
continue;
Aura* AdditionalAura = CreateAura(AdditionalSpellInfo, 0, &m_currentBasePoints[0], unit, m_caster, m_CastItem);
unit->AddAura(AdditionalAura);
}
}
}
}
// call triggered spell only at successful cast (after clear combo points -> for add some if need) // call triggered spell only at successful cast (after clear combo points -> for add some if need)
if(!m_TriggerSpells.empty()) if(!m_TriggerSpells.empty())
TriggerSpell(); TriggerSpell();
@ -3817,7 +3879,7 @@ uint8 Spell::CanCast(bool strict)
} }
} }
if(!m_triggeredByAuraSpell) if(!m_IsTriggeredSpell)
if(uint8 castResult = CheckRange(strict)) if(uint8 castResult = CheckRange(strict))
return castResult; return castResult;
@ -3826,7 +3888,7 @@ uint8 Spell::CanCast(bool strict)
return castResult; return castResult;
} }
if(!m_triggeredByAuraSpell) // triggered spell not affected by stun/etc if(!m_IsTriggeredSpell) // triggered spell not affected by stun/etc
if(uint8 castResult = CheckCasterAuras()) if(uint8 castResult = CheckCasterAuras())
return castResult; return castResult;
@ -5248,6 +5310,12 @@ bool Spell::CheckTarget( Unit* target, uint32 eff )
return false; return false;
} }
// Check Aura spell req (need for AoE spells)
if(m_spellInfo->targetAuraSpell && !target->HasAura(m_spellInfo->targetAuraSpell))
return false;
if (m_spellInfo->excludeTargetAuraSpell && target->HasAura(m_spellInfo->excludeTargetAuraSpell))
return false;
// Check targets for not_selectable unit flag and remove // Check targets for not_selectable unit flag and remove
// A player can cast spells on his pet (or other controlled unit) though in any state // A player can cast spells on his pet (or other controlled unit) though in any state
if (target != m_caster && target->GetCharmerOrOwnerGUID() != m_caster->GetGUID()) if (target != m_caster && target->GetCharmerOrOwnerGUID() != m_caster->GetGUID())

View file

@ -2195,25 +2195,6 @@ void Spell::EffectApplyAura(uint32 i)
if(!Aur) if(!Aur)
return; return;
// TODO Make a way so it works for every related spell!
if(unitTarget->GetTypeId()==TYPEID_PLAYER) // Negative buff should only be applied on players
{
uint32 spellId = 0;
if (m_spellInfo->Mechanic == MECHANIC_BANDAGE) // Bandages
spellId = 11196; // Recently Bandaged
else if( (m_spellInfo->AttributesEx & 0x20) && (m_spellInfo->AttributesEx2 & 0x20000) )
spellId = 23230; // Blood Fury - Healing Reduction
SpellEntry const *AdditionalSpellInfo = sSpellStore.LookupEntry(spellId);
if (AdditionalSpellInfo)
{
// applied at target by target
Aura* AdditionalAura = CreateAura(AdditionalSpellInfo, 0, &m_currentBasePoints[0], unitTarget,unitTarget, 0);
unitTarget->AddAura(AdditionalAura);
sLog.outDebug("Spell: Additional Aura is: %u", AdditionalSpellInfo->EffectApplyAuraName[0]);
}
}
// Prayer of Mending (jump animation), we need formal caster instead original for correct animation // Prayer of Mending (jump animation), we need formal caster instead original for correct animation
if( m_spellInfo->SpellFamilyName == SPELLFAMILY_PRIEST && (m_spellInfo->SpellFamilyFlags & 0x00002000000000LL)) if( m_spellInfo->SpellFamilyName == SPELLFAMILY_PRIEST && (m_spellInfo->SpellFamilyFlags & 0x00002000000000LL))
m_caster->CastSpell(unitTarget, 41637, true, NULL, Aur, m_originalCasterGUID); m_caster->CastSpell(unitTarget, 41637, true, NULL, Aur, m_originalCasterGUID);

View file

@ -2390,7 +2390,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool
if (pVictim->GetTypeId()==TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode()) if (pVictim->GetTypeId()==TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
return SPELL_MISS_EVADE; return SPELL_MISS_EVADE;
// Check for immune (use charges) // Check for immune
if (pVictim->IsImmunedToSpell(spell)) if (pVictim->IsImmunedToSpell(spell))
return SPELL_MISS_IMMUNE; return SPELL_MISS_IMMUNE;
@ -2399,7 +2399,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool
if (IsPositiveSpell(spell->Id)) if (IsPositiveSpell(spell->Id))
return SPELL_MISS_NONE; return SPELL_MISS_NONE;
// Check for immune (use charges) // Check for immune
if (pVictim->IsImmunedToDamage(GetSpellSchoolMask(spell))) if (pVictim->IsImmunedToDamage(GetSpellSchoolMask(spell)))
return SPELL_MISS_IMMUNE; return SPELL_MISS_IMMUNE;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "7024" #define REVISION_NR "7025"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__