Scripts/Spells: fixed damage calculation for Blood-Caked Strike and dropped deprecated script for Icebound Fortitude

This commit is contained in:
Ovahlord committed 2025-06-11 19:44:36 +02:00
1 parent af7ab961c6
commit 49270a5cb9
3 files changed
+34 -53

No files matched your search

@@ -0,0 +1,3 @@
DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_dk_icebound_fortitude', 'spell_dk_blood_caked_strike');
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(50463, 'spell_dk_blood_caked_strike');
+18 -37
View File
@@ -616,42 +616,6 @@ class spell_dk_ghoul_explode : public SpellScript
}
};
// 48792 - Icebound Fortitude
class spell_dk_icebound_fortitude : public AuraScript
{
bool Load() override
{
Unit* caster = GetCaster();
return caster && caster->GetTypeId() == TYPEID_PLAYER;
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
if (Unit* caster = GetCaster())
{
int32 value = amount;
uint32 defValue = uint32(caster->ToPlayer()->GetSkillValue(SKILL_DEFENSE) + caster->ToPlayer()->GetRatingBonusValue(CR_DEFENSE_SKILL));
if (defValue > 400)
value -= int32((defValue - 400) * 0.15);
// Glyph of Icebound Fortitude
if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_DK_GLYPH_OF_ICEBOUND_FORTITUDE, EFFECT_0))
{
int32 valMax = -aurEff->GetAmount();
if (value > valMax)
value = valMax;
}
amount = value;
}
}
void Register() override
{
DoEffectCalcAmount.Register(&spell_dk_icebound_fortitude::CalculateAmount, EFFECT_2, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN);
}
};
// 73975 - Necrotic Strike
class spell_dk_necrotic_strike : public AuraScript
{
@@ -1933,6 +1897,23 @@ class spell_dk_heart_strike : public SpellScript
}
};
// 50463 - Blood-Caked Strike
class spell_dk_blood_caked_strike : public SpellScript
{
// Damage bonus per disease on the target
void CalculateDamage(Unit* victim, int32& /*damage*/, int32& /*flatMod*/, float& pctMod)
{
uint8 diseaseCount = victim->GetDiseasesByCaster(GetCaster()->GetGUID(), false);
float pctBonus = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster()) / 2.0f * diseaseCount;
AddPct(pctMod, pctBonus);
}
void Register() override
{
CalcDamage.Register(&spell_dk_blood_caked_strike::CalculateDamage);
}
};
}
void AddSC_deathknight_spell_scripts()
@@ -1942,6 +1923,7 @@ void AddSC_deathknight_spell_scripts()
RegisterSpellScript(spell_dk_anti_magic_zone);
RegisterSpellScript(spell_dk_army_of_the_dead);
RegisterSpellScript(spell_dk_blood_boil);
RegisterSpellScript(spell_dk_blood_caked_strike);
RegisterSpellScript(spell_dk_blood_gorged);
RegisterSpellScript(spell_dk_blood_strike);
RegisterSpellScript(spell_dk_blood_rites);
@@ -1972,7 +1954,6 @@ void AddSC_deathknight_spell_scripts()
RegisterSpellScript(spell_dk_ghoul_taunt);
RegisterSpellScript(spell_dk_heart_strike);
RegisterSpellScript(spell_dk_howling_blast);
RegisterSpellScript(spell_dk_icebound_fortitude);
RegisterSpellScript(spell_dk_icy_touch);
RegisterSpellScript(spell_dk_improved_presence);
RegisterSpellScript(spell_dk_killing_machine);
+13 -16
View File
@@ -1594,23 +1594,21 @@ class spell_dru_pulverize : public SpellScript
});
}
void CalculateDamage(Unit* victim, int32& damage, int32& flatMod, float& /*pctMod*/)
void CalculateDamage(Unit* victim, int32& damage, int32& /*flatMod*/, float& /*pctMod*/)
{
// Overriding the default damage calculation since the normalized weapon damage bonus scales
// with the amount of Lacerate stacks
Unit* caster = GetCaster();
int32 weaponDamagePct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster);
int32 weaponDamage = CalculatePct(caster->CalculateDamage(BASE_ATTACK, true, true), weaponDamagePct);
damage = weaponDamage;
int32 normalizedWeaponDamage = GetSpellInfo()->Effects[EFFECT_2].CalcValue(caster);
// Subtract the normalized weapon damage bonus because it's not supposed to be used in the regular way
damage -= normalizedWeaponDamage;
// Damage bonus per application of Lacerate
if (Aura* aura = victim->GetAura(SPELL_DRUID_LACERATE, caster->GetGUID()))
{
// Damage bonus per application of Lacerate:
// ${$m3*$m1/100}
int32 weaponPctDamage = GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster);
int32 lacerateBonus = CalculatePct(normalizedWeaponDamage, weaponPctDamage);
flatMod += lacerateBonus * aura->GetStackAmount();
int32 normalizedDamageBonus = GetSpellInfo()->Effects[EFFECT_2].CalcValue(caster);
damage += CalculatePct(normalizedDamageBonus, weaponDamagePct) * aura->GetStackAmount();
}
}
@@ -1903,15 +1901,14 @@ class spell_dru_nourish : public SpellScript
// 6807 - Maul (Bear Form)
class spell_dru_maul : public SpellScript
{
void HandleDamage(SpellEffIndex /*effIndex*/)
void CalculateDamage(Unit* /*victim*/, int32& damage, int32& /*flatMod*/, float& /*pctMod*/)
{
int32 damage = 35 + GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK) * 0.19f - 1;
SetEffectValue(damage);
damage = 35 + GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK) * 0.19f -1;
}
void Register() override
{
OnEffectLaunchTarget.Register(&spell_dru_maul::HandleDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
CalcDamage.Register(&spell_dru_maul::CalculateDamage);
}
};