Skip to content

Commit

Permalink
Priest: Implement missing glyphs and move existing to spell scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Jan 12, 2024
1 parent 799553c commit 3b1dfe0
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 60 deletions.
2 changes: 2 additions & 0 deletions sql/base/dbc/cmangos_fixes/Spell.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3517,6 +3517,8 @@ UPDATE spell_template SET EffectSpellClassMask1_1=0x00000000,EffectSpellClassMas
UPDATE spell_template SET EffectSpellClassMask1_1=8388608 WHERE Id IN(57870);
-- Glyph of Remove Curse - wrong mask
UPDATE spell_template SET EffectSpellClassMask1_2=0x01000000 WHERE Id IN(56364);
-- Glyph of Shadow - condition done with code instead - faulty mask
UPDATE spell_template SET EffectSpellClassMask1_2=0 WHERE Id IN(55689);

-- fully custom, modelled after 65220 - glyph of snake trap avoidance
INSERT INTO spell_template(Id, Category, Dispel, Mechanic, Attributes, AttributesEx, AttributesEx2, AttributesEx3, AttributesEx4, AttributesEx5, AttributesEx6, AttributesEx7, Stances, Stances2, StancesNot, StancesNot2, Targets, TargetCreatureType, RequiresSpellFocus, FacingCasterFlags, CasterAuraState, TargetAuraState, CasterAuraStateNot, TargetAuraStateNot, CasterAuraSpell, TargetAuraSpell, ExcludeCasterAuraSpell, ExcludeTargetAuraSpell, CastingTimeIndex, RecoveryTime, CategoryRecoveryTime, InterruptFlags, AuraInterruptFlags, ChannelInterruptFlags, ProcFlags, ProcChance, ProcCharges, MaxLevel, BaseLevel, SpellLevel, DurationIndex, PowerType, ManaCost, ManaCostPerlevel, ManaPerSecond, ManaPerSecondPerLevel, RangeIndex, Speed, ModalNextSpell, StackAmount, Totem1, Totem2, Reagent1, Reagent2, Reagent3, Reagent4, Reagent5, Reagent6, Reagent7, Reagent8, ReagentCount1, ReagentCount2, ReagentCount3, ReagentCount4, ReagentCount5, ReagentCount6, ReagentCount7, ReagentCount8, EquippedItemClass, EquippedItemSubClassMask, EquippedItemInventoryTypeMask, Effect1, Effect2, Effect3, EffectDieSides1, EffectDieSides2, EffectDieSides3, EffectRealPointsPerLevel1, EffectRealPointsPerLevel2, EffectRealPointsPerLevel3, EffectBasePoints1, EffectBasePoints2, EffectBasePoints3, EffectMechanic1, EffectMechanic2, EffectMechanic3, EffectImplicitTargetA1, EffectImplicitTargetA2, EffectImplicitTargetA3, EffectImplicitTargetB1, EffectImplicitTargetB2, EffectImplicitTargetB3, EffectRadiusIndex1, EffectRadiusIndex2, EffectRadiusIndex3, EffectApplyAuraName1, EffectApplyAuraName2, EffectApplyAuraName3, EffectAmplitude1, EffectAmplitude2, EffectAmplitude3, EffectMultipleValue1, EffectMultipleValue2, EffectMultipleValue3, EffectChainTarget1, EffectChainTarget2, EffectChainTarget3, EffectItemType1, EffectItemType2, EffectItemType3, EffectMiscValue1, EffectMiscValue2, EffectMiscValue3, EffectMiscValueB1, EffectMiscValueB2, EffectMiscValueB3, EffectTriggerSpell1, EffectTriggerSpell2, EffectTriggerSpell3, EffectPointsPerComboPoint1, EffectPointsPerComboPoint2, EffectPointsPerComboPoint3, EffectSpellClassMask1_1, EffectSpellClassMask1_2, EffectSpellClassMask1_3, EffectSpellClassMask2_1, EffectSpellClassMask2_2, EffectSpellClassMask2_3, EffectSpellClassMask3_1, EffectSpellClassMask3_2, EffectSpellClassMask3_3, SpellVisual, SpellVisual2, SpellIconID, ActiveIconID, SpellPriority, SpellName, SpellName2, SpellName3, SpellName4, SpellName5, SpellName6, SpellName7, SpellName8, SpellName9, SpellName10, SpellName11, SpellName12, SpellName13, SpellName14, SpellName15, SpellName16, Rank1, Rank2, Rank3, Rank4, Rank5, Rank6, Rank7, Rank8, Rank9, Rank10, Rank11, Rank12, Rank13, Rank14, Rank15, Rank16, ManaCostPercentage, StartRecoveryCategory, StartRecoveryTime, MaxTargetLevel, SpellFamilyName, SpellFamilyFlags, SpellFamilyFlags2, MaxAffectedTargets, DmgClass, PreventionType, StanceBarOrder, DmgMultiplier1, DmgMultiplier2, DmgMultiplier3, MinFactionId, MinReputation, RequiredAuraVision, TotemCategory1, TotemCategory2, AreaId, SchoolMask, RuneCostID, SpellMissileID, PowerDisplayId, EffectBonusCoefficient1, EffectBonusCoefficient2, EffectBonusCoefficient3, SpellDescriptionVariableID, SpellDifficultyId, IsServerSide, AttributesServerside) VALUES
Expand Down
7 changes: 6 additions & 1 deletion sql/scriptdev2/spell.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,12 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(34865,'spell_circle_of_healing'),
(34866,'spell_circle_of_healing'),
(48088,'spell_circle_of_healing'),
(48089,'spell_circle_of_healing');
(48089,'spell_circle_of_healing'),
(55680,'spell_glyph_of_prayer_of_healing'),
(55689,'spell_glyph_of_shadow'),
(57989,'spell_shadowfiend_death'),
(71132,'spell_glyph_of_shadow_word_pain'),
(55677,'spell_glyph_of_dispel_magic');

-- Paladin
INSERT INTO spell_scripts(Id, ScriptName) VALUES
Expand Down
130 changes: 115 additions & 15 deletions src/game/Spells/Scripts/Scripting/ClassScripts/Priest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ struct ShadowWordDeath : public SpellScript
enum
{
MANA_LEECH_PASSIVE = 28305,
SPELL_SHADOWFIEND_DEATH = 57989,
};

// 34433 - Shadowfiend
Expand All @@ -73,6 +74,7 @@ struct Shadowfiend : public SpellScript
void OnSummon(Spell* spell, Creature* summon) const override
{
summon->CastSpell(summon, MANA_LEECH_PASSIVE, TRIGGERED_OLD_TRIGGERED);
summon->CastSpell(nullptr, SPELL_SHADOWFIEND_DEATH, TRIGGERED_OLD_TRIGGERED);
summon->AI()->AttackStart(spell->m_targets.getUnitTarget());
}
};
Expand Down Expand Up @@ -116,8 +118,13 @@ enum
};

// 33206 - Pain Suppression
struct PainSuppression : public AuraScript
struct PainSuppression : public SpellScript, public AuraScript
{
void OnInit(Spell* spell) const override
{
spell->SetUsableWhileStunned(spell->GetCaster()->HasAura(63248)); // Glyph of Pain Suppression
}

void OnApply(Aura* aura, bool apply) const override
{
if (apply)
Expand All @@ -128,6 +135,16 @@ struct PainSuppression : public AuraScript
// 17 - Power Word: Shield
struct PowerWordShieldPriest : public AuraScript
{
int32 OnAuraValueCalculate(AuraCalcData& data, int32 value) const override
{
if (data.caster && data.caster->IsPlayer())
{
if (Aura* borrowedTime = static_cast<Player*>(data.caster)->GetKnownTalentRankAuraById(1202, EFFECT_INDEX_1))
value += (borrowedTime->GetAmount() * data.caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(data.spellProto)) / 100);
}
return value;
}

void OnAbsorb(Aura* aura, int32& currentAbsorb, int32& remainingDamage, uint32& reflectedSpellId, int32& reflectDamage, bool& /*preventedDeath*/, bool& /*dropCharge*/, DamageEffectType /*damageType*/) const override
{
Unit* caster = aura->GetTarget();
Expand All @@ -149,8 +166,23 @@ struct PowerWordShieldPriest : public AuraScript
}
}
}

void OnApply(Aura* aura, bool apply) const override
{
Unit* caster = aura->GetCaster();
if (!apply || !caster || aura->GetEffIndex() != EFFECT_INDEX_0)
return;

// Glyph of Power Word: Shield
if (Aura* glyph = caster->GetAura(55672, EFFECT_INDEX_0))
{
int32 heal = (glyph->GetModifier()->m_amount * aura->GetAmount()) / 100;
caster->CastCustomSpell(aura->GetTarget(), 56160, &heal, nullptr, nullptr, TRIGGERED_OLD_TRIGGERED);
}
}
};

// 64844 - Divine Hymn
struct DivineHymn : public SpellScript
{
void OnInit(Spell* spell) const override
Expand All @@ -170,6 +202,7 @@ struct DivineHymn : public SpellScript
}
};

// 64904 - Hymn of Hope
struct HymnOfHope : public SpellScript
{
void OnInit(Spell* spell) const override
Expand All @@ -189,6 +222,7 @@ struct HymnOfHope : public SpellScript
}
};

// 34861 - Circle of Healing
struct CircleOfHealing : public SpellScript
{
void OnInit(Spell* spell) const override
Expand All @@ -208,19 +242,6 @@ struct CircleOfHealing : public SpellScript
}
};

struct PowerWordShield : public AuraScript
{
int32 OnAuraValueCalculate(AuraCalcData& data, int32 value) const override
{
if (data.caster && data.caster->IsPlayer())
{
if (Aura* borrowedTime = static_cast<Player*>(data.caster)->GetKnownTalentRankAuraById(1202, EFFECT_INDEX_1))
value += (borrowedTime->GetAmount() * data.caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(data.spellProto)) / 100);
}
return value;
}
};

enum LightwellData
{
NPC_PRIEST_LIGHTWELL_1 = 31897,
Expand All @@ -240,6 +261,7 @@ enum LightwellData
SPELL_PRIEST_LIGHTWELL_CHARGES = 59907,
};

// 7001 - Lightwell Renew
struct LightwellRenew : public AuraScript
{
void OnApply(Aura* aura, bool apply) const override
Expand All @@ -261,6 +283,7 @@ struct LightwellRenew : public AuraScript
}
};

// 60123 - Lightwell Renew
struct LightwellRelay : public SpellScript
{
void OnEffectExecute(Spell* spell, SpellEffectIndex /*effIdx*/) const override
Expand Down Expand Up @@ -304,6 +327,7 @@ struct LightwellRelay : public SpellScript
}
};

// 55673 - Glyph of Lightwell
struct GlyphOfLightwell : public AuraScript
{
void OnApply(Aura* aura, bool apply) const override
Expand Down Expand Up @@ -350,6 +374,17 @@ struct GuardianSpiritPriest : public AuraScript
aura->GetTarget()->RemoveAurasDueToSpell(aura->GetSpellProto()->Id);
remainingDamage = 0;
}

void OnApply(Aura* aura, bool apply) const override
{
if (!apply && aura->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
{
if (Unit* caster = aura->GetCaster())
if (caster->IsPlayer())
if (Aura const* glyph = caster->GetAura(63231, EFFECT_INDEX_0))
static_cast<Player*>(caster)->ModifyCooldown(47788, glyph->GetAmount() * 1000);
}
}
};

// 57470 - Renewed Hope
Expand Down Expand Up @@ -472,6 +507,67 @@ struct GlyphOfSmite : public AuraScript
}
};

// 55680 - Glyph of Prayer of Healing
struct GlyphOfPrayerOfHealing : public AuraScript
{
SpellAuraProcResult OnProc(Aura* aura, ProcExecutionData& procData) const override
{
procData.basepoints[0] = int32(procData.damage * aura->GetAmount() / 200); // 10% each tick
procData.triggeredSpellId = 56161; // Glyph of Prayer of Healing
return SPELL_AURA_PROC_OK;
}
};

// 55689 - Glyph of Shadow
struct GlyphOfShadow : public AuraScript
{
bool OnCheckProc(Aura* /*aura*/, ProcExecutionData& data) const override
{
if (data.procFlags & (PROC_FLAG_DEAL_HARMFUL_PERIODIC | PROC_FLAG_TAKE_HARMFUL_PERIODIC)) // do not proc on dots
return false;
return true;
}
};

// 57989 - Shadowfiend Death
struct ShadowfiendDeath : public AuraScript
{
bool OnCheckProc(Aura* aura, ProcExecutionData& /*data*/) const override
{
return !aura->GetTarget()->IsAlive();
}

SpellAuraProcResult OnProc(Aura* aura, ProcExecutionData& procData) const override
{
if (Unit* spawner = aura->GetTarget()->GetSpawner())
if (spawner->HasAura(58228)) // Glyph of Shadowfiend
spawner->CastSpell(nullptr, 58227, TRIGGERED_OLD_TRIGGERED);
return SPELL_AURA_PROC_OK;
}
};

// 71132 - Glyph of Shadow Word: Pain
struct GlyphOfShadowWordPain : public SpellScript
{
void OnEffectExecute(Spell* spell, SpellEffectIndex /*effIdx*/) const override
{
spell->SetDamage(spell->GetCaster()->GetPower(POWER_MANA) / 100); // 1%
}
};

// 55677 - Glyph of Dispel Magic
struct GlyphOfDispelMagic : public AuraScript
{
SpellAuraProcResult OnProc(Aura* aura, ProcExecutionData& procData) const override
{
if (!aura->GetTarget()->CanAssist(procData.target))
return SPELL_AURA_PROC_FAILED;

procData.basepoints[0] = int32(procData.target->GetMaxHealth() * aura->GetAmount() / 100);
return SPELL_AURA_PROC_OK;
}
};

void LoadPriestScripts()
{
RegisterSpellScript<PowerInfusion>("spell_power_infusion");
Expand All @@ -484,7 +580,6 @@ void LoadPriestScripts()
RegisterSpellScript<DivineHymn>("spell_divine_hymn");
RegisterSpellScript<HymnOfHope>("spell_hymn_of_hope");
RegisterSpellScript<CircleOfHealing>("spell_circle_of_healing");
RegisterSpellScript<PowerWordShield>("spell_power_word_shield");
RegisterSpellScript<LightwellRenew>("spell_lightwell_renew");
RegisterSpellScript<LightwellRelay>("spell_lightwell_relay");
RegisterSpellScript<GlyphOfLightwell>("spell_glyph_of_lightwell");
Expand All @@ -497,4 +592,9 @@ void LoadPriestScripts()
RegisterSpellScript<GlyphOfShadowWordDeath>("spell_glyph_of_shadow_word_death");
RegisterSpellScript<TestOfFaith>("spell_test_of_faith");
RegisterSpellScript<GlyphOfSmite>("spell_glyph_of_smite");
RegisterSpellScript<GlyphOfPrayerOfHealing>("spell_glyph_of_prayer_of_healing");
RegisterSpellScript<GlyphOfShadow>("spell_glyph_of_shadow");
RegisterSpellScript<ShadowfiendDeath>("spell_shadowfiend_death");
RegisterSpellScript<GlyphOfShadowWordPain>("spell_glyph_of_shadow_word_pain");
RegisterSpellScript<GlyphOfDispelMagic>("spell_glyph_of_dispel_magic");
}
16 changes: 0 additions & 16 deletions src/game/Spells/SpellAuras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10505,22 +10505,6 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply)
}
case SPELLFAMILY_PRIEST:
{
// Power Word: Shield
if (apply && m_spellProto->SpellFamilyFlags & uint64(0x0000000000000001) && m_spellProto->Mechanic == MECHANIC_SHIELD)
{
Unit* caster = GetCaster();
if (!caster)
return;

// Glyph of Power Word: Shield
if (Aura* glyph = caster->GetAura(55672, EFFECT_INDEX_0))
{
Aura* shield = GetAuraByEffectIndex(EFFECT_INDEX_0);
int32 heal = (glyph->GetModifier()->m_amount * shield->GetModifier()->m_amount) / 100;
caster->CastCustomSpell(m_target, 56160, &heal, nullptr, nullptr, TRIGGERED_OLD_TRIGGERED, nullptr, shield);
}
return;
}
switch (GetId())
{
// Abolish Disease (remove 1 more poison effect with Body and Soul)
Expand Down
28 changes: 0 additions & 28 deletions src/game/Spells/UnitAuraProcHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1375,17 +1375,6 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(ProcExecutionData& data)
target = this;
break;
}
// Shadowfiend Death (Gain mana if pet dies with Glyph of Shadowfiend)
case 57989:
{
Unit* owner = GetOwner();
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
return SPELL_AURA_PROC_FAILED;

// Glyph of Shadowfiend (need cast as self cast for owner, no hidden cooldown)
owner->CastSpell(owner, 58227, TRIGGERED_OLD_TRIGGERED, castItem, triggeredByAura);
return SPELL_AURA_PROC_OK;
}
// Kill Command, pet aura
case 58914:
{
Expand Down Expand Up @@ -1838,23 +1827,6 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(ProcExecutionData& data)
triggered_spell_id = 28810;
break;
}
// Glyph of Dispel Magic
case 55677:
{
if (!target->CanAssist(this))
return SPELL_AURA_PROC_FAILED;

basepoints[0] = int32(target->GetMaxHealth() * triggerAmount / 100);
// triggered_spell_id in spell data
break;
}
// Glyph of Prayer of Healing
case 55680:
{
basepoints[0] = int32(damage * triggerAmount / 200); // 10% each tick
triggered_spell_id = 56161; // Glyph of Prayer of Healing
break;
}
// Priest T10 Healer 2P Bonus
case 70770:
{
Expand Down

0 comments on commit 3b1dfe0

Please sign in to comment.