Core/Spells: Fix periodic rolling adding bonuses twice
Calculation is now done in CalculateAmount (cherry picked from commit 93eda20d5cf6eeb34e1aee1b81469ba6e8fa7f0c)
This commit is contained in:
@@ -12219,21 +12219,6 @@ void Unit::OutDebugInfo() const
|
||||
TC_LOG_DEBUG("entities.unit", "On vehicle %u.", GetVehicleBase()->GetEntry());
|
||||
}
|
||||
|
||||
uint32 Unit::GetRemainingPeriodicAmount(ObjectGuid caster, uint32 spellId, AuraType auraType, uint8 effectIndex) const
|
||||
{
|
||||
uint32 amount = 0;
|
||||
AuraEffectList const& periodicAuras = GetAuraEffectsByType(auraType);
|
||||
for (AuraEffect const* aurEff : periodicAuras)
|
||||
{
|
||||
if (aurEff->GetCasterGUID() != caster || aurEff->GetId() != spellId || aurEff->GetEffIndex() != effectIndex || !aurEff->GetTotalTicks())
|
||||
continue;
|
||||
amount += uint32((aurEff->GetAmount() * static_cast<int32>(aurEff->GetRemainingTicks())) / aurEff->GetTotalTicks());
|
||||
break;
|
||||
}
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
void Unit::SendClearTarget()
|
||||
{
|
||||
WorldPackets::Combat::BreakTarget breakTarget;
|
||||
|
||||
@@ -1664,8 +1664,6 @@ class TC_GAME_API Unit : public WorldObject
|
||||
static uint32 SpellCriticalDamageBonus(Unit const* caster, SpellInfo const* spellProto, uint32 damage, Unit* victim);
|
||||
static uint32 SpellCriticalHealingBonus(Unit const* caster, SpellInfo const* spellProto, uint32 damage, Unit* victim);
|
||||
|
||||
uint32 GetRemainingPeriodicAmount(ObjectGuid caster, uint32 spellId, AuraType auraType, uint8 effectIndex = 0) const;
|
||||
|
||||
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply);
|
||||
virtual bool IsImmunedToSpell(SpellInfo const* spellInfo, WorldObject const* caster) const;
|
||||
uint32 GetSchoolImmunityMask() const;
|
||||
|
||||
@@ -747,7 +747,7 @@ enum SpellAttr10
|
||||
SPELL_ATTR10_HERB_GATHERING_MINING = 0x00000800, // 11 Only Herb Gathering and Mining
|
||||
SPELL_ATTR10_USE_SPELL_BASE_LEVEL_FOR_SCALING= 0x00001000, // 12
|
||||
SPELL_ATTR10_RESET_COOLDOWN_ON_ENCOUNTER_END = 0x00002000, // 13
|
||||
SPELL_ATTR10_UNK14 = 0x00004000, // 14
|
||||
SPELL_ATTR10_ROLLING_PERIODIC = 0x00004000, // 14 Add remaining periodic damage to new aura when refreshed
|
||||
SPELL_ATTR10_UNK15 = 0x00008000, // 15
|
||||
SPELL_ATTR10_UNK16 = 0x00010000, // 16
|
||||
SPELL_ATTR10_CAN_DODGE_PARRY_WHILE_CASTING = 0x00020000, // 17
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
#include <G3D/g3dmath.h>
|
||||
#include <numeric>
|
||||
|
||||
class Aura;
|
||||
//
|
||||
@@ -667,6 +668,17 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
|
||||
break;
|
||||
}
|
||||
|
||||
if (GetSpellInfo()->HasAttribute(SPELL_ATTR10_ROLLING_PERIODIC))
|
||||
{
|
||||
Unit::AuraEffectList const& periodicAuras = GetBase()->GetUnitOwner()->GetAuraEffectsByType(GetAuraType());
|
||||
amount = std::accumulate(std::begin(periodicAuras), std::end(periodicAuras), amount, [this](int32 val, AuraEffect const* aurEff)
|
||||
{
|
||||
if (aurEff->GetCasterGUID() == GetCasterGUID() && aurEff->GetId() == GetId() && aurEff->GetEffIndex() == GetEffIndex() && aurEff->GetTotalTicks() > 0)
|
||||
val += aurEff->GetAmount() * static_cast<int32>(aurEff->GetRemainingTicks()) / static_cast<int32>(aurEff->GetTotalTicks());
|
||||
return val;
|
||||
});
|
||||
}
|
||||
|
||||
GetBase()->CallScriptEffectCalcAmountHandlers(this, amount, m_canBeRecalculated);
|
||||
if (!GetSpellEffectInfo().EffectAttributes.HasFlag(SpellEffectAttributes::NoScaleWithStack))
|
||||
amount *= GetBase()->GetStackAmount();
|
||||
|
||||
@@ -196,6 +196,7 @@ enum SpellCustomAttributes
|
||||
SPELL_ATTR0_CU_DIRECT_DAMAGE = 0x00000100,
|
||||
SPELL_ATTR0_CU_CHARGE = 0x00000200,
|
||||
SPELL_ATTR0_CU_PICKPOCKET = 0x00000400,
|
||||
SPELL_ATTR0_CU_DEPRECATED_ROLLING_PERIODIC = 0x00000800, // DO NOT REUSE
|
||||
SPELL_ATTR0_CU_DEPRECATED_NEGATIVE_EFF0 = 0x00001000, // DO NOT REUSE
|
||||
SPELL_ATTR0_CU_DEPRECATED_NEGATIVE_EFF1 = 0x00002000, // DO NOT REUSE
|
||||
SPELL_ATTR0_CU_DEPRECATED_NEGATIVE_EFF2 = 0x00004000, // DO NOT REUSE
|
||||
|
||||
@@ -638,10 +638,9 @@ bool SpellMgr::IsArenaAllowedEnchancment(uint32 ench_id) const
|
||||
return mEnchantCustomAttr[ench_id];
|
||||
}
|
||||
|
||||
const std::vector<int32>* SpellMgr::GetSpellLinked(int32 spell_id) const
|
||||
std::vector<int32> const* SpellMgr::GetSpellLinked(int32 spell_id) const
|
||||
{
|
||||
SpellLinkedMap::const_iterator itr = mSpellLinkedMap.find(spell_id);
|
||||
return itr != mSpellLinkedMap.end() ? &(itr->second) : nullptr;
|
||||
return Trinity::Containers::MapGetValuePtr(mSpellLinkedMap, spell_id);
|
||||
}
|
||||
|
||||
PetLevelupSpellSet const* SpellMgr::GetPetLevelupSpellList(uint32 petFamily) const
|
||||
|
||||
@@ -579,10 +579,9 @@ struct PetDefaultSpellsEntry
|
||||
// < 0 for petspelldata id, > 0 for creature_id
|
||||
typedef std::map<int32, PetDefaultSpellsEntry> PetDefaultSpellsMap;
|
||||
|
||||
typedef std::vector<uint32> SpellCustomAttribute;
|
||||
typedef std::vector<bool> EnchantCustomAttribute;
|
||||
|
||||
typedef std::map<int32, std::vector<int32> > SpellLinkedMap;
|
||||
typedef std::unordered_map<int32, std::vector<int32>> SpellLinkedMap;
|
||||
|
||||
bool IsPrimaryProfessionSkill(uint32 skill);
|
||||
|
||||
@@ -692,7 +691,7 @@ class TC_GAME_API SpellMgr
|
||||
SpellEnchantProcEntry const* GetSpellEnchantProcEvent(uint32 enchId) const;
|
||||
bool IsArenaAllowedEnchancment(uint32 ench_id) const;
|
||||
|
||||
const std::vector<int32> *GetSpellLinked(int32 spell_id) const;
|
||||
std::vector<int32> const* GetSpellLinked(int32 spell_id) const;
|
||||
|
||||
PetLevelupSpellSet const* GetPetLevelupSpellList(uint32 petFamily) const;
|
||||
PetDefaultSpellsEntry const* GetPetDefaultSpellsEntry(int32 id) const;
|
||||
|
||||
@@ -1563,8 +1563,6 @@ public:
|
||||
|
||||
ASSERT(spellInfo->GetMaxTicks() > 0);
|
||||
amount /= spellInfo->GetMaxTicks();
|
||||
// Add remaining ticks to damage done
|
||||
amount += target->GetRemainingPeriodicAmount(caster->GetGUID(), SPELL_DRUID_LANGUISH, SPELL_AURA_PERIODIC_DAMAGE);
|
||||
|
||||
CastSpellExtraArgs args(aurEff);
|
||||
args.AddSpellMod(SPELLVALUE_BASE_POINT0, amount);
|
||||
|
||||
@@ -657,7 +657,6 @@ class spell_mage_ignite : public AuraScript
|
||||
|
||||
ASSERT(igniteDot->GetMaxTicks() > 0);
|
||||
int32 amount = int32(CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), pct) / igniteDot->GetMaxTicks());
|
||||
amount += eventInfo.GetProcTarget()->GetRemainingPeriodicAmount(eventInfo.GetActor()->GetGUID(), SPELL_MAGE_IGNITE, SPELL_AURA_PERIODIC_DAMAGE);
|
||||
|
||||
CastSpellExtraArgs args(aurEff);
|
||||
args.AddSpellMod(SPELLVALUE_BASE_POINT0, amount);
|
||||
|
||||
@@ -1035,8 +1035,6 @@ class spell_pal_t8_2p_bonus : public SpellScriptLoader
|
||||
|
||||
ASSERT(spellInfo->GetMaxTicks() > 0);
|
||||
amount /= spellInfo->GetMaxTicks();
|
||||
// Add remaining ticks to damage done
|
||||
amount += target->GetRemainingPeriodicAmount(caster->GetGUID(), SPELL_PALADIN_HOLY_MENDING, SPELL_AURA_PERIODIC_HEAL);
|
||||
|
||||
CastSpellExtraArgs args(aurEff);
|
||||
args.AddSpellBP0(amount);
|
||||
|
||||
@@ -1078,10 +1078,8 @@ class spell_pri_t10_heal_2p_bonus : public SpellScriptLoader
|
||||
ASSERT(spellInfo->GetMaxTicks() > 0);
|
||||
amount /= spellInfo->GetMaxTicks();
|
||||
|
||||
// Add remaining ticks to healing done
|
||||
Unit* caster = eventInfo.GetActor();
|
||||
Unit* target = eventInfo.GetProcTarget();
|
||||
amount += target->GetRemainingPeriodicAmount(caster->GetGUID(), SPELL_PRIEST_BLESSED_HEALING, SPELL_AURA_PERIODIC_HEAL);
|
||||
|
||||
CastSpellExtraArgs args(aurEff);
|
||||
args.AddSpellBP0(amount);
|
||||
|
||||
@@ -1238,10 +1238,8 @@ class spell_sha_t8_elemental_4p_bonus : public SpellScriptLoader
|
||||
ASSERT(spellInfo->GetMaxTicks() > 0);
|
||||
amount /= spellInfo->GetMaxTicks();
|
||||
|
||||
// Add remaining ticks to damage done
|
||||
Unit* caster = eventInfo.GetActor();
|
||||
Unit* target = eventInfo.GetProcTarget();
|
||||
amount += target->GetRemainingPeriodicAmount(caster->GetGUID(), SPELL_SHAMAN_ELECTRIFIED, SPELL_AURA_PERIODIC_DAMAGE);
|
||||
|
||||
CastSpellExtraArgs args(aurEff);
|
||||
args.AddSpellBP0(amount);
|
||||
@@ -1289,10 +1287,8 @@ class spell_sha_t9_elemental_4p_bonus : public SpellScriptLoader
|
||||
ASSERT(spellInfo->GetMaxTicks() > 0);
|
||||
amount /= spellInfo->GetMaxTicks();
|
||||
|
||||
// Add remaining ticks to damage done
|
||||
Unit* caster = eventInfo.GetActor();
|
||||
Unit* target = eventInfo.GetProcTarget();
|
||||
amount += target->GetRemainingPeriodicAmount(caster->GetGUID(), SPELL_SHAMAN_LAVA_BURST_BONUS_DAMAGE, SPELL_AURA_PERIODIC_DAMAGE);
|
||||
|
||||
CastSpellExtraArgs args(aurEff);
|
||||
args.AddSpellBP0(amount);
|
||||
@@ -1385,10 +1381,8 @@ class spell_sha_t10_restoration_4p_bonus : public SpellScriptLoader
|
||||
ASSERT(spellInfo->GetMaxTicks() > 0);
|
||||
amount /= spellInfo->GetMaxTicks();
|
||||
|
||||
// Add remaining ticks to healing done
|
||||
Unit* caster = eventInfo.GetActor();
|
||||
Unit* target = eventInfo.GetProcTarget();
|
||||
amount += target->GetRemainingPeriodicAmount(caster->GetGUID(), SPELL_SHAMAN_CHAINED_HEAL, SPELL_AURA_PERIODIC_HEAL);
|
||||
|
||||
CastSpellExtraArgs args(aurEff);
|
||||
args.AddSpellBP0(amount);
|
||||
|
||||
@@ -733,10 +733,8 @@ public:
|
||||
void HandleProc(AuraEffect* aurEff, ProcEventInfo& eventInfo)
|
||||
{
|
||||
Unit* target = eventInfo.GetActionTarget();
|
||||
//Get the Remaining Damage from the aura (if exist)
|
||||
int32 remainingDamage = target->GetRemainingPeriodicAmount(target->GetGUID(), SPELL_WARRIOR_TRAUMA_EFFECT, SPELL_AURA_PERIODIC_DAMAGE);
|
||||
//Get 25% of damage from the spell casted (Slam & Whirlwind) plus Remaining Damage from Aura
|
||||
int32 damage = int32(CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), aurEff->GetAmount()) / sSpellMgr->AssertSpellInfo(SPELL_WARRIOR_TRAUMA_EFFECT, GetCastDifficulty())->GetMaxTicks()) + remainingDamage;
|
||||
int32 damage = int32(CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), aurEff->GetAmount()) / sSpellMgr->AssertSpellInfo(SPELL_WARRIOR_TRAUMA_EFFECT, GetCastDifficulty())->GetMaxTicks());
|
||||
CastSpellExtraArgs args(TRIGGERED_FULL_MASK);
|
||||
args.AddSpellMod(SPELLVALUE_BASE_POINT0, damage);
|
||||
GetCaster()->CastSpell(target, SPELL_WARRIOR_TRAUMA_EFFECT, args);
|
||||
|
||||
Reference in New Issue
Block a user