Aways apply additional buff for some spells (an do it as normal cast)

Signed-off-by: DiSlord <dislord@nomail.com>
This commit is contained in:
DiSlord 2009-01-25 03:16:59 +03:00
parent de47d53d9e
commit 528d85ed4d
2 changed files with 47 additions and 62 deletions

View file

@ -347,6 +347,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
focusObject = NULL;
m_cast_count = 0;
m_glyphIndex = 0;
m_preCastSpell = 0;
m_triggeredByAuraSpell = NULL;
//Auto Shot & Shoot (wand)
@ -1137,6 +1138,10 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
if((GetDiminishingReturnsGroupType(m_diminishGroup) == DRTYPE_PLAYER && unit->GetTypeId() == TYPEID_PLAYER) || GetDiminishingReturnsGroupType(m_diminishGroup) == DRTYPE_ALL)
unit->IncrDiminishing(m_diminishGroup);
// Apply additional spell effects to target
if (m_preCastSpell)
m_caster->CastSpell(unit,m_preCastSpell, true, m_CastItem);
for(uint32 effectNumber=0;effectNumber<3;effectNumber++)
{
if (effectMask & (1<<effectNumber))
@ -2202,6 +2207,47 @@ void Spell::cast(bool skipCheck)
}
}
switch(m_spellInfo->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
{
if (m_spellInfo->Mechanic == MECHANIC_BANDAGE) // Bandages
m_preCastSpell = 11196; // Recently Bandaged
else if(m_spellInfo->SpellIconID == 1662 && m_spellInfo->AttributesEx & 0x20) // Blood Fury (Racial)
m_preCastSpell = 23230; // Blood Fury - Healing Reduction
break;
}
case SPELLFAMILY_MAGE:
{
if (m_spellInfo->SpellFamilyFlags&0x0000008000000000LL) // Ice Block
m_preCastSpell = 41425; // Hypothermia
break;
}
case SPELLFAMILY_PRIEST:
{
if (m_spellInfo->Mechanic == MECHANIC_SHIELD &&
m_spellInfo->SpellIconID == 566) // Power Word: Shield
m_preCastSpell = 6788; // Weakened Soul
break;
}
case SPELLFAMILY_PALADIN:
{
if (m_spellInfo->SpellFamilyFlags&0x0000000000400080LL) // Divine Shield, Divine Protection or Hand of Protection
m_preCastSpell = 25771; // Forbearance
break;
}
case SPELLFAMILY_SHAMAN:
{
if (m_spellInfo->Id == 2825) // Bloodlust
m_preCastSpell = 57724; // Sated
else if (m_spellInfo->Id == 32182) // Heroism
m_preCastSpell = 57723; // Exhaustion
break;
}
default:
break;
}
// Conflagrate - consumes immolate
if ((m_spellInfo->TargetAuraState == AURA_STATE_IMMOLATE) && m_targets.getUnitTarget())
{
@ -2697,68 +2743,6 @@ void Spell::finish(bool ok)
((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)
if(!m_TriggerSpells.empty())
TriggerSpell();