Skip to content

Commit

Permalink
[8956] Implement aura SPELL_AURA_ALLOW_ONLY_ABILITY.
Browse files Browse the repository at this point in the history
(cherry picked from commit f4d1e05)

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
  • Loading branch information
Maxxie authored and VladimirMangos committed Dec 9, 2009
1 parent a4c38e8 commit 3e11ed4
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 4 deletions.
14 changes: 13 additions & 1 deletion src/game/Spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4972,6 +4972,18 @@ SpellCastResult 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(!IsAffectedByAura(*itr))
{
prevented_reason = SPELL_FAILED_CASTER_AURASTATE;
break;
}
}
}

// Attr must make flag drop spell totally immune from all effects
if (prevented_reason != SPELL_CAST_OK)
Expand Down Expand Up @@ -5726,7 +5738,7 @@ void Spell::UpdatePointers()
m_targets.Update(m_caster);
}

bool Spell::IsAffectedByAura(Aura *aura)
bool Spell::IsAffectedByAura(Aura *aura) const
{
return sSpellMgr.IsAffectedByMod(m_spellInfo, aura->getAuraSpellMod());
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/Spell.h
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ class Spell

void UpdatePointers(); // must be used at call Spell code after time delay (non triggered spell cast/update spell call/etc)

bool IsAffectedByAura(Aura *aura);
bool IsAffectedByAura(Aura *aura) const;

bool CheckTargetCreatureType(Unit* target) const;

Expand Down
25 changes: 24 additions & 1 deletion src/game/SpellAuras.cpp
Original file line number Diff line number Diff line change
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 undetectable invisibility? implemented in Unit::isVisibleForOrDetect
&Aura::HandleNULL, //262 ignore combat/aura state?
&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-3.2.2a)
&Aura::HandleUnused, //265 unused (3.0.8a-3.2.2a)
&Aura::HandleUnused, //266 unused (3.0.8a-3.2.2a)
Expand Down Expand Up @@ -7627,3 +7627,26 @@ void Aura::HandleAuraModAllCritChance(bool apply, bool Real)
// included in Player::UpdateSpellCritChance calculation
((Player*)m_target)->UpdateAllSpellCritChances();
}

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
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ class MANGOS_DLL_SPEC Aura
void HandlePhase(bool Apply, bool Real);
void HandleModTargetArmorPct(bool Apply, bool Real);
void HandleAuraModAllCritChance(bool Apply, bool Real);
void HandleAllowOnlyAbility(bool Apply, bool Real);

virtual ~Aura();

Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "8955"
#define REVISION_NR "8956"
#endif // __REVISION_NR_H__

0 comments on commit 3e11ed4

Please sign in to comment.