Core/Spells: fix spell scripts from recent commit and cleanup scripts
This commit is contained in:
1 parent
478de6298e
commit
9d19be2ee5
8 files changed
+110
-206
No files matched your search
@@ -332,26 +332,6 @@ class spell_dru_swift_flight_passive : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
class StarfallDummyTargetFilter
|
||||
{
|
||||
public:
|
||||
StarfallDummyTargetFilter(Unit* caster) : _caster(caster) { }
|
||||
|
||||
bool operator()(Unit* target) const
|
||||
{
|
||||
if (target->HasStealthAura() || target->HasInvisibilityAura())
|
||||
return true;
|
||||
|
||||
if (!target->IsWithinLOSInMap(_caster))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
Unit* _caster;
|
||||
};
|
||||
|
||||
class spell_dru_starfall_dummy : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
@@ -363,8 +343,6 @@ class spell_dru_starfall_dummy : public SpellScriptLoader
|
||||
|
||||
void FilterTargets(std::list<Unit*>& unitList)
|
||||
{
|
||||
// Remove targets not in LoS or in stealth
|
||||
unitList.remove_if(StarfallDummyTargetFilter(GetCaster()));
|
||||
Trinity::Containers::RandomResizeList(unitList, 2);
|
||||
}
|
||||
|
||||
@@ -419,61 +397,28 @@ class spell_dru_lifebloom : public SpellScriptLoader
|
||||
|
||||
void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
// Final heal only on duration end
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
|
||||
// Final heal only on duration end and dispel
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE && GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL)
|
||||
return;
|
||||
|
||||
// final heal
|
||||
int32 stack = GetStackAmount();
|
||||
int32 healAmount = aurEff->GetAmount();
|
||||
Unit* caster = GetCaster();
|
||||
if (caster)
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
healAmount = caster->SpellHealingBonusDone(GetTarget(), GetSpellInfo(), healAmount, HEAL, stack);
|
||||
healAmount = GetTarget()->SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, HEAL, stack);
|
||||
}
|
||||
|
||||
GetTarget()->CastCustomSpell(GetTarget(), DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
|
||||
|
||||
// restore mana
|
||||
if (caster)
|
||||
{
|
||||
// restore mana
|
||||
int32 returnMana = CalculatePctU(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * stack / 2;
|
||||
caster->CastCustomSpell(caster, DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
|
||||
}
|
||||
}
|
||||
|
||||
void HandleDispel(DispelInfo* dispelInfo)
|
||||
{
|
||||
if (Unit* target = GetUnitOwner())
|
||||
{
|
||||
if (AuraEffect const* aurEff = GetEffect(EFFECT_1))
|
||||
{
|
||||
// final heal
|
||||
int32 healAmount = aurEff->GetAmount();
|
||||
Unit* caster = GetCaster();
|
||||
if (caster)
|
||||
{
|
||||
healAmount = caster->SpellHealingBonusDone(target, GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges());
|
||||
healAmount = target->SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges());
|
||||
}
|
||||
|
||||
target->CastCustomSpell(target, DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID());
|
||||
|
||||
// restore mana
|
||||
if (caster)
|
||||
{
|
||||
int32 returnMana = CalculatePctU(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * dispelInfo->GetRemovedCharges() / 2;
|
||||
caster->CastCustomSpell(caster, DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, NULL, GetCasterGUID());
|
||||
}
|
||||
}
|
||||
}
|
||||
GetTarget()->CastCustomSpell(GetTarget(), DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
AfterEffectRemove += AuraEffectRemoveFn(spell_dru_lifebloom_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
AfterDispel += AuraDispelFn(spell_dru_lifebloom_AuraScript::HandleDispel);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user