mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-19 03:45:43 +00:00
fix(Scripts/ScarletEnclave): Devour Humanoid castable without target … (#22196)
Co-authored-by: Rocco Silipo <108557877+Rorschach91@users.noreply.github.com>
This commit is contained in:
@@ -15,27 +15,77 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "CreatureScript.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "SpellAuras.h"
|
||||
#include "SpellInfo.h"
|
||||
#include "SpellScript.h"
|
||||
#include "SpellScriptLoader.h"
|
||||
|
||||
enum DevourHumanoid
|
||||
{
|
||||
NPC_HEARTHGLEN_CRUSADER = 29102,
|
||||
NPC_TIRISFAL_CRUSADER = 29103
|
||||
};
|
||||
|
||||
// 53110 - Devour Humanoid
|
||||
class spell_q12779_an_end_to_all_things : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_q12779_an_end_to_all_things);
|
||||
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
if (caster->FindNearestCreature(NPC_HEARTHGLEN_CRUSADER, 15.0f, true) || caster->FindNearestCreature(NPC_TIRISFAL_CRUSADER, 15.0f, true))
|
||||
return SPELL_CAST_OK;
|
||||
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
}
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (GetHitUnit())
|
||||
GetHitUnit()->CastSpell(GetCaster(), GetEffectValue(), true);
|
||||
if (Creature* c = GetHitUnit()->ToCreature())
|
||||
if (Unit* caster = GetCaster())
|
||||
{
|
||||
c->AI()->AttackStart(caster);
|
||||
c->CastSpell(caster, GetEffectValue(), true); // 53111
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnCheckCast += SpellCheckCastFn(spell_q12779_an_end_to_all_things::CheckCast);
|
||||
OnEffectHitTarget += SpellEffectFn(spell_q12779_an_end_to_all_things::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
// 53111 - Devour Humanoid (casted by the devoured creature)
|
||||
class spell_q12779_an_end_to_all_things_devour_aura : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_q12779_an_end_to_all_things_devour_aura);
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
Unit* target = GetTarget();
|
||||
if (!caster || !target)
|
||||
return;
|
||||
|
||||
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
|
||||
{
|
||||
caster->SetDisableGravity(true);
|
||||
Unit::Kill(target, caster);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
AfterEffectRemove += AuraEffectRemoveFn(spell_q12779_an_end_to_all_things_devour_aura::OnRemove, EFFECT_0, SPELL_AURA_CONTROL_VEHICLE, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_the_scarlet_enclave_c3()
|
||||
{
|
||||
RegisterSpellScript(spell_q12779_an_end_to_all_things);
|
||||
RegisterSpellScript(spell_q12779_an_end_to_all_things_devour_aura);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user