*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;
|
||||
}
|
||||
|
||||
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());
|
||||
|
||||
@@ -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); }
|
||||
|
||||
Reference in New Issue
Block a user