aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOvahlord <dreadkiller@gmx.de>2024-07-31 12:40:30 +0200
committerOvahlord <dreadkiller@gmx.de>2024-07-31 12:40:30 +0200
commit72e9036481abdd302a1ebb6ef1609822cb7e1cf3 (patch)
tree09f01dc7e44b2fd7b9bfb82b737e628fdd65bea7 /src
parent895e86659f0a781afe709f1a7b02e8ed2728ea07 (diff)
Core/Auras: updated aura duration bonus from combo points for Cataclysm
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Object/Object.cpp27
-rw-r--r--src/server/game/Entities/Object/Object.h2
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp2
-rw-r--r--src/server/game/Spells/Auras/SpellAuras.cpp6
-rw-r--r--src/server/game/Spells/Auras/SpellAuras.h2
-rw-r--r--src/server/game/Spells/Spell.cpp4
-rw-r--r--src/server/game/Spells/SpellInfo.cpp5
-rw-r--r--src/server/game/Spells/SpellInfo.h1
8 files changed, 23 insertions, 26 deletions
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index 1271a34e923..893435e274d 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -2428,7 +2428,7 @@ double WorldObject::ApplyEffectModifiers(SpellInfo const* spellInfo, uint8 effIn
return value;
}
-int32 WorldObject::CalcSpellDuration(SpellInfo const* spellInfo, std::vector<SpellPowerCost> const* powerCosts) const
+int32 WorldObject::CalcSpellDuration(SpellInfo const* spellInfo) const
{
int32 minduration = spellInfo->GetDuration();
if (minduration <= 0)
@@ -2442,29 +2442,20 @@ int32 WorldObject::CalcSpellDuration(SpellInfo const* spellInfo, std::vector<Spe
if (!unit)
return minduration;
- if (!powerCosts)
+ int32 comboPoints = unit->GetPower(POWER_COMBO_POINTS);
+ if (!comboPoints || !spellInfo->IsFinishingMove())
return minduration;
- // we want only baseline cost here
- auto itr = std::find_if(spellInfo->PowerCosts.begin(), spellInfo->PowerCosts.end(), [=](SpellPowerEntry const* powerEntry)
- {
- return powerEntry && powerEntry->PowerType == POWER_COMBO_POINTS && (!powerEntry->RequiredAuraSpellID || unit->HasAura(powerEntry->RequiredAuraSpellID));
- });
-
- if (itr == spellInfo->PowerCosts.end())
- return minduration;
+ // Combo Points increase an aura's duration per consumed point
+ int32 baseComboCost = 0;
+ if (PowerTypeEntry const* powerTypeEntry = sDB2Manager.GetPowerTypeEntry(POWER_COMBO_POINTS))
+ baseComboCost += powerTypeEntry->MaxBasePower;
- auto consumedItr = std::find_if(powerCosts->begin(), powerCosts->end(),
- [](SpellPowerCost const& consumed) { return consumed.Power == POWER_COMBO_POINTS; });
- if (consumedItr == powerCosts->end())
+ if (!baseComboCost)
return minduration;
- int32 baseComboCost = (*itr)->ManaCost + (*itr)->OptionalCost;
- if (PowerTypeEntry const* powerTypeEntry = sDB2Manager.GetPowerTypeEntry(POWER_COMBO_POINTS))
- baseComboCost += int32(CalculatePct(powerTypeEntry->MaxBasePower, (*itr)->PowerCostPct));
-
float durationPerComboPoint = float(maxduration - minduration) / baseComboCost;
- return minduration + int32(durationPerComboPoint * consumedItr->Amount);
+ return minduration + int32(durationPerComboPoint * comboPoints);
}
int32 WorldObject::ModSpellDuration(SpellInfo const* spellInfo, WorldObject const* target, int32 duration, bool positive, uint32 effectMask) const
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index b102dccac7d..f60d04e63bd 100644
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -667,7 +667,7 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation
float GetSpellMinRangeForTarget(Unit const* target, SpellInfo const* spellInfo) const;
double ApplyEffectModifiers(SpellInfo const* spellInfo, uint8 effIndex, double value) const;
- int32 CalcSpellDuration(SpellInfo const* spellInfo, std::vector<SpellPowerCost> const* powerCosts) const;
+ int32 CalcSpellDuration(SpellInfo const* spellInfo) const;
int32 ModSpellDuration(SpellInfo const* spellInfo, WorldObject const* target, int32 duration, bool positive, uint32 effectMask) const;
void ModSpellCastTime(SpellInfo const* spellInfo, int32& castTime, Spell* spell = nullptr) const;
void ModSpellDurationTime(SpellInfo const* spellInfo, int32& durationTime, Spell* spell = nullptr) const;
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 22d9e258f64..34cd321391f 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -838,7 +838,7 @@ Optional<float> AuraEffect::CalculateEstimatedAmount(Unit const* caster, int32 a
float AuraEffect::CalculateEstimatedfTotalPeriodicAmount(Unit* caster, Unit* target, SpellInfo const* spellInfo, SpellEffectInfo const& spellEffectInfo,
float amount, uint8 stack)
{
- int32 maxDuration = Aura::CalcMaxDuration(spellInfo, caster, nullptr);
+ int32 maxDuration = Aura::CalcMaxDuration(spellInfo, caster);
if (maxDuration <= 0)
return 0.0f;
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index 99d62a98956..7d50f3f82b3 100644
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -870,10 +870,10 @@ void Aura::Update(uint32 diff, Unit* caster)
int32 Aura::CalcMaxDuration(Unit* caster) const
{
- return Aura::CalcMaxDuration(GetSpellInfo(), caster, nullptr);
+ return Aura::CalcMaxDuration(GetSpellInfo(), caster);
}
-/*static*/ int32 Aura::CalcMaxDuration(SpellInfo const* spellInfo, WorldObject const* caster, std::vector<SpellPowerCost> const* powerCosts)
+/*static*/ int32 Aura::CalcMaxDuration(SpellInfo const* spellInfo, WorldObject const* caster)
{
Player* modOwner = nullptr;
int32 maxDuration;
@@ -881,7 +881,7 @@ int32 Aura::CalcMaxDuration(Unit* caster) const
if (caster)
{
modOwner = caster->GetSpellModOwner();
- maxDuration = caster->CalcSpellDuration(spellInfo, powerCosts);
+ maxDuration = caster->CalcSpellDuration(spellInfo);
}
else
maxDuration = spellInfo->GetDuration();
diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h
index 2852c959a5b..40abaed8787 100644
--- a/src/server/game/Spells/Auras/SpellAuras.h
+++ b/src/server/game/Spells/Auras/SpellAuras.h
@@ -169,7 +169,7 @@ class TC_GAME_API Aura
void SetMaxDuration(int32 duration) { m_maxDuration = duration; }
int32 CalcMaxDuration() const { return CalcMaxDuration(GetCaster()); }
int32 CalcMaxDuration(Unit* caster) const;
- static int32 CalcMaxDuration(SpellInfo const* spellInfo, WorldObject const* caster, std::vector<SpellPowerCost> const* powerCosts);
+ static int32 CalcMaxDuration(SpellInfo const* spellInfo, WorldObject const* caster);
int32 GetDuration() const { return m_duration; }
void SetDuration(int32 duration, bool withMods = false);
void RefreshDuration(bool withMods = false);
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 5f2aa10b04e..5ce6154fb6a 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -608,7 +608,7 @@ m_spellValue(new SpellValue(m_spellInfo, caster)), _spellEvent(nullptr)
&& !m_spellInfo->HasAttribute(SPELL_ATTR1_NO_REFLECTION) && !m_spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES)
&& !m_spellInfo->IsPassive();
- m_consumeAllComboPoints = m_spellInfo->HasAttribute(SPELL_ATTR1_FINISHING_MOVE_DAMAGE) || m_spellInfo->HasAttribute(SPELL_ATTR1_FINISHING_MOVE_DURATION);
+ m_consumeAllComboPoints = m_spellInfo->IsFinishingMove();
CleanupTargetList();
@@ -3220,7 +3220,7 @@ SpellMissInfo Spell::PreprocessSpellHit(Unit* unit, TargetInfo& hitInfo)
}
}
- hitInfo.AuraDuration = Aura::CalcMaxDuration(m_spellInfo, origCaster, &m_powerCost);
+ hitInfo.AuraDuration = Aura::CalcMaxDuration(m_spellInfo, origCaster);
// unit is immune to aura if it was diminished to 0 duration
if (!hitInfo.Positive && !unit->ApplyDiminishingToDuration(m_spellInfo, hitInfo.AuraDuration, origCaster, diminishLevel))
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index 81dfe1b1fe8..e7df19f190f 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -1740,6 +1740,11 @@ bool SpellInfo::HasHitDelay() const
return Speed > 0.0f || LaunchDelay > 0.0f;
}
+bool SpellInfo::IsFinishingMove() const
+{
+ return HasAttribute(SpellAttr1(SPELL_ATTR1_FINISHING_MOVE_DAMAGE | SPELL_ATTR1_FINISHING_MOVE_DURATION));
+}
+
WeaponAttackType SpellInfo::GetAttackType() const
{
WeaponAttackType result;
diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h
index b3abf8ff359..af85b681ac3 100644
--- a/src/server/game/Spells/SpellInfo.h
+++ b/src/server/game/Spells/SpellInfo.h
@@ -506,6 +506,7 @@ class TC_GAME_API SpellInfo
bool IsAutoRepeatRangedSpell() const;
bool HasInitialAggro() const;
bool HasHitDelay() const;
+ bool IsFinishingMove() const;
WeaponAttackType GetAttackType() const;