*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:
@@ -4632,6 +4632,15 @@ bool Unit::HasAuraTypeWithMiscvalue(AuraType auratype, int32 miscvalue) const
|
|||||||
return false;
|
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
|
bool Unit::HasAuraTypeWithValue(AuraType auratype, int32 value) const
|
||||||
{
|
{
|
||||||
AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
|
AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
|
||||||
@@ -4877,6 +4886,60 @@ int32 Unit::GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 misc_
|
|||||||
return modifier;
|
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)
|
void Unit::AddDynObject(DynamicObject* dynObj)
|
||||||
{
|
{
|
||||||
m_dynObjGUIDs.push_back(dynObj->GetGUID());
|
m_dynObjGUIDs.push_back(dynObj->GetGUID());
|
||||||
|
|||||||
@@ -1587,6 +1587,7 @@ class Unit : public WorldObject
|
|||||||
bool HasAura(uint32 spellId, uint64 caster = 0, uint8 reqEffMask = 0) const;
|
bool HasAura(uint32 spellId, uint64 caster = 0, uint8 reqEffMask = 0) const;
|
||||||
bool HasAuraType(AuraType auraType) const;
|
bool HasAuraType(AuraType auraType) const;
|
||||||
bool HasAuraTypeWithMiscvalue(AuraType auratype, int32 miscvalue) const;
|
bool HasAuraTypeWithMiscvalue(AuraType auratype, int32 miscvalue) const;
|
||||||
|
bool HasAuraTypeWithAffectMask(AuraType auratype, SpellEntry const * affectedSpell) const;
|
||||||
bool HasAuraTypeWithValue(AuraType auratype, int32 value) const;
|
bool HasAuraTypeWithValue(AuraType auratype, int32 value) const;
|
||||||
bool HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid = 0);
|
bool HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid = 0);
|
||||||
|
|
||||||
@@ -1609,6 +1610,11 @@ class Unit : public WorldObject
|
|||||||
int32 GetMaxPositiveAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const;
|
int32 GetMaxPositiveAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const;
|
||||||
int32 GetMaxNegativeAuraModifierByMiscValue(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); }
|
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 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); }
|
void ApplyResistanceBuffModsMod(SpellSchools school, bool positive, float val, bool apply) { ApplyModSignedFloatValue(positive ? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+school : UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+school, val, apply); }
|
||||||
|
|||||||
@@ -785,30 +785,20 @@ void AuraEffect::CalculatePeriodic(Unit * caster, bool create)
|
|||||||
Player* modOwner = caster ? caster->GetSpellModOwner() : NULL;
|
Player* modOwner = caster ? caster->GetSpellModOwner() : NULL;
|
||||||
|
|
||||||
// Apply casting time mods
|
// Apply casting time mods
|
||||||
if (modOwner && m_amplitude)
|
if (m_amplitude)
|
||||||
{
|
{
|
||||||
// Apply periodic time mod
|
// Apply periodic time mod
|
||||||
|
if (modOwner)
|
||||||
modOwner->ApplySpellMod(GetId(), SPELLMOD_ACTIVATION_TIME, m_amplitude);
|
modOwner->ApplySpellMod(GetId(), SPELLMOD_ACTIVATION_TIME, m_amplitude);
|
||||||
|
|
||||||
// For channeled spells
|
if (caster)
|
||||||
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))
|
|
||||||
{
|
{
|
||||||
const Unit::AuraEffectList &effList = modOwner->GetAuraEffectsByType(SPELL_AURA_PERIODIC_HASTE);
|
// Haste modifies periodic time of channeled spells
|
||||||
for (Unit::AuraEffectList::const_iterator itr = effList.begin(), end = effList.end(); itr != end; ++itr)
|
if (IsChanneledSpell(m_spellProto))
|
||||||
{
|
caster->ModSpellCastTime(m_spellProto, m_amplitude);
|
||||||
if ((*itr)->IsAffectedOnSpell(m_spellProto))
|
// and periodic time of auras affected by SPELL_AURA_PERIODIC_HASTE
|
||||||
{
|
if (caster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, m_spellProto))
|
||||||
float hasteMod = modOwner->GetFloatValue(UNIT_MOD_CAST_SPEED);
|
m_amplitude *= caster->GetFloatValue(UNIT_MOD_CAST_SPEED);
|
||||||
m_amplitude *= hasteMod;
|
|
||||||
GetBase()->SetMaxDuration(GetBase()->GetMaxDuration() * hasteMod);
|
|
||||||
GetBase()->SetDuration(GetBase()->GetDuration() * hasteMod);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2252,7 +2242,7 @@ void AuraEffect::TriggerSpell(Unit * target, Unit * caster) const
|
|||||||
case 53303:
|
case 53303:
|
||||||
case 53304:
|
case 53304:
|
||||||
// We are standing at the moment
|
// We are standing at the moment
|
||||||
if (GetAmount() > -1)
|
if (GetAmount() > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
triggerSpellId = 64418 + auraId - 53302;
|
triggerSpellId = 64418 + auraId - 53302;
|
||||||
@@ -2461,6 +2451,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit * target, bool apply) const
|
|||||||
break;
|
break;
|
||||||
case FORM_SHADOW:
|
case FORM_SHADOW:
|
||||||
spellId = 49868;
|
spellId = 49868;
|
||||||
|
spellId2 = 71167;
|
||||||
break;
|
break;
|
||||||
case FORM_GHOSTWOLF:
|
case FORM_GHOSTWOLF:
|
||||||
spellId = 67116;
|
spellId = 67116;
|
||||||
|
|||||||
@@ -1441,10 +1441,14 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool
|
|||||||
|
|
||||||
duration = m_originalCaster->ModSpellDuration(aurSpellInfo, unit, duration, positive);
|
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))
|
if (IsChanneledSpell(m_spellInfo))
|
||||||
m_originalCaster->ModSpellCastTime(aurSpellInfo, duration, this);
|
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())
|
if (duration != m_spellAura->GetMaxDuration())
|
||||||
{
|
{
|
||||||
m_spellAura->SetMaxDuration(duration);
|
m_spellAura->SetMaxDuration(duration);
|
||||||
|
|||||||
Reference in New Issue
Block a user