Skip to content

Commit

Permalink
Shaman: 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 57d8938 commit 027ab54
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 84 deletions.
14 changes: 13 additions & 1 deletion sql/scriptdev2/spell.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1729,7 +1729,19 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(60043,'spell_lava_burst'),
(55438,'spell_glyph_of_lesser_healing_wave'),
(2825,'spell_heroism_bloodlust'),
(32182,'spell_heroism_bloodlust');
(32182,'spell_heroism_bloodlust'),
(39610,'spell_mana_tide_totem_effect'),
(55440,'spell_glyph_of_healing_wave'),
(63280,'spell_glyph_of_totem_of_wrath'),
(52041,'spell_healing_stream_totem_effect'),
(52046,'spell_healing_stream_totem_effect'),
(52047,'spell_healing_stream_totem_effect'),
(52048,'spell_healing_stream_totem_effect'),
(52049,'spell_healing_stream_totem_effect'),
(52050,'spell_healing_stream_totem_effect'),
(58759,'spell_healing_stream_totem_effect'),
(58760,'spell_healing_stream_totem_effect'),
(58761,'spell_healing_stream_totem_effect');

-- Food and Drink
INSERT INTO spell_scripts(Id, ScriptName) VALUES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -692,10 +692,13 @@ struct FeralSpiritPetScaling1 : public AuraScript
{
if (owner->IsPlayer())
{
float mod = 0.5f;
if (Aura* aura = owner->GetAura(63271, EFFECT_INDEX_0))
mod += float(aura->GetAmount()) / 100;
int32 nature = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_NATURE)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_NATURE);
if (nature < 0)
nature = 0;
value = nature * 0.5f;
value = nature * mod;
}
}
break;
Expand Down
111 changes: 111 additions & 0 deletions src/game/Spells/Scripts/Scripting/ClassScripts/Shaman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,28 @@ struct EarthShield : public AuraScript
}
};

// 39610 - Mana Tide Totem
struct ManaTideTotemEffect : public SpellScript
{
void OnEffectExecute(Spell* spell, SpellEffectIndex effIdx) const override
{
Unit* unitTarget = spell->GetUnitTarget();
Unit* caster = spell->GetCaster();
if (!unitTarget || unitTarget->GetPowerType() != POWER_MANA)
return;

int32 damage = spell->GetDamage();

// Glyph of Mana Tide
if (Unit* owner = caster->GetOwner())
if (Aura* dummy = owner->GetDummyAura(55441))
damage += dummy->GetModifier()->m_amount;
// Regenerate 6% of Total Mana Every 3 secs
int32 EffectBasePoints0 = unitTarget->GetMaxPower(POWER_MANA) * damage / 100;
caster->CastCustomSpell(unitTarget, 39609, &EffectBasePoints0, nullptr, nullptr, TRIGGERED_OLD_TRIGGERED);
}
};

enum
{
SPELL_SHAMAN_ELEMENTAL_MASTERY = 16166,
Expand Down Expand Up @@ -339,6 +361,91 @@ struct GlyphOfLesserHealingWave : public AuraScript
}
};

// 55440 - Glyph of Healing Wave
struct GlyphOfHealingWave : public AuraScript
{
SpellAuraProcResult OnProc(Aura* aura, ProcExecutionData& procData) const override
{
// Not proc from self heals
if (procData.source == procData.target)
return SPELL_AURA_PROC_FAILED;
procData.basepoints[0] = aura->GetAmount() * procData.damage / 100;
procData.triggerTarget = procData.source;
procData.triggeredSpellId = 55533;
return SPELL_AURA_PROC_OK;
}
};

// 63280 - Glyph of Totem of Wrath
struct GlyphOfTotemOfWrath : public AuraScript
{
SpellAuraProcResult OnProc(Aura* aura, ProcExecutionData& procData) const override
{
Unit* source = procData.source;
Totem* totem = source->GetTotem(TOTEM_SLOT_FIRE);
if (!totem)
return SPELL_AURA_PROC_FAILED;

// find totem aura bonus
Unit::AuraList const& spellPower = totem->GetAurasByType(SPELL_AURA_NONE);
for (auto i : spellPower)
{
// select proper aura for format aura type in spell proto
if (i->GetTarget() == totem && i->GetSpellProto()->EffectApplyAuraName[i->GetEffIndex()] == SPELL_AURA_MOD_HEALING_DONE &&
i->GetSpellProto()->SpellFamilyName == SPELLFAMILY_SHAMAN && i->GetSpellProto()->SpellFamilyFlags & uint64(0x0000000004000000))
{
procData.basepoints[0] = aura->GetAmount() * i->GetModifier()->m_amount / 100;
break;
}
}

if (!procData.basepoints[0])
return SPELL_AURA_PROC_FAILED;

procData.basepoints[1] = procData.basepoints[0];
procData.triggeredSpellId = 63283; // Totem of Wrath, caster bonus
procData.triggerTarget = source;
return SPELL_AURA_PROC_OK;
}
};

// 52041 - Healing Stream Totem
struct HealingStreamTotemEffect : public SpellScript
{
void OnEffectExecute(Spell* spell, SpellEffectIndex /*effIdx*/) const override
{
if (Unit* unitTarget = spell->GetUnitTarget())
{
int32 damage = spell->GetDamage();
Unit* caster = spell->GetCaster();
if (Unit* owner = caster->GetOwner())
{
// spell have SPELL_DAMAGE_CLASS_NONE and not get bonuses from owner, use main spell for bonuses
if (spell->m_triggeredBySpellInfo)
{
damage = int32(owner->SpellHealingBonusDone(unitTarget, spell->m_triggeredBySpellInfo, damage, HEAL));
damage = int32(unitTarget->SpellHealingBonusTaken(owner, spell->m_triggeredBySpellInfo, damage, HEAL));
}

// Restorative Totems
Aura* restorativeTotems = owner->GetAura(16206, EFFECT_INDEX_1);
if (!restorativeTotems)
restorativeTotems = owner->GetAura(16205, EFFECT_INDEX_1);
if (!restorativeTotems)
restorativeTotems = owner->GetAura(16187, EFFECT_INDEX_1);

if (restorativeTotems)
damage += restorativeTotems->GetModifier()->m_amount * damage / 100;

// Glyph of Healing Stream Totem
if (Aura* dummy = owner->GetDummyAura(55456))
damage += dummy->GetModifier()->m_amount * damage / 100;
}
caster->CastCustomSpell(unitTarget, 52042, &damage, nullptr, nullptr, TRIGGERED_OLD_TRIGGERED);
}
}
};

void LoadShamanScripts()
{
Script* pNewScript = new Script;
Expand All @@ -348,6 +455,7 @@ void LoadShamanScripts()

RegisterSpellScript<SentryTotem>("spell_sentry_totem");
RegisterSpellScript<EarthShield>("spell_earth_shield");
RegisterSpellScript<ManaTideTotemEffect>("spell_mana_tide_totem_effect");
RegisterSpellScript<ItemShamanT10Elemental2PBonus>("spell_item_shaman_t10_elemental_2p_bonus");
RegisterSpellScript<EartbindTotem>("spell_earthbind_totem");
RegisterSpellScript<LavaLash>("spell_lava_lash");
Expand All @@ -360,4 +468,7 @@ void LoadShamanScripts()
RegisterSpellScript<AstralShiftShaman>("spell_astral_shift_shaman");
RegisterSpellScript<LavaBurst>("spell_lava_burst");
RegisterSpellScript<GlyphOfLesserHealingWave>("spell_glyph_of_lesser_healing_wave");
RegisterSpellScript<GlyphOfHealingWave>("spell_glyph_of_healing_wave");
RegisterSpellScript<GlyphOfTotemOfWrath>("spell_glyph_of_totem_of_wrath");
RegisterSpellScript<HealingStreamTotemEffect>("spell_healing_stream_totem_effect");
}
43 changes: 0 additions & 43 deletions src/game/Spells/SpellEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4239,35 +4239,6 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx)
m_caster->CastSpell(unitTarget, 52025, TRIGGERED_OLD_TRIGGERED);
return;
}
// Healing Stream Totem
if (m_spellInfo->SpellFamilyFlags & uint64(0x0000000000002000))
{
if (unitTarget)
{
if (Unit* owner = m_caster->GetOwner())
{
// spell have SPELL_DAMAGE_CLASS_NONE and not get bonuses from owner, use main spell for bonuses
if (m_triggeredBySpellInfo)
{
damage = int32(owner->SpellHealingBonusDone(unitTarget, m_triggeredBySpellInfo, damage, HEAL));
damage = int32(unitTarget->SpellHealingBonusTaken(owner, m_triggeredBySpellInfo, damage, HEAL));
}

// Restorative Totems
Unit::AuraList const& mDummyAuras = owner->GetAurasByType(SPELL_AURA_DUMMY);
for (auto mDummyAura : mDummyAuras)
// only its have dummy with specific icon
if (mDummyAura->GetSpellProto()->SpellFamilyName == SPELLFAMILY_SHAMAN && mDummyAura->GetSpellProto()->SpellIconID == 338)
damage += mDummyAura->GetModifier()->m_amount * damage / 100;

// Glyph of Healing Stream Totem
if (Aura* dummy = owner->GetDummyAura(55456))
damage += dummy->GetModifier()->m_amount * damage / 100;
}
m_caster->CastCustomSpell(unitTarget, 52042, &damage, nullptr, nullptr, TRIGGERED_OLD_TRIGGERED, nullptr, nullptr, m_originalCasterGUID);
}
return;
}
// Mana Spring Totem
if (m_spellInfo->SpellFamilyFlags & uint64(0x0000000000004000))
{
Expand Down Expand Up @@ -4297,20 +4268,6 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx)

return;
}
if (m_spellInfo->Id == 39610) // Mana Tide Totem effect
{
if (!unitTarget || unitTarget->GetPowerType() != POWER_MANA)
return;

// Glyph of Mana Tide
if (Unit* owner = m_caster->GetOwner())
if (Aura* dummy = owner->GetDummyAura(55441))
damage += dummy->GetModifier()->m_amount;
// Regenerate 6% of Total Mana Every 3 secs
int32 EffectBasePoints0 = unitTarget->GetMaxPower(POWER_MANA) * damage / 100;
m_caster->CastCustomSpell(unitTarget, 39609, &EffectBasePoints0, nullptr, nullptr, TRIGGERED_OLD_TRIGGERED, nullptr, nullptr, m_originalCasterGUID);
return;
}
break;
}
case SPELLFAMILY_DEATHKNIGHT:
Expand Down
39 changes: 0 additions & 39 deletions src/game/Spells/UnitAuraProcHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2580,17 +2580,6 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(ProcExecutionData& data)
target = this;
break;
}
// Glyph of Healing Wave
case 55440:
{
// Not proc from self heals
if (this == pVictim)
return SPELL_AURA_PROC_FAILED;
basepoints[0] = triggerAmount * damage / 100;
target = this;
triggered_spell_id = 55533;
break;
}
// Spirit Hunt
case 58877:
{
Expand All @@ -2602,34 +2591,6 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(ProcExecutionData& data)
triggered_spell_id = 58879;
break;
}
// Glyph of Totem of Wrath
case 63280:
{
Totem* totem = GetTotem(TOTEM_SLOT_FIRE);
if (!totem)
return SPELL_AURA_PROC_FAILED;

// find totem aura bonus
AuraList const& spellPower = totem->GetAurasByType(SPELL_AURA_NONE);
for (auto i : spellPower)
{
// select proper aura for format aura type in spell proto
if (i->GetTarget() == totem && i->GetSpellProto()->EffectApplyAuraName[i->GetEffIndex()] == SPELL_AURA_MOD_HEALING_DONE &&
i->GetSpellProto()->SpellFamilyName == SPELLFAMILY_SHAMAN && i->GetSpellProto()->SpellFamilyFlags & uint64(0x0000000004000000))
{
basepoints[0] = triggerAmount * i->GetModifier()->m_amount / 100;
break;
}
}

if (!basepoints[0])
return SPELL_AURA_PROC_FAILED;

basepoints[1] = basepoints[0];
triggered_spell_id = 63283; // Totem of Wrath, caster bonus
target = this;
break;
}
// Item - Shaman T8 Elemental 4P Bonus
case 64928:
{
Expand Down

0 comments on commit 027ab54

Please sign in to comment.