Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[p91] Fix: Implement aura SPELL_AURA_ALLOW_ONLY_ABILITY.
  • Loading branch information
Maxxie committed Feb 18, 2009
1 parent 891967a commit f4d1e05
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/game/Spell.cpp
Expand Up @@ -4646,6 +4646,18 @@ uint8 Spell::CheckCasterAuras() const
prevented_reason = SPELL_FAILED_SILENCED;
else if(unitflag & UNIT_FLAG_PACIFIED && m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_PACIFY)
prevented_reason = SPELL_FAILED_PACIFIED;
else if(m_caster->HasAuraType(SPELL_AURA_ALLOW_ONLY_ABILITY))
{
Unit::AuraList const& casingLimit = m_caster->GetAurasByType(SPELL_AURA_ALLOW_ONLY_ABILITY);
for(Unit::AuraList::const_iterator itr = casingLimit.begin(); itr != casingLimit.end(); ++itr)
{
if(m_spellInfo->SpellFamilyFlags != (uint64)(*itr)->getAuraSpellClassMask())
{
prevented_reason = SPELL_FAILED_CASTER_AURASTATE;
break;
}
}
}

// Attr must make flag drop spell totally immune from all effects
if(prevented_reason)
Expand Down
24 changes: 23 additions & 1 deletion src/game/SpellAuras.cpp
Expand Up @@ -313,7 +313,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
&Aura::HandleNoImmediateEffect, //260 SPELL_AURA_SCREEN_EFFECT (miscvalue = id in ScreenEffect.dbc) not required any code
&Aura::HandlePhase, //261 SPELL_AURA_PHASE undetactable invisibility? implemented in Unit::isVisibleForOrDetect
&Aura::HandleNULL, //262
&Aura::HandleNULL, //263 SPELL_AURA_ALLOW_ONLY_ABILITY player can use only abilities set in SpellClassMask
&Aura::HandleAllowOnlyAbility, //263 SPELL_AURA_ALLOW_ONLY_ABILITY player can use only abilities set in SpellClassMask
&Aura::HandleUnused, //264 unused (3.0.8a)
&Aura::HandleUnused, //265 unused (3.0.8a)
&Aura::HandleUnused, //266 unused (3.0.8a)
Expand Down Expand Up @@ -6713,3 +6713,25 @@ void Aura::HandlePhase(bool apply, bool Real)
m_target->SetVisibility(m_target->GetVisibility());
}

void Aura::HandleAllowOnlyAbility(bool apply, bool Real)
{
if(!Real)
return;

if(apply)
{
m_target->setAttackTimer(BASE_ATTACK,m_duration);
m_target->setAttackTimer(RANGED_ATTACK,m_duration);
m_target->setAttackTimer(OFF_ATTACK,m_duration);
}
else
{
m_target->resetAttackTimer(BASE_ATTACK);
m_target->resetAttackTimer(RANGED_ATTACK);
m_target->resetAttackTimer(OFF_ATTACK);
}

m_target->UpdateDamagePhysical(BASE_ATTACK);
m_target->UpdateDamagePhysical(RANGED_ATTACK);
m_target->UpdateDamagePhysical(OFF_ATTACK);
}
1 change: 1 addition & 0 deletions src/game/SpellAuras.h
Expand Up @@ -209,6 +209,7 @@ class MANGOS_DLL_SPEC Aura
void HandleAuraIncreaseBaseHealthPercent(bool Apply, bool Real);
void HandleNoReagentUseAura(bool Apply, bool Real);
void HandlePhase(bool Apply, bool Real);
void HandleAllowOnlyAbility(bool Apply, bool Real);

virtual ~Aura();

Expand Down

0 comments on commit f4d1e05

Please sign in to comment.