*Handle SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL and SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK.
*Fix SPELL_AURA_MECHANIC_DURATION_MOD and SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK for PVP. --HG-- branch : trunk
This commit is contained in:
@@ -289,8 +289,8 @@ enum AuraType
|
|||||||
SPELL_AURA_MOD_SPELL_DAMAGE_FROM_HEALING = 242,
|
SPELL_AURA_MOD_SPELL_DAMAGE_FROM_HEALING = 242,
|
||||||
SPELL_AURA_243 = 243,
|
SPELL_AURA_243 = 243,
|
||||||
SPELL_AURA_COMPREHEND_LANGUAGE = 244,
|
SPELL_AURA_COMPREHEND_LANGUAGE = 244,
|
||||||
SPELL_AURA_MOD_DURATION_OF_MAGIC_EFFECTS = 245,
|
SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL = 245,
|
||||||
SPELL_AURA_MOD_DURATION_OF_EFFECTS_BY_DISPEL = 246,
|
SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK = 246,
|
||||||
SPELL_AURA_247 = 247,
|
SPELL_AURA_247 = 247,
|
||||||
SPELL_AURA_MOD_COMBAT_RESULT_CHANCE = 248,
|
SPELL_AURA_MOD_COMBAT_RESULT_CHANCE = 248,
|
||||||
SPELL_AURA_CONVERT_RUNE = 249,
|
SPELL_AURA_CONVERT_RUNE = 249,
|
||||||
|
|||||||
@@ -299,8 +299,8 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
|
|||||||
&Aura::HandleUnused, //242 SPELL_AURA_MOD_SPELL_DAMAGE_FROM_HEALING
|
&Aura::HandleUnused, //242 SPELL_AURA_MOD_SPELL_DAMAGE_FROM_HEALING
|
||||||
&Aura::HandleUnused, //243 used by two test spells
|
&Aura::HandleUnused, //243 used by two test spells
|
||||||
&Aura::HandleComprehendLanguage, //244 Comprehend language
|
&Aura::HandleComprehendLanguage, //244 Comprehend language
|
||||||
&Aura::HandleUnused, //245 SPELL_AURA_MOD_DURATION_OF_MAGIC_EFFECTS
|
&Aura::HandleNoImmediateEffect, //245 SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL
|
||||||
&Aura::HandleNoImmediateEffect, //246 SPELL_AURA_MOD_DURATION_OF_EFFECTS_BY_DISPEL
|
&Aura::HandleNoImmediateEffect, //246 SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK implemented in Spell::EffectApplyAura
|
||||||
&Aura::HandleUnused, //247 unused
|
&Aura::HandleUnused, //247 unused
|
||||||
&Aura::HandleNoImmediateEffect, //248 SPELL_AURA_MOD_COMBAT_RESULT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
|
&Aura::HandleNoImmediateEffect, //248 SPELL_AURA_MOD_COMBAT_RESULT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
|
||||||
&Aura::HandleAuraConvertRune, //249 SPELL_AURA_CONVERT_RUNE
|
&Aura::HandleAuraConvertRune, //249 SPELL_AURA_CONVERT_RUNE
|
||||||
@@ -377,14 +377,14 @@ m_updated(false), m_isRemovedOnShapeLost(true), m_in_use(false)
|
|||||||
{
|
{
|
||||||
m_caster_guid = target->GetGUID();
|
m_caster_guid = target->GetGUID();
|
||||||
//damage = m_currentBasePoints+1; // stored value-1
|
//damage = m_currentBasePoints+1; // stored value-1
|
||||||
m_maxduration = target->CalculateSpellDuration(m_spellProto, m_effIndex, target);
|
m_maxduration = target->CalcSpellDuration(m_spellProto);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_caster_guid = caster->GetGUID();
|
m_caster_guid = caster->GetGUID();
|
||||||
|
|
||||||
//damage = caster->CalculateSpellDamage(m_spellProto,m_effIndex,m_currentBasePoints,target);
|
//damage = caster->CalculateSpellDamage(m_spellProto,m_effIndex,m_currentBasePoints,target);
|
||||||
m_maxduration = caster->CalculateSpellDuration(m_spellProto, m_effIndex, target);
|
m_maxduration = caster->CalcSpellDuration(m_spellProto);
|
||||||
|
|
||||||
if (!damage && castItem && castItem->GetItemSuffixFactor())
|
if (!damage && castItem && castItem->GetItemSuffixFactor())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2244,6 +2244,9 @@ void Spell::EffectApplyAura(uint32 i)
|
|||||||
unitTarget->ApplyDiminishingToDuration(m_diminishGroup,duration,caster,m_diminishLevel);
|
unitTarget->ApplyDiminishingToDuration(m_diminishGroup,duration,caster,m_diminishLevel);
|
||||||
Aur->setDiminishGroup(m_diminishGroup);
|
Aur->setDiminishGroup(m_diminishGroup);
|
||||||
|
|
||||||
|
//apply mods only here, area auras don't have duration
|
||||||
|
duration = caster->ModSpellDuration(m_spellInfo, i, unitTarget, duration);
|
||||||
|
|
||||||
// if Aura removed and deleted, do not continue.
|
// if Aura removed and deleted, do not continue.
|
||||||
if(duration== 0 && !(Aur->IsPermanent()))
|
if(duration== 0 && !(Aur->IsPermanent()))
|
||||||
{
|
{
|
||||||
@@ -4693,7 +4696,7 @@ void Spell::EffectInterruptCast(uint32 i)
|
|||||||
{
|
{
|
||||||
if(m_originalCaster)
|
if(m_originalCaster)
|
||||||
{
|
{
|
||||||
int32 duration = m_originalCaster->CalculateSpellDuration(m_spellInfo, i, unitTarget);
|
int32 duration = m_originalCaster->ModSpellDuration(m_spellInfo, i, unitTarget, m_originalCaster->CalcSpellDuration(m_spellInfo));
|
||||||
unitTarget->ProhibitSpellScholl(GetSpellSchoolMask(unitTarget->m_currentSpells[i]->m_spellInfo), duration/*GetSpellDuration(m_spellInfo)*/);
|
unitTarget->ProhibitSpellScholl(GetSpellSchoolMask(unitTarget->m_currentSpells[i]->m_spellInfo), duration/*GetSpellDuration(m_spellInfo)*/);
|
||||||
}
|
}
|
||||||
unitTarget->InterruptSpell(i,false);
|
unitTarget->InterruptSpell(i,false);
|
||||||
|
|||||||
+29
-9
@@ -10015,7 +10015,7 @@ int32 Unit::CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_inde
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 Unit::CalculateSpellDuration(SpellEntry const* spellProto, uint8 effect_index, Unit const* target)
|
int32 Unit::CalcSpellDuration(SpellEntry const* spellProto)
|
||||||
{
|
{
|
||||||
Player* unitPlayer = (GetTypeId() == TYPEID_PLAYER) ? (Player*)this : NULL;
|
Player* unitPlayer = (GetTypeId() == TYPEID_PLAYER) ? (Player*)this : NULL;
|
||||||
|
|
||||||
@@ -10031,16 +10031,24 @@ int32 Unit::CalculateSpellDuration(SpellEntry const* spellProto, uint8 effect_in
|
|||||||
else
|
else
|
||||||
duration = minduration;
|
duration = minduration;
|
||||||
|
|
||||||
if (duration > 0)
|
return duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32 Unit::ModSpellDuration(SpellEntry const* spellProto, uint8 effect_index, Unit const* target, int32 duration)
|
||||||
|
{
|
||||||
|
//don't mod permament auras duration
|
||||||
|
if (duration<0)
|
||||||
|
return duration;
|
||||||
|
|
||||||
|
//cut duration only of negative effects
|
||||||
|
if (!IsPositiveEffect(spellProto->Id, effect_index) )
|
||||||
{
|
{
|
||||||
int32 mechanic = GetEffectMechanic(spellProto, effect_index);
|
int32 mechanic = GetEffectMechanic(spellProto, effect_index);
|
||||||
|
|
||||||
// Find total mod value (negative bonus)
|
// Find total mod value (negative bonus)
|
||||||
int32 durationMod_always = target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD, mechanic);
|
int32 durationMod_always = target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD, mechanic);
|
||||||
// Modify from SPELL_AURA_MOD_DURATION_OF_EFFECTS_BY_DISPEL aura (stack always ?)
|
|
||||||
durationMod_always+=target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_DURATION_OF_EFFECTS_BY_DISPEL, spellProto->Dispel);
|
|
||||||
// Find max mod (negative bonus)
|
// Find max mod (negative bonus)
|
||||||
int32 durationMod_not_stack = target->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK, mechanic);
|
int32 durationMod_not_stack = target->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK, mechanic);
|
||||||
|
|
||||||
int32 durationMod = 0;
|
int32 durationMod = 0;
|
||||||
// Select strongest negative mod
|
// Select strongest negative mod
|
||||||
if (durationMod_always > durationMod_not_stack)
|
if (durationMod_always > durationMod_not_stack)
|
||||||
@@ -10049,12 +10057,24 @@ int32 Unit::CalculateSpellDuration(SpellEntry const* spellProto, uint8 effect_in
|
|||||||
durationMod = durationMod_always;
|
durationMod = durationMod_always;
|
||||||
|
|
||||||
if (durationMod != 0)
|
if (durationMod != 0)
|
||||||
duration = int32(int64(duration) * (100+durationMod) /100);
|
duration *= float(100.0f+durationMod) /100.0f;
|
||||||
|
|
||||||
if (duration < 0) duration = 0;
|
// there are only negative mods currently
|
||||||
|
durationMod_always =target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL, spellProto->Dispel);
|
||||||
|
durationMod_not_stack=target->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK, spellProto->Dispel);
|
||||||
|
|
||||||
|
durationMod=0;
|
||||||
|
if (durationMod_always > durationMod_not_stack)
|
||||||
|
durationMod += durationMod_not_stack;
|
||||||
|
else
|
||||||
|
durationMod += durationMod_always;
|
||||||
|
|
||||||
|
if (durationMod != 0)
|
||||||
|
duration *= float(100.0f+durationMod) /100.0f;
|
||||||
}
|
}
|
||||||
|
//else positive mods here, there are no currently
|
||||||
return duration;
|
//when there will be, change GetTotalAuraModifierByMiscValue to GetTotalPositiveAuraModifierByMiscValue
|
||||||
|
return duration>0 ? duration : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DiminishingLevels Unit::GetDiminishing(DiminishingGroup group)
|
DiminishingLevels Unit::GetDiminishing(DiminishingGroup group)
|
||||||
|
|||||||
+2
-1
@@ -1451,7 +1451,8 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
|||||||
void _ApplyAllAuraMods();
|
void _ApplyAllAuraMods();
|
||||||
|
|
||||||
int32 CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_index, int32 basePoints, Unit const* target);
|
int32 CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_index, int32 basePoints, Unit const* target);
|
||||||
int32 CalculateSpellDuration(SpellEntry const* spellProto, uint8 effect_index, Unit const* target);
|
int32 CalcSpellDuration(SpellEntry const* spellProto);
|
||||||
|
int32 ModSpellDuration(SpellEntry const* spellProto, uint8 effect_index, Unit const* target, int32 duration);
|
||||||
float CalculateLevelPenalty(SpellEntry const* spellProto) const;
|
float CalculateLevelPenalty(SpellEntry const* spellProto) const;
|
||||||
|
|
||||||
void addFollower(FollowerReference* pRef) { m_FollowingRefManager.insertFirst(pRef); }
|
void addFollower(FollowerReference* pRef) { m_FollowingRefManager.insertFirst(pRef); }
|
||||||
|
|||||||
Reference in New Issue
Block a user