aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorQAston <none@none>2009-06-12 11:59:58 +0200
committerQAston <none@none>2009-06-12 11:59:58 +0200
commitf7c50a6f01042e401e7dee664d140857d42b7fa5 (patch)
tree3a19a6a0e63c13c1e2a0630cd85ac8c757ea6fba /src
parent87fdc76117683190ba47baad62829e76ffd3448c (diff)
*Apply 6 second rule for drinking in arenas.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/SpellAuras.cpp53
-rw-r--r--src/game/SpellAuras.h2
2 files changed, 45 insertions, 10 deletions
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index eb55943e3c4..60c4b41ab38 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -6440,24 +6440,59 @@ void AuraEffect::PeriodicDummyTick()
case 22734:
case 27089:
case 34291:
- case 43706:
case 46755:
case 49472: // Drink Coffee
case 61830:
{
if (m_target->GetTypeId() != TYPEID_PLAYER)
return;
- // Search SPELL_AURA_MOD_POWER_REGEN aura for this spell and add bonus
- Unit::AuraEffectList const& aura = m_target->GetAurasByType(SPELL_AURA_MOD_POWER_REGEN);
- for(Unit::AuraEffectList::const_iterator i = aura.begin(); i != aura.end(); ++i)
+ // Get SPELL_AURA_MOD_POWER_REGEN aura from spell
+ if (AuraEffect * aurEff = GetParentAura()->GetPartAura(0))
{
- if ((*i)->GetId() == GetId())
+ if (aurEff->GetAuraName() !=SPELL_AURA_MOD_POWER_REGEN)
{
- (*i)->SetAmount(m_amount);
- ((Player*)m_target)->UpdateManaRegen();
- // Disable continue
m_isPeriodic = false;
- return;
+ sLog.outError("Aura %d structure has been changed - first aura is no longer SPELL_AURA_MOD_POWER_REGEN", spell->Id);
+ }
+ else
+ {
+ // default case - not in arena
+ if (!((Player*)m_target)->InArena())
+ {
+ aurEff->SetAmount(GetAmount());
+ ((Player*)m_target)->UpdateManaRegen();
+ m_isPeriodic = false;
+ }
+ else
+ {
+ //**********************************************
+ // This feature uses only in arenas
+ //**********************************************
+ // Here need increase mana regen per tick (6 second rule)
+ // on 0 tick - 0 (handled in 2 second)
+ // on 1 tick - 166% (handled in 4 second)
+ // on 2 tick - 133% (handled in 6 second)
+
+ // Apply bonus for 1 - 4 tick
+ switch (m_tickNumber)
+ {
+ case 1: // 0%
+ aurEff->SetAmount(0);
+ break;
+ case 2: // 166%
+ aurEff->SetAmount(GetAmount() * 5 / 3);
+ break;
+ case 3: // 133%
+ aurEff->SetAmount(GetAmount() * 4 / 3);
+ break;
+ default: // 100% - normal regen
+ aurEff->SetAmount(GetAmount());
+ // No need to update after 4th tick
+ m_isPeriodic = false;
+ break;
+ }
+ ((Player*)m_target)->UpdateManaRegen();
+ }
}
}
return;
diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h
index db99660b0ec..36f576b89fe 100644
--- a/src/game/SpellAuras.h
+++ b/src/game/SpellAuras.h
@@ -69,7 +69,7 @@ class TRINITY_DLL_SPEC Aura
void SetAuraMaxDuration(int32 duration) { m_maxduration = duration; }
int32 GetAuraDuration() const { return m_duration; }
void SetAuraDuration(int32 duration, bool withMods = false);
- void RefreshAura() { SetAuraDuration(m_maxduration); }
+ void RefreshAura() { SetAuraDuration(m_maxduration);}
bool IsExpired() const { return !GetAuraDuration() && !(IsPermanent() || IsPassive()); }
void SendAuraUpdate();