Skip to content

Commit

Permalink
Paladin: Implement missing and migrate existing paladin glyph scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Jan 12, 2024
1 parent a8fc3ac commit c245757
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 38 deletions.
7 changes: 6 additions & 1 deletion sql/scriptdev2/spell.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,12 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(25899,'spell_blessing_of_sanctuary'),
(31850,'spell_ardent_defender'),
(31851,'spell_ardent_defender'),
(31852,'spell_ardent_defender');
(31852,'spell_ardent_defender'),
(1038,'spell_hand_of_salvation'),
(54925,'spell_glyph_of_seal_of_command'),
(68082,'spell_glyph_of_seal_of_command_mana'),
(54939,'spell_glyph_of_divinity'),
(54937,'spell_glyph_of_holy_light');

-- Warlock
INSERT INTO spell_scripts(Id, ScriptName) VALUES
Expand Down
74 changes: 73 additions & 1 deletion src/game/Spells/Scripts/Scripting/ClassScripts/Paladin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ struct RighteousDefense : public SpellScript
}
};

// 53385 - Divine Storm
struct DivineStorm : public SpellScript
{
void OnInit(Spell* spell) const override
Expand All @@ -189,6 +190,7 @@ struct DivineStorm : public SpellScript
}
};

// 54171 - Divine Storm
struct DivineStormHeal : public SpellScript
{
void OnInit(Spell* spell) const override
Expand All @@ -204,6 +206,7 @@ struct DivineStormHeal : public SpellScript
}
};

// 70769 - Divine Storm!
struct DivineStormCooldown : public SpellScript
{
void OnEffectExecute(Spell* spell, SpellEffectIndex /*effIdx*/) const override
Expand All @@ -213,6 +216,7 @@ struct DivineStormCooldown : public SpellScript
}
};

// 31876, 31877, 31878
struct JudgementsOfTheWise : public AuraScript
{
bool OnCheckProc(Aura* /*aura*/, ProcExecutionData& data) const override
Expand All @@ -234,6 +238,7 @@ struct JudgementsOfTheWise : public AuraScript
}
};

// 31930 - Judgements of the Wise
struct JudgementsOfTheWiseEnergize : public SpellScript
{
void OnEffectExecute(Spell* spell, SpellEffectIndex /*effIdx*/) const override
Expand All @@ -242,6 +247,7 @@ struct JudgementsOfTheWiseEnergize : public SpellScript
}
};

// 31850, 31851, 31852 - Ardent Defender
struct ArdentDefender : public AuraScript
{
void OnAbsorb(Aura* aura, int32& currentAbsorb, int32& remainingDamage, uint32& /*reflectedSpellId*/, int32& /*reflectDamage*/, bool& preventedDeath, bool& /*dropCharge*/, DamageEffectType /*damageType*/) const override
Expand Down Expand Up @@ -317,6 +323,67 @@ struct BlessingOfSanctuary : public AuraScript
}
};

// 1038 - Hand of Salvation
struct HandOfSalvation : public AuraScript
{
int32 OnAuraValueCalculate(AuraCalcData& data, int32 value) const override
{
if (data.caster && data.effIdx == EFFECT_INDEX_1)
if (data.caster->GetObjectGuid() == data.target->GetObjectGuid())
if (Aura* aur = data.target->GetAura(63225, EFFECT_INDEX_0))
return value - aur->GetModifier()->m_amount;
return value;
}
};

// 54925 - Glyph of Seal of Command
struct GlyphOfSealOfCommand : public AuraScript
{
bool OnCheckProc(Aura* aura, ProcExecutionData& /*data*/) const override
{
return aura->GetTarget()->HasAura(20375); // must have seal of command active
}
};

// 68082 - Glyph of Seal of Command
struct GlyphOfSealOfCommandMana : public SpellScript
{
void OnEffectExecute(Spell* spell, SpellEffectIndex /*effIdx*/) const override
{
if (!spell->GetUnitTarget())
return;
spell->SetDamage(spell->GetDamage() * spell->GetUnitTarget()->GetCreateMana() / 100);
}
};

// 54939 - Glyph of Divinity
struct GlyphOfDivinity : public AuraScript
{
SpellAuraProcResult OnProc(Aura* /*aura*/, ProcExecutionData& procData) const override
{
if (procData.spell)
{
procData.basepoints[EFFECT_INDEX_1] = procData.spell->GetDamageForEffect(EFFECT_INDEX_1);
procData.triggeredSpellId = 54986;
procData.triggerTarget = nullptr;
}

return SPELL_AURA_PROC_OK;
}
};

// 54937 - Glyph of Holy Light
struct GlyphOfHolyLight : public AuraScript
{
SpellAuraProcResult OnProc(Aura* aura, ProcExecutionData& procData) const override
{
procData.triggeredSpellId = 54968;
procData.basepoints[0] = aura->GetAmount() * procData.damage / 100;

return SPELL_AURA_PROC_OK;
}
};

void LoadPaladinScripts()
{
RegisterSpellScript<IncreasedHolyLightHealing>("spell_increased_holy_light_healing");
Expand All @@ -329,7 +396,12 @@ void LoadPaladinScripts()
RegisterSpellScript<JudgementsOfTheWise>("spell_judgements_of_the_wise");
RegisterSpellScript<JudgementsOfTheWiseEnergize>("spell_judgements_of_the_wise_energize");
RegisterSpellScript<ArdentDefender>("spell_ardent_defender");
RegisterSpellScript<ArdentDefender>("spell_sacred_shield_crit");
RegisterSpellScript<SacredShieldCrit>("spell_sacred_shield_crit");
RegisterSpellScript<ExorcismPaladin>("spell_exorcism_paladin");
RegisterSpellScript<BlessingOfSanctuary>("spell_blessing_of_sanctuary");
RegisterSpellScript<HandOfSalvation>("spell_hand_of_salvation");
RegisterSpellScript<GlyphOfSealOfCommand>("spell_glyph_of_seal_of_command");
RegisterSpellScript<GlyphOfSealOfCommandMana>("spell_glyph_of_seal_of_command_mana");
RegisterSpellScript<GlyphOfDivinity>("spell_glyph_of_divinity");
RegisterSpellScript<GlyphOfHolyLight>("spell_glyph_of_holy_light");
}
9 changes: 0 additions & 9 deletions src/game/Spells/SpellAuras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6165,15 +6165,6 @@ void Aura::HandleDamagePercentTaken(bool apply, bool Real)
{
if (loading)
return;

// Hand of Salvation (only it have this aura and mask)
if (GetSpellProto()->IsFitToFamily(SPELLFAMILY_PALADIN, uint64(0x0000000000000100)))
{
// Glyph of Salvation
if (target->GetObjectGuid() == GetCasterGuid())
if (Aura* aur = target->GetAura(63225, EFFECT_INDEX_0))
m_modifier.m_amount -= aur->GetModifier()->m_amount;
}
}
else
if (GetSpellProto()->Id == 43421) // Malacrass - Lifebloom
Expand Down
1 change: 0 additions & 1 deletion src/game/Spells/SpellEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5551,7 +5551,6 @@ void Spell::EffectEnergize(SpellEffectIndex eff_idx)
break;
case 48542: // Revitalize (mana restore case)
case 63375: // Improved Stormstrike
case 68082: // Glyph of Seal of Command
damage = damage * unitTarget->GetCreateMana() / 100;
break;
case 67487: // Mana Potion Injector
Expand Down
26 changes: 0 additions & 26 deletions src/game/Spells/UnitAuraProcHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2375,13 +2375,6 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(ProcExecutionData& data)
CastSpell(target, 53739, TRIGGERED_OLD_TRIGGERED, nullptr, triggeredByAura);
break;
}
// Glyph of Holy Light
case 54937:
{
triggered_spell_id = 54968;
basepoints[0] = triggerAmount * damage / 100;
break;
}
// Sacred Shield (buff)
case 58597:
{
Expand Down Expand Up @@ -4288,25 +4281,6 @@ SpellAuraProcResult Unit::HandleAddPctModifierAuraProc(ProcExecutionData& data)
}
break;
}
case SPELLFAMILY_PALADIN:
{
// Glyph of Divinity
if (spellProto->Id == 54939)
{
// Lookup base amount mana restore
for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
{
if (spellProto->Effect[i] == SPELL_EFFECT_ENERGIZE)
{
int32 mana = spellProto->CalculateSimpleValue(SpellEffectIndex(i));
CastCustomSpell(this, 54986, nullptr, &mana, nullptr, TRIGGERED_OLD_TRIGGERED, castItem, triggeredByAura);
break;
}
}
return SPELL_AURA_PROC_OK;
}
break;
}
}
return SPELL_AURA_PROC_OK;
}
Expand Down

0 comments on commit c245757

Please sign in to comment.