Implosion
This commit is contained in:
@@ -112,6 +112,7 @@ enum WarlockSpells
|
|||||||
SPELL_WARLOCK_WILD_IMP_SUMMON = 279910,
|
SPELL_WARLOCK_WILD_IMP_SUMMON = 279910,
|
||||||
SPELL_WARLOCK_UMBRAL_BRAZE = 405802,
|
SPELL_WARLOCK_UMBRAL_BRAZE = 405802,
|
||||||
SPELL_WARLOCK_IMPLOSION = 196277,
|
SPELL_WARLOCK_IMPLOSION = 196277,
|
||||||
|
SPELL_WARLOCK_IMPLOSION_DAMAGE = 196278,
|
||||||
SPELL_WARLOCK_IMPLOSION_TRIGGER = 296553,
|
SPELL_WARLOCK_IMPLOSION_TRIGGER = 296553,
|
||||||
SPELL_WARLOCK_HAND_OF_DOOM = 196283,
|
SPELL_WARLOCK_HAND_OF_DOOM = 196283,
|
||||||
SPELL_WARLOCK_DOOM = 603,
|
SPELL_WARLOCK_DOOM = 603,
|
||||||
@@ -1708,6 +1709,69 @@ class spell_warl_hand_of_guldan_damage : public SpellScript
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 196277 - Implosion
|
||||||
|
// Pulls up to 6 Wild Imps toward the target and causes each to explode for Shadowflame AOE damage.
|
||||||
|
class spell_warl_implosion : public SpellScript
|
||||||
|
{
|
||||||
|
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||||
|
{
|
||||||
|
return ValidateSpellInfo({ SPELL_WARLOCK_WILD_IMP_SUMMON, SPELL_WARLOCK_IMPLOSION_DAMAGE });
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleHitTarget(SpellEffIndex /*effIndex*/)
|
||||||
|
{
|
||||||
|
Unit* caster = GetCaster();
|
||||||
|
Unit* target = GetHitUnit();
|
||||||
|
if (!caster || !target)
|
||||||
|
return;
|
||||||
|
|
||||||
|
SpellInfo const* summonSpellInfo = sSpellMgr->GetSpellInfo(SPELL_WARLOCK_WILD_IMP_SUMMON, DIFFICULTY_NONE);
|
||||||
|
if (!summonSpellInfo)
|
||||||
|
return;
|
||||||
|
|
||||||
|
uint32 creatureEntry = summonSpellInfo->GetEffect(EFFECT_0).MiscValue;
|
||||||
|
int32 maxImps = GetSpellInfo()->GetEffect(EFFECT_0).BasePoints;
|
||||||
|
if (maxImps <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
std::list<Creature*> wildImps;
|
||||||
|
caster->GetCreatureListWithEntryInGrid(wildImps, creatureEntry, 100.0f);
|
||||||
|
|
||||||
|
int32 pulled = 0;
|
||||||
|
for (Creature* imp : wildImps)
|
||||||
|
{
|
||||||
|
if (pulled >= maxImps)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (!imp->IsAlive() || imp->GetOwnerGUID() != caster->GetGUID())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
float angle = rand_norm() * 2.0f * float(M_PI);
|
||||||
|
float radius = rand_norm() * 2.0f;
|
||||||
|
imp->GetMotionMaster()->MovePoint(0, target->GetPositionX() + radius * std::cos(angle),
|
||||||
|
target->GetPositionY() + radius * std::sin(angle), target->GetPositionZ(), false);
|
||||||
|
|
||||||
|
uint32 travelMs = std::clamp<uint32>(uint32(imp->GetDistance(target) * 20.0f), 300, 1500);
|
||||||
|
ObjectGuid targetGuid = target->GetGUID();
|
||||||
|
imp->GetScheduler().Schedule(Milliseconds(travelMs), [imp, targetGuid](TaskContext /*context*/)
|
||||||
|
{
|
||||||
|
if (Unit* explodeTarget = ObjectAccessor::GetUnit(*imp, targetGuid))
|
||||||
|
imp->CastSpell(explodeTarget, SPELL_WARLOCK_IMPLOSION_DAMAGE, CastSpellExtraArgs()
|
||||||
|
.SetTriggerFlags(TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR));
|
||||||
|
|
||||||
|
imp->DespawnOrUnsummon();
|
||||||
|
});
|
||||||
|
|
||||||
|
++pulled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Register() override
|
||||||
|
{
|
||||||
|
OnEffectHitTarget += SpellEffectFn(spell_warl_implosion::HandleHitTarget, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
enum FreakzWarlockNPCs
|
enum FreakzWarlockNPCs
|
||||||
{
|
{
|
||||||
NPC_WARLOCK_DEMONIC_GATEWAY_PURPLE = 59271,
|
NPC_WARLOCK_DEMONIC_GATEWAY_PURPLE = 59271,
|
||||||
@@ -2103,4 +2167,5 @@ void AddSC_warlock_spell_scripts()
|
|||||||
RegisterSpellScript(spell_warl_cunning_cruelty);
|
RegisterSpellScript(spell_warl_cunning_cruelty);
|
||||||
RegisterSpellScript(spell_warl_inner_demons);
|
RegisterSpellScript(spell_warl_inner_demons);
|
||||||
RegisterSpellScript(spell_warl_summon_demonic_tyrant);
|
RegisterSpellScript(spell_warl_summon_demonic_tyrant);
|
||||||
|
RegisterSpellScript(spell_warl_implosion);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user