aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp63
-rw-r--r--src/server/game/Entities/Unit/Unit.h6
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp33
-rw-r--r--src/server/game/Spells/Spell.cpp6
4 files changed, 86 insertions, 22 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 85caa2c46d2..97a97a2afb8 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -4632,6 +4632,15 @@ bool Unit::HasAuraTypeWithMiscvalue(AuraType auratype, int32 miscvalue) const
return false;
}
+bool Unit::HasAuraTypeWithAffectMask(AuraType auratype, SpellEntry const * affectedSpell) const
+{
+ AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
+ for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
+ if ((*i)->IsAffectedOnSpell(affectedSpell))
+ return true;
+ return false;
+}
+
bool Unit::HasAuraTypeWithValue(AuraType auratype, int32 value) const
{
AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
@@ -4877,6 +4886,60 @@ int32 Unit::GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 misc_
return modifier;
}
+int32 Unit::GetTotalAuraModifierByAffectMask(AuraType auratype, SpellEntry const * affectedSpell) const
+{
+ int32 modifier = 0;
+
+ AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
+ for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
+ {
+ if ((*i)->IsAffectedOnSpell(affectedSpell))
+ modifier += (*i)->GetAmount();
+ }
+ return modifier;
+}
+
+float Unit::GetTotalAuraMultiplierByAffectMask(AuraType auratype, SpellEntry const * affectedSpell) const
+{
+ float multiplier = 1.0f;
+
+ AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
+ for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
+ {
+ if ((*i)->IsAffectedOnSpell(affectedSpell))
+ multiplier *= (100.0f + (*i)->GetAmount())/100.0f;
+ }
+ return multiplier;
+}
+
+int32 Unit::GetMaxPositiveAuraModifierByAffectMask(AuraType auratype, SpellEntry const * affectedSpell) const
+{
+ int32 modifier = 0;
+
+ AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
+ for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
+ {
+ if ((*i)->IsAffectedOnSpell(affectedSpell) && (*i)->GetAmount() > modifier)
+ modifier = (*i)->GetAmount();
+ }
+
+ return modifier;
+}
+
+int32 Unit::GetMaxNegativeAuraModifierByAffectMask(AuraType auratype, SpellEntry const * affectedSpell) const
+{
+ int32 modifier = 0;
+
+ AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
+ for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
+ {
+ if ((*i)->IsAffectedOnSpell(affectedSpell) && (*i)->GetAmount() < modifier)
+ modifier = (*i)->GetAmount();
+ }
+
+ return modifier;
+}
+
void Unit::AddDynObject(DynamicObject* dynObj)
{
m_dynObjGUIDs.push_back(dynObj->GetGUID());
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 63b8c9db058..692b34cfbcb 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1587,6 +1587,7 @@ class Unit : public WorldObject
bool HasAura(uint32 spellId, uint64 caster = 0, uint8 reqEffMask = 0) const;
bool HasAuraType(AuraType auraType) const;
bool HasAuraTypeWithMiscvalue(AuraType auratype, int32 miscvalue) const;
+ bool HasAuraTypeWithAffectMask(AuraType auratype, SpellEntry const * affectedSpell) const;
bool HasAuraTypeWithValue(AuraType auratype, int32 value) const;
bool HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid = 0);
@@ -1609,6 +1610,11 @@ class Unit : public WorldObject
int32 GetMaxPositiveAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const;
int32 GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const;
+ int32 GetTotalAuraModifierByAffectMask(AuraType auratype, SpellEntry const * affectedSpell) const;
+ float GetTotalAuraMultiplierByAffectMask(AuraType auratype, SpellEntry const * affectedSpell) const;
+ int32 GetMaxPositiveAuraModifierByAffectMask(AuraType auratype, SpellEntry const * affectedSpell) const;
+ int32 GetMaxNegativeAuraModifierByAffectMask(AuraType auratype, SpellEntry const * affectedSpell) const;
+
float GetResistanceBuffMods(SpellSchools school, bool positive) const { return GetFloatValue(positive ? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+school : UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+school); }
void SetResistanceBuffMods(SpellSchools school, bool positive, float val) { SetFloatValue(positive ? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+school : UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+school,val); }
void ApplyResistanceBuffModsMod(SpellSchools school, bool positive, float val, bool apply) { ApplyModSignedFloatValue(positive ? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+school : UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+school, val, apply); }
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 8e47d4aa29d..7530ad53d19 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -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;
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index c24efa2b9ab..874391f0f3a 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -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);