mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 00:48:56 +01:00
Scripts/Spells: Fix lifebloom final heal and update some druid spell scripts (#28028)
This commit is contained in:
@@ -75,7 +75,6 @@ enum DruidSpells
|
||||
SPELL_DRUID_INNERVATE_RANK_2 = 326228,
|
||||
SPELL_DRUID_INFUSION = 37238,
|
||||
SPELL_DRUID_LANGUISH = 71023,
|
||||
SPELL_DRUID_LIFEBLOOM_ENERGIZE = 64372,
|
||||
SPELL_DRUID_LIFEBLOOM_FINAL_HEAL = 33778,
|
||||
SPELL_DRUID_LUNAR_INSPIRATION_OVERRIDE = 155627,
|
||||
SPELL_DRUID_MANGLE = 33917,
|
||||
@@ -764,50 +763,19 @@ class spell_dru_lifebloom : public AuraScript
|
||||
|
||||
bool Validate(SpellInfo const* /*spell*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, SPELL_DRUID_LIFEBLOOM_ENERGIZE });
|
||||
return ValidateSpellInfo({ SPELL_DRUID_LIFEBLOOM_FINAL_HEAL });
|
||||
}
|
||||
|
||||
void OnRemoveEffect(Unit* target, AuraEffect const* aurEff, uint32 stack)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
// restore mana
|
||||
std::vector<SpellPowerCost> costs = GetSpellInfo()->CalcPowerCost(caster, GetSpellInfo()->GetSchoolMask());
|
||||
auto m = std::find_if(costs.begin(), costs.end(), [](SpellPowerCost const& cost) { return cost.Power == POWER_MANA; });
|
||||
if (m != costs.end())
|
||||
{
|
||||
CastSpellExtraArgs args(aurEff);
|
||||
args.OriginalCaster = GetCasterGUID();
|
||||
args.AddSpellBP0(m->Amount * stack / 2);
|
||||
caster->CastSpell(caster, SPELL_DRUID_LIFEBLOOM_ENERGIZE, args);
|
||||
}
|
||||
}
|
||||
|
||||
target->CastSpell(target, SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, CastSpellExtraArgs(aurEff)
|
||||
.SetOriginalCaster(GetCasterGUID()));
|
||||
}
|
||||
|
||||
void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
|
||||
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
// Final heal only on duration end
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
|
||||
return;
|
||||
|
||||
// final heal
|
||||
OnRemoveEffect(GetUnitOwner(), aurEff, GetStackAmount());
|
||||
}
|
||||
|
||||
void HandleDispel(DispelInfo* dispelInfo)
|
||||
{
|
||||
if (Unit* target = GetUnitOwner())
|
||||
if (AuraEffect const* aurEff = GetEffect(EFFECT_1))
|
||||
OnRemoveEffect(target, aurEff, dispelInfo->GetRemovedCharges()); // final heal
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE || GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_ENEMY_SPELL)
|
||||
GetCaster()->CastSpell(GetUnitOwner(), SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
AfterEffectRemove += AuraEffectRemoveFn(spell_dru_lifebloom::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
AfterDispel += AuraDispelFn(spell_dru_lifebloom::HandleDispel);
|
||||
AfterEffectRemove += AuraEffectRemoveFn(spell_dru_lifebloom::AfterRemove, EFFECT_0, SPELL_AURA_PERIODIC_HEAL, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1033,7 +1001,7 @@ class spell_dru_starfall_dummy : public SpellScript
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dru_starfall_dummy::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dru_starfall_dummy::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
|
||||
OnEffectHitTarget += SpellEffectFn(spell_dru_starfall_dummy::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user