Core/Spells: ported spellMod handling from master branch

This commit is contained in:
Ovahlord committed 2025-03-09 13:20:40 +01:00
1 parent b390f0fec9
commit 83958342d9
16 files changed
+374 -177

No files matched your search

+11 -11
View File
@@ -1754,7 +1754,7 @@ void Spell::SelectImplicitChainTargets(SpellEffIndex effIndex, SpellImplicitTarg
{
uint32 maxTargets = m_spellInfo->Effects[effIndex].ChainTarget;
if (Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SpellModOp::ChainTargets, maxTargets, this);
modOwner->ApplySpellMod(m_spellInfo, SpellModOp::ChainTargets, maxTargets, this);
if (maxTargets > 1)
{
@@ -3225,7 +3225,7 @@ bool Spell::UpdateChanneledTargetList()
{
range = m_spellInfo->GetMaxRange(IsPositive());
if (Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SpellModOp::Range, range, this);
modOwner->ApplySpellMod(m_spellInfo, SpellModOp::Range, range, this);
// add little tolerance level
range += std::min(MAX_SPELL_RANGE_TOLERANCE, range*0.1f); // 10% but no more than MAX_SPELL_RANGE_TOLERANCE
@@ -5241,7 +5241,7 @@ void Spell::TakePower()
{
//lower spell cost on fail (by talent aura)
if (Player* modOwner = unitCaster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SpellModOp::PowerCostOnMiss, m_powerCost);
modOwner->ApplySpellMod(m_spellInfo, SpellModOp::PowerCostOnMiss, m_powerCost);
}
}
}
@@ -5307,7 +5307,7 @@ SpellCastResult Spell::CheckRuneCost(uint32 runeCostID) const
{
runeCost[i] = src->RuneCost[i];
if (Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SpellModOp::PowerCost0, runeCost[i], const_cast<Spell*>(this));
modOwner->ApplySpellMod(m_spellInfo, SpellModOp::PowerCost0, runeCost[i], const_cast<Spell*>(this));
}
runeCost[RUNE_DEATH] = MAX_RUNES; // calculated later
@@ -5349,7 +5349,7 @@ void Spell::TakeRunePower(SpellMissInfo hitInfo)
{
runeCost[i] = runeCostData->RuneCost[i];
if (Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SpellModOp::PowerCost0, runeCost[i], const_cast<Spell*>(this));
modOwner->ApplySpellMod(m_spellInfo, SpellModOp::PowerCost0, runeCost[i], const_cast<Spell*>(this));
}
bool consumeRunes = false;
@@ -5432,7 +5432,7 @@ void Spell::TakeRunePower(SpellMissInfo hitInfo)
// Apply runic power gain modifiers
if (Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SpellModOp::PowerCost0, runicPowerGain, const_cast<Spell*>(this));
modOwner->ApplySpellMod(m_spellInfo, SpellModOp::PowerCost0, runicPowerGain, const_cast<Spell*>(this));
player->ModifyPower(POWER_RUNIC_POWER, std::max(0, runicPowerGain));
}
@@ -5568,7 +5568,7 @@ void Spell::HandleHolyPower(Player* caster)
// The spell did hit the target, apply aura cost mods if there are any.
if (hit)
{
modOwner->ApplySpellMod(m_spellInfo->Id, SpellModOp::PowerCost0, m_powerCost, this);
modOwner->ApplySpellMod(m_spellInfo, SpellModOp::PowerCost0, m_powerCost, this);
caster->ModifyPower(POWER_HOLY_POWER, -m_powerCost);
}
}
@@ -7032,7 +7032,7 @@ std::pair<float, float> Spell::GetMinMaxRange(bool strict) const
maxRange *= ranged->GetTemplate()->GetRangedModRange() * 0.01f;
if (Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SpellModOp::Range, maxRange, const_cast<Spell*>(this));
modOwner->ApplySpellMod(m_spellInfo, SpellModOp::Range, maxRange, const_cast<Spell*>(this));
maxRange += rangeMod;
@@ -7599,7 +7599,7 @@ void Spell::Delayed() // only called in DealDamage()
int32 delayReduce = 100; // must be initialized to 100 for percent modifiers
if (Player* player = unitCaster->GetSpellModOwner())
player->ApplySpellMod(m_spellInfo->Id, SpellModOp::ResistPushback, delayReduce, this);
player->ApplySpellMod(m_spellInfo, SpellModOp::ResistPushback, delayReduce, this);
delayReduce += unitCaster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100;
if (delayReduce >= 100)
return;
@@ -7640,7 +7640,7 @@ void Spell::DelayedChannel()
int32 delaytime = CalculatePct(duration, 25); // channeling delay is normally 25% of its time per hit
int32 delayReduce = 100; // must be initialized to 100 for percent modifiers
if (Player* player = playerCaster->GetSpellModOwner())
player->ApplySpellMod(m_spellInfo->Id, SpellModOp::ResistPushback, delayReduce, this);
player->ApplySpellMod(m_spellInfo, SpellModOp::ResistPushback, delayReduce, this);
delayReduce += playerCaster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100;
if (delayReduce >= 100)
return;
@@ -8641,7 +8641,7 @@ void Spell::TriggerGlobalCooldown()
// gcd modifier auras are applied only to own spells and only players have such mods
if (Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SpellModOp::StartCooldown, gcd, this);
modOwner->ApplySpellMod(m_spellInfo, SpellModOp::StartCooldown, gcd, this);
// Apply haste rating
if (m_spellInfo->StartRecoveryCategory == 133 && m_spellInfo->StartRecoveryTime == 1500 &&