mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-20 06:59:46 -04:00
Merge pull request #3596 from ille/master
use effectMask to calculate mechanicMask in ModSpellDuration Closes #1599
This commit is contained in:
@@ -13042,16 +13042,16 @@ int32 Unit::CalcSpellDuration(SpellInfo const* spellProto)
|
||||
return duration;
|
||||
}
|
||||
|
||||
int32 Unit::ModSpellDuration(SpellInfo const* spellProto, Unit const* target, int32 duration, bool positive)
|
||||
int32 Unit::ModSpellDuration(SpellInfo const* spellProto, Unit const* target, int32 duration, bool positive, uint32 effectMask)
|
||||
{
|
||||
// don't mod permament auras duration
|
||||
// don't mod permanent auras duration
|
||||
if (duration < 0)
|
||||
return duration;
|
||||
|
||||
// cut duration only of negative effects
|
||||
if (!positive)
|
||||
{
|
||||
int32 mechanic = spellProto->GetAllEffectsMechanicMask();
|
||||
int32 mechanic = spellProto->GetSpellMechanicMaskByEffectMask(effectMask);
|
||||
|
||||
int32 durationMod;
|
||||
int32 durationMod_always = 0;
|
||||
|
||||
@@ -2068,7 +2068,7 @@ class Unit : public WorldObject
|
||||
float ApplyEffectModifiers(SpellInfo const* spellProto, uint8 effect_index, float value) const;
|
||||
int32 CalculateSpellDamage(Unit const* target, SpellInfo const* spellProto, uint8 effect_index, int32 const* basePoints = NULL) const;
|
||||
int32 CalcSpellDuration(SpellInfo const* spellProto);
|
||||
int32 ModSpellDuration(SpellInfo const* spellProto, Unit const* target, int32 duration, bool positive);
|
||||
int32 ModSpellDuration(SpellInfo const* spellProto, Unit const* target, int32 duration, bool positive, uint32 effectMask);
|
||||
void ModSpellCastTime(SpellInfo const* spellProto, int32 & castTime, Spell* spell=NULL);
|
||||
float CalculateLevelPenalty(SpellInfo const* spellProto) const;
|
||||
|
||||
|
||||
@@ -1537,7 +1537,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, const uint32 effectMask, bool
|
||||
if (AuraApplication* aurApp = m_spellAura->GetApplicationOfTarget(m_originalCaster->GetGUID()))
|
||||
positive = aurApp->IsPositive();
|
||||
|
||||
duration = m_originalCaster->ModSpellDuration(aurSpellInfo, unit, duration, positive);
|
||||
duration = m_originalCaster->ModSpellDuration(aurSpellInfo, unit, duration, positive, effectMask);
|
||||
|
||||
// Haste modifies duration of channeled spells
|
||||
if (m_spellInfo->IsChanneled())
|
||||
|
||||
@@ -4331,7 +4331,7 @@ void Spell::EffectInterruptCast(SpellEffIndex effIndex)
|
||||
{
|
||||
if (m_originalCaster)
|
||||
{
|
||||
int32 duration = m_originalCaster->ModSpellDuration(m_spellInfo, unitTarget, m_originalCaster->CalcSpellDuration(m_spellInfo), false);
|
||||
int32 duration = m_originalCaster->ModSpellDuration(m_spellInfo, unitTarget, m_originalCaster->CalcSpellDuration(m_spellInfo), false, 1 << effIndex);
|
||||
unitTarget->ProhibitSpellSchool(curSpellInfo->GetSchoolMask(), duration/*GetSpellDuration(m_spellInfo)*/);
|
||||
}
|
||||
ExecuteLogEffectInterruptCast(effIndex, unitTarget, curSpellInfo->Id);
|
||||
|
||||
@@ -1735,6 +1735,17 @@ uint32 SpellInfo::GetEffectMechanicMask(uint8 effIndex) const
|
||||
return mask;
|
||||
}
|
||||
|
||||
uint32 SpellInfo::GetSpellMechanicMaskByEffectMask(uint32 effectMask) const
|
||||
{
|
||||
uint32 mask = 0;
|
||||
if (Mechanic)
|
||||
mask |= 1<< Mechanic;
|
||||
for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
if ((effectMask & (1 << i)) && Effects[i].Mechanic)
|
||||
mask |= 1<< Effects[i].Mechanic;
|
||||
return mask;
|
||||
}
|
||||
|
||||
Mechanics SpellInfo::GetEffectMechanic(uint8 effIndex) const
|
||||
{
|
||||
if (Effects[effIndex].IsEffect() && Effects[effIndex].Mechanic)
|
||||
|
||||
@@ -444,6 +444,7 @@ public:
|
||||
SpellSchoolMask GetSchoolMask() const;
|
||||
uint32 GetAllEffectsMechanicMask() const;
|
||||
uint32 GetEffectMechanicMask(uint8 effIndex) const;
|
||||
uint32 GetSpellMechanicMaskByEffectMask(uint32 effectMask) const;
|
||||
Mechanics GetEffectMechanic(uint8 effIndex) const;
|
||||
uint32 GetDispelMask() const;
|
||||
static uint32 GetDispelMask(DispelType type);
|
||||
|
||||
Reference in New Issue
Block a user