mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 10:26:28 +01:00
Core/Spells: implemented SPELL_AURA_MOD_SPELL_POWER_PCT
This commit is contained in:
@@ -2002,6 +2002,7 @@ class TC_GAME_API Player final : public Unit, public GridObject<Player>
|
||||
void UpdateRating(CombatRating cr);
|
||||
void UpdateAllRatings();
|
||||
void UpdateMastery();
|
||||
void UpdateModSpellPowerPct();
|
||||
void UpdateVersatilityDamageDone();
|
||||
void UpdateHealingDonePercentMod();
|
||||
bool CanUseMastery() const;
|
||||
|
||||
@@ -655,6 +655,12 @@ void Player::UpdateAllCritPercentages()
|
||||
UpdateCritPercentage(RANGED_ATTACK);
|
||||
}
|
||||
|
||||
void Player::UpdateModSpellPowerPct()
|
||||
{
|
||||
// Calculations done in Unit::SpellBaseHealingBonusDone and Unit::SpellBaseDamageBonusDone
|
||||
SetUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::ModSpellPowerPercent), GetTotalAuraMultiplier(SPELL_AURA_MOD_SPELL_POWER_PCT));
|
||||
}
|
||||
|
||||
void Player::UpdateMastery()
|
||||
{
|
||||
if (!CanUseMastery())
|
||||
|
||||
@@ -6745,7 +6745,7 @@ int32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, int3
|
||||
DoneTotalMod = SpellDamagePctDone(victim, spellProto, damagetype, spellEffectInfo);
|
||||
|
||||
// Done fixed damage bonus auras
|
||||
int32 DoneAdvertisedBenefit = SpellBaseDamageBonusDone(spellProto->GetSchoolMask());
|
||||
int32 DoneAdvertisedBenefit = SpellBaseDamageBonusDone(spellProto->GetSchoolMask(), true);
|
||||
// modify spell power by victim's SPELL_AURA_MOD_DAMAGE_TAKEN auras (eg Amplify/Dampen Magic)
|
||||
DoneAdvertisedBenefit += victim->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_DAMAGE_TAKEN, spellProto->GetSchoolMask());
|
||||
|
||||
@@ -6989,7 +6989,7 @@ int32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, int
|
||||
return int32(std::max(tmpDamage, 0.0f));
|
||||
}
|
||||
|
||||
int32 Unit::SpellBaseDamageBonusDone(SpellSchoolMask schoolMask) const
|
||||
int32 Unit::SpellBaseDamageBonusDone(SpellSchoolMask schoolMask, bool withModSpellPowerPct /*= false*/) const
|
||||
{
|
||||
if (Player const* thisPlayer = ToPlayer())
|
||||
{
|
||||
@@ -7021,6 +7021,9 @@ int32 Unit::SpellBaseDamageBonusDone(SpellSchoolMask schoolMask) const
|
||||
}
|
||||
}
|
||||
|
||||
// We are going to include SPELL_AURA_MOD_SPELL_POWER_PCT in here because it's only suposed to affect spell power, no other source of damage buffs
|
||||
if (withModSpellPowerPct)
|
||||
DoneAdvertisedBenefit *= ToPlayer()->m_activePlayerData->ModSpellPowerPercent;
|
||||
}
|
||||
|
||||
return DoneAdvertisedBenefit;
|
||||
@@ -7268,7 +7271,7 @@ int32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, int
|
||||
}
|
||||
|
||||
// Done fixed damage bonus auras
|
||||
int32 DoneAdvertisedBenefit = SpellBaseHealingBonusDone(spellProto->GetSchoolMask());
|
||||
int32 DoneAdvertisedBenefit = SpellBaseHealingBonusDone(spellProto->GetSchoolMask(), true);
|
||||
// modify spell power by victim's SPELL_AURA_MOD_HEALING auras (eg Amplify/Dampen Magic)
|
||||
DoneAdvertisedBenefit += victim->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_HEALING, spellProto->GetSchoolMask());
|
||||
|
||||
@@ -7467,7 +7470,7 @@ int32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, in
|
||||
return int32(std::max(heal, 0.0f));
|
||||
}
|
||||
|
||||
int32 Unit::SpellBaseHealingBonusDone(SpellSchoolMask schoolMask) const
|
||||
int32 Unit::SpellBaseHealingBonusDone(SpellSchoolMask schoolMask, bool withModSpellPowerPct /*= false*/) const
|
||||
{
|
||||
if (Player const* thisPlayer = ToPlayer())
|
||||
{
|
||||
@@ -7501,6 +7504,10 @@ int32 Unit::SpellBaseHealingBonusDone(SpellSchoolMask schoolMask) const
|
||||
Stats usedStat = Stats((*i)->GetSpellEffectInfo().MiscValue);
|
||||
advertisedBenefit += int32(CalculatePct(GetStat(usedStat), (*i)->GetAmount()));
|
||||
}
|
||||
|
||||
// We are going to include SPELL_AURA_MOD_SPELL_POWER_PCT in here because it's only suposed to affect spell power, no other source of healing buffs
|
||||
if (withModSpellPowerPct)
|
||||
advertisedBenefit *= ToPlayer()->m_activePlayerData->ModSpellPowerPercent;
|
||||
}
|
||||
return advertisedBenefit;
|
||||
}
|
||||
|
||||
@@ -1601,11 +1601,11 @@ class TC_GAME_API Unit : public WorldObject
|
||||
bool IsMagnet() const;
|
||||
Unit* GetMeleeHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo = nullptr);
|
||||
|
||||
int32 SpellBaseDamageBonusDone(SpellSchoolMask schoolMask) const;
|
||||
int32 SpellBaseDamageBonusDone(SpellSchoolMask schoolMask, bool withModSpellPowerPct = false) const;
|
||||
int32 SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, int32 pdamage, DamageEffectType damagetype, SpellEffectInfo const& spellEffectInfo, uint32 stack = 1, Spell* spell = nullptr, AuraEffect const* aurEff = nullptr) const;
|
||||
float SpellDamagePctDone(Unit* victim, SpellInfo const* spellProto, DamageEffectType damagetype, SpellEffectInfo const& spellEffectInfo) const;
|
||||
int32 SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, int32 pdamage, DamageEffectType damagetype) const;
|
||||
int32 SpellBaseHealingBonusDone(SpellSchoolMask schoolMask) const;
|
||||
int32 SpellBaseHealingBonusDone(SpellSchoolMask schoolMask, bool withModSpellPowerPct = false) const;
|
||||
int32 SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, int32 healamount, DamageEffectType damagetype, SpellEffectInfo const& spellEffectInfo, uint32 stack = 1, Spell* spell = nullptr, AuraEffect const* aurEff = nullptr) const;
|
||||
float SpellHealingPctDone(Unit* victim, SpellInfo const* spellProto) const;
|
||||
int32 SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, int32 healamount, DamageEffectType damagetype) const;
|
||||
|
||||
@@ -386,7 +386,7 @@ NonDefaultConstructible<pAuraEffectHandler> AuraEffectHandler[TOTAL_AURAS]=
|
||||
&AuraEffect::HandlePreventResurrection, //314 SPELL_AURA_PREVENT_RESURRECTION todo
|
||||
&AuraEffect::HandleNoImmediateEffect, //315 SPELL_AURA_UNDERWATER_WALKING todo
|
||||
&AuraEffect::HandleNoImmediateEffect, //316 SPELL_AURA_SCHOOL_ABSORB_OVERKILL implemented in Unit::DealDamage()
|
||||
&AuraEffect::HandleNULL, //317 SPELL_AURA_MOD_SPELL_POWER_PCT
|
||||
&AuraEffect::HandleModSpellPowerPct, //317 SPELL_AURA_MOD_SPELL_POWER_PCT
|
||||
&AuraEffect::HandleMastery, //318 SPELL_AURA_MASTERY
|
||||
&AuraEffect::HandleModMeleeSpeedPct, //319 SPELL_AURA_MOD_MELEE_HASTE_3
|
||||
&AuraEffect::HandleNULL, //320 SPELL_AURA_320
|
||||
@@ -5447,6 +5447,19 @@ void AuraEffect::HandlePreventResurrection(AuraApplication const* aurApp, uint8
|
||||
target->SetPlayerLocalFlag(PLAYER_LOCAL_FLAG_RELEASE_TIMER);
|
||||
}
|
||||
|
||||
void AuraEffect::HandleModSpellPowerPct(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
|
||||
{
|
||||
if (!(mode & (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_STAT)))
|
||||
return;
|
||||
|
||||
Player* target = aurApp->GetTarget()->ToPlayer();
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
// Sets the update field. It does not directly affect spellpower values and instead acts as hidden pct bonus when calculating spellpower on damage and healing calculations
|
||||
target->UpdateModSpellPowerPct();
|
||||
}
|
||||
|
||||
void AuraEffect::HandleMastery(AuraApplication const* aurApp, uint8 mode, bool /*apply*/) const
|
||||
{
|
||||
if (!(mode & AURA_EFFECT_HANDLE_REAL))
|
||||
|
||||
@@ -318,6 +318,7 @@ class TC_GAME_API AuraEffect
|
||||
void HandleAuraSetVehicle(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleSetVignette(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandlePreventResurrection(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModSpellPowerPct(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleMastery(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraForceWeather(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleEnableAltPower(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
|
||||
Reference in New Issue
Block a user