*Add helpers for checking auras present on unit by type and spell affect mask

*Add linked SPELL_AURA_PERIODIC_HASTE to shadowform spell - by dr.tenma

--HG--
branch : trunk
This commit is contained in:
QAston
2010-08-01 01:22:13 +02:00
parent 9cc4a9a6da
commit 2212eb604d
4 changed files with 86 additions and 22 deletions
@@ -785,30 +785,20 @@ void AuraEffect::CalculatePeriodic(Unit * caster, bool create)
Player* modOwner = caster ? caster->GetSpellModOwner() : NULL;
// Apply casting time mods
if (modOwner && m_amplitude)
if (m_amplitude)
{
// Apply periodic time mod
modOwner->ApplySpellMod(GetId(), SPELLMOD_ACTIVATION_TIME, m_amplitude);
if (modOwner)
modOwner->ApplySpellMod(GetId(), SPELLMOD_ACTIVATION_TIME, m_amplitude);
// For channeled spells
if (IsChanneledSpell(m_spellProto)) {
modOwner->ModSpellCastTime(m_spellProto, m_amplitude);
}
// For spells that can benefit from haste
else if (modOwner->HasAuraType(SPELL_AURA_PERIODIC_HASTE))
if (caster)
{
const Unit::AuraEffectList &effList = modOwner->GetAuraEffectsByType(SPELL_AURA_PERIODIC_HASTE);
for (Unit::AuraEffectList::const_iterator itr = effList.begin(), end = effList.end(); itr != end; ++itr)
{
if ((*itr)->IsAffectedOnSpell(m_spellProto))
{
float hasteMod = modOwner->GetFloatValue(UNIT_MOD_CAST_SPEED);
m_amplitude *= hasteMod;
GetBase()->SetMaxDuration(GetBase()->GetMaxDuration() * hasteMod);
GetBase()->SetDuration(GetBase()->GetDuration() * hasteMod);
break;
}
}
// Haste modifies periodic time of channeled spells
if (IsChanneledSpell(m_spellProto))
caster->ModSpellCastTime(m_spellProto, m_amplitude);
// and periodic time of auras affected by SPELL_AURA_PERIODIC_HASTE
if (caster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, m_spellProto))
m_amplitude *= caster->GetFloatValue(UNIT_MOD_CAST_SPEED);
}
}
@@ -2252,7 +2242,7 @@ void AuraEffect::TriggerSpell(Unit * target, Unit * caster) const
case 53303:
case 53304:
// We are standing at the moment
if (GetAmount() > -1)
if (GetAmount() > 0)
return;
triggerSpellId = 64418 + auraId - 53302;
@@ -2461,6 +2451,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit * target, bool apply) const
break;
case FORM_SHADOW:
spellId = 49868;
spellId2 = 71167;
break;
case FORM_GHOSTWOLF:
spellId = 67116;
+5 -1
View File
@@ -1441,10 +1441,14 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool
duration = m_originalCaster->ModSpellDuration(aurSpellInfo, unit, duration, positive);
//mod duration of channeled aura by spell haste
// Haste modifies duration of channeled spells
if (IsChanneledSpell(m_spellInfo))
m_originalCaster->ModSpellCastTime(aurSpellInfo, duration, this);
// and duration of auras affected by SPELL_AURA_PERIODIC_HASTE
if (m_originalCaster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, aurSpellInfo))
duration *= m_originalCaster->GetFloatValue(UNIT_MOD_CAST_SPEED);
if (duration != m_spellAura->GetMaxDuration())
{
m_spellAura->SetMaxDuration(duration);