aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatan Shukry <matanshukry@gmail.com>2021-02-21 19:11:34 +0200
committerGitHub <noreply@github.com>2021-02-21 18:11:34 +0100
commitb4b13e7b38619b062d209c3547532384623a56c1 (patch)
tree6766087f7f3b0d29d84d184100c2bb7989bc0795 /src
parentdd31b3629117baa42fc9bbe639fba9287b6d1574 (diff)
Core/Auras: Implemented new spell modifier type to change max aura stack size (#26109)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Spells/Auras/SpellAuras.cpp19
-rw-r--r--src/server/game/Spells/Auras/SpellAuras.h3
2 files changed, 20 insertions, 2 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index 2e09b28aa6f..f90a5431856 100644
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -191,7 +191,7 @@ void AuraApplication::BuildUpdatePacket(WorldPackets::Spells::AuraInfo& auraInfo
// send stack amount for aura which could be stacked (never 0 - causes incorrect display) or charges
// stack amount has priority over charges (checked on retail with spell 50262)
- auraData.Applications = aura->GetSpellInfo()->StackAmount ? aura->GetStackAmount() : aura->GetCharges();
+ auraData.Applications = aura->IsUsingStacks() ? aura->GetStackAmount() : aura->GetCharges();
if (!(auraData.Flags & AFLAG_NOCASTER))
auraData.CastUnit = aura->GetCasterGUID();
@@ -924,12 +924,27 @@ void Aura::SetStackAmount(uint8 stackAmount)
SetNeedClientUpdateForTargets();
}
+bool Aura::IsUsingStacks() const
+{
+ return m_spellInfo->StackAmount > 0;
+}
+
+uint32 Aura::CalcMaxStackAmount() const
+{
+ int32 maxStackAmount = m_spellInfo->StackAmount;
+ if (Unit* caster = GetCaster())
+ if (Player* modOwner = caster->GetSpellModOwner())
+ modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_STACK_AMOUNT2, maxStackAmount);
+ return maxStackAmount;
+}
+
bool Aura::ModStackAmount(int32 num, AuraRemoveMode removeMode /*= AURA_REMOVE_BY_DEFAULT*/, bool resetPeriodicTimer /*= true*/)
{
int32 stackAmount = m_stackAmount + num;
+ int32 maxStackAmount = int32(CalcMaxStackAmount());
// limit the stack amount (only on stack increase, stack amount may be changed manually)
- if ((num > 0) && (stackAmount > int32(m_spellInfo->StackAmount)))
+ if ((num > 0) && (stackAmount > maxStackAmount))
{
// not stackable aura - set stack amount to 1
if (!m_spellInfo->StackAmount)
diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h
index 9292db994d6..410d825000d 100644
--- a/src/server/game/Spells/Auras/SpellAuras.h
+++ b/src/server/game/Spells/Auras/SpellAuras.h
@@ -183,6 +183,9 @@ class TC_GAME_API Aura
void SetStackAmount(uint8 num);
bool ModStackAmount(int32 num, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT, bool resetPeriodicTimer = true);
+ uint32 CalcMaxStackAmount() const;
+ bool IsUsingStacks() const;
+
uint8 GetCasterLevel() const { return m_casterLevel; }
bool HasMoreThanOneEffectForType(AuraType auraType) const;