Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Druid PR Spell Fixes - Ongoing #1104

Merged
merged 7 commits into from
Jun 22, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 37 additions & 2 deletions src/server/scripts/Spells/spell_druid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ enum DruidSpells
SPELL_DRUID_INCREASED_MOONFIRE_DURATION = 38414,
SPELL_DRUID_LIFEBLOOM_ENERGIZE = 64372,
SPELL_DRUID_LIFEBLOOM_FINAL_HEAL = 33778,
SPELL_DRUID_LIFEBLOOM = 33763,
SPELL_DRUID_LIVING_SEED_HEAL = 48503,
SPELL_DRUID_LIVING_SEED_PROC = 48504,
SPELL_DRUID_NATURES_GRACE = 16880,
Expand Down Expand Up @@ -410,14 +411,14 @@ class spell_dru_lifebloom : public SpellScriptLoader
{
PrepareAuraScript(spell_dru_lifebloom_AuraScript);

bool Validate(SpellInfo const* /*spell*/) override
/*bool Validate(SpellInfo const* spell) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_LIFEBLOOM_FINAL_HEAL))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_LIFEBLOOM_ENERGIZE))
return false;
return true;
}
}*/

void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
Expand All @@ -439,6 +440,39 @@ class spell_dru_lifebloom : public SpellScriptLoader
GetTarget()->CastCustomSpell(GetTarget(), SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
}

// Lifebloom is considered a single target spell, however it is missing the attribute in DBC so single target is handled here.
void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
{
if (Unit* unitTarget = GetTarget())
{
Aura* aura = unitTarget->GetAura(SPELL_DRUID_LIFEBLOOM);
// lets keep track of applied auras
Unit::AuraList& appliedAuras = caster->GetSingleCastAuras();
for (Unit::AuraList::iterator iter = appliedAuras.begin(); iter != appliedAuras.end();)
{
if ((*iter) != unitTarget->GetAura(SPELL_DRUID_LIFEBLOOM))
{
uint32 stackAmount = (*iter)->GetStackAmount();
aura->SetStackAmount(stackAmount);
(*iter)->Remove();
iter = appliedAuras.begin();
}
else
++iter;
}

if (caster->GetSingleCastAuras().empty())
{
// set single target in aura so it's properly removed from list when unapplying
aura->SetIsSingleTarget(true);
caster->GetSingleCastAuras().push_back(aura);
}
}
}
}

void HandleDispel(DispelInfo* dispelInfo)
{
if (Unit* target = GetUnitOwner())
Expand All @@ -463,6 +497,7 @@ class spell_dru_lifebloom : public SpellScriptLoader
{
AfterEffectRemove += AuraEffectRemoveFn(spell_dru_lifebloom_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
AfterDispel += AuraDispelFn(spell_dru_lifebloom_AuraScript::HandleDispel);
OnEffectApply += AuraEffectApplyFn(spell_dru_lifebloom_AuraScript::OnApply, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};

Expand Down