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
Show file tree
Hide file tree
Changes from 2 commits
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
2 changes: 2 additions & 0 deletions sql/updates/world/2022_06_18_00_world.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DELETE FROM `spell_script_names` WHERE `spell_id`=5217 AND `ScriptName`='spell_dru_tigers_fury';
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (5217, 'spell_dru_tigers_fury');
88 changes: 85 additions & 3 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 All @@ -57,10 +58,56 @@ enum DruidSpells
SPELL_DRUID_STAMPEDE_BAER_RANK_1 = 81016,
SPELL_DRUID_STAMPEDE_CAT_RANK_1 = 81021,
SPELL_DRUID_STAMPEDE_CAT_STATE = 109881,
SPELL_DRUID_BERSERK_AURA = 106951,
SPELL_DRUID_TIGER_S_FURY_ENERGIZE = 51178,
SPELL_DRUID_BEAR_FORM = 5487,
};

// 5217 - Tiger's Fury
class spell_dru_tigers_fury : public SpellScriptLoader
{
public:
spell_dru_tigers_fury() : SpellScriptLoader("spell_dru_tigers_fury") { }

class spell_dru_tigers_fury_SpellScript : public SpellScript
{
PrepareSpellScript(spell_dru_tigers_fury_SpellScript);

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

SpellCastResult CheckCast()
{
if (Unit* caster = GetCaster())
{
if (caster->GetShapeshiftForm() != FORM_CAT)
{
SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_MUST_BE_IN_CAT_FORM);
return SpellCastResult::SPELL_FAILED_CUSTOM_ERROR;
}

if (caster->HasAura(SPELL_DRUID_BERSERK_AURA))
return SpellCastResult::SPELL_FAILED_DONT_REPORT;
}
return SpellCastResult::SPELL_CAST_OK;
}

void Register() override
{
OnCheckCast += SpellCheckCastFn(spell_dru_tigers_fury_SpellScript::CheckCast);
}
};

SpellScript* GetSpellScript() const
{
return new spell_dru_tigers_fury_SpellScript();
}
};

// 1850 - Dash
class spell_dru_dash : public SpellScriptLoader
{
Expand Down Expand Up @@ -410,14 +457,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 +486,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 +543,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 Expand Up @@ -985,6 +1066,7 @@ class spell_dru_t10_restoration_4p_bonus : public SpellScriptLoader

void AddSC_druid_spell_scripts()
{
new spell_dru_tigers_fury();
new spell_dru_dash();
new spell_dru_eclipse("spell_dru_eclipse_lunar");
new spell_dru_eclipse("spell_dru_eclipse_solar");
Expand All @@ -1005,4 +1087,4 @@ void AddSC_druid_spell_scripts()
new spell_dru_survival_instincts();
new spell_dru_swift_flight_passive();
new spell_dru_t10_restoration_4p_bonus();
}
}