fix(Scripts/AzjolNerub): Boss Herald Volazj - Insanity spell cast (#21287)
Co-authored-by: Hexadecimal <hd@hd.hd> Co-authored-by: sudlud <sudlud@users.noreply.github.com>
This commit is contained in:
@@ -33,7 +33,6 @@ enum Spells
|
|||||||
// INSANITY
|
// INSANITY
|
||||||
SPELL_INSANITY = 57496, //Dummy
|
SPELL_INSANITY = 57496, //Dummy
|
||||||
INSANITY_VISUAL = 57561,
|
INSANITY_VISUAL = 57561,
|
||||||
SPELL_INSANITY_TARGET = 57508,
|
|
||||||
SPELL_CLONE_PLAYER = 57507, //casted on player during insanity
|
SPELL_CLONE_PLAYER = 57507, //casted on player during insanity
|
||||||
SPELL_INSANITY_PHASING_1 = 57508,
|
SPELL_INSANITY_PHASING_1 = 57508,
|
||||||
SPELL_INSANITY_PHASING_2 = 57509,
|
SPELL_INSANITY_PHASING_2 = 57509,
|
||||||
@@ -362,15 +361,13 @@ class spell_herald_volzaj_insanity : public SpellScript
|
|||||||
{
|
{
|
||||||
targets.remove_if([this](WorldObject* targetObj) -> bool
|
targets.remove_if([this](WorldObject* targetObj) -> bool
|
||||||
{
|
{
|
||||||
return !targetObj || !targetObj->IsPlayer() || !targetObj->ToPlayer()->IsInCombatWith(GetCaster()) ||
|
return !targetObj || !targetObj->IsPlayer() || !GetCaster()->IsInCombatWith(targetObj->ToPlayer()) ||
|
||||||
targetObj->GetDistance(GetCaster()) >= (MAX_VISIBILITY_DISTANCE * 2);
|
targetObj->GetDistance(GetCaster()) >= (MAX_VISIBILITY_DISTANCE * 2);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targets.empty())
|
if (targets.empty())
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// Start channel visual and set self as unnattackable
|
// Start channel visual and set self as unnattackable
|
||||||
caster->ToCreature()->AI()->Talk(SAY_INSANITY);
|
caster->ToCreature()->AI()->Talk(SAY_INSANITY);
|
||||||
@@ -387,16 +384,12 @@ class spell_herald_volzaj_insanity : public SpellScript
|
|||||||
{
|
{
|
||||||
WorldObject* targetObj = *itr;
|
WorldObject* targetObj = *itr;
|
||||||
if (!targetObj)
|
if (!targetObj)
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
Player* plrTarget = targetObj->ToPlayer();
|
Player* plrTarget = targetObj->ToPlayer();
|
||||||
// This should never happen, spell has attribute SPELL_ATTR3_ONLY_TARGET_PLAYERS
|
// This should never happen, spell has attribute SPELL_ATTR3_ONLY_TARGET_PLAYERS
|
||||||
if (!plrTarget)
|
if (!plrTarget)
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
// phase mask
|
// phase mask
|
||||||
plrTarget->CastSpell(plrTarget, InsanitySpells.at(insanityCounter), true);
|
plrTarget->CastSpell(plrTarget, InsanitySpells.at(insanityCounter), true);
|
||||||
@@ -405,19 +398,17 @@ class spell_herald_volzaj_insanity : public SpellScript
|
|||||||
for (std::list<WorldObject*>::const_iterator itr2 = targets.begin(); itr2 != targets.end(); ++itr2)
|
for (std::list<WorldObject*>::const_iterator itr2 = targets.begin(); itr2 != targets.end(); ++itr2)
|
||||||
{
|
{
|
||||||
// Should not make clone of current player target
|
// Should not make clone of current player target
|
||||||
Player const* plrClone = *itr2 ? (*itr2)->ToPlayer() : nullptr;
|
Player* plrClone = *itr2 ? (*itr2)->ToPlayer() : nullptr;
|
||||||
if (!plrClone || plrClone == plrTarget)
|
if (!plrClone || plrClone == plrTarget || !plrClone->IsAlive())
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
if (Unit* summon = caster->SummonCreature(NPC_TWISTED_VISAGE, plrClone->GetPosition(), TEMPSUMMON_CORPSE_DESPAWN, 0))
|
if (Unit* summon = caster->SummonCreature(NPC_TWISTED_VISAGE, plrClone->GetPosition(), TEMPSUMMON_CORPSE_DESPAWN, 0))
|
||||||
{
|
{
|
||||||
|
plrClone->CastSpell(summon, SPELL_CLONE_PLAYER, true);
|
||||||
|
|
||||||
summon->AddThreat(plrTarget, 0.0f);
|
summon->AddThreat(plrTarget, 0.0f);
|
||||||
summon->SetInCombatWith(plrTarget);
|
summon->SetInCombatWith(plrTarget);
|
||||||
plrTarget->SetInCombatWith(summon);
|
plrTarget->SetInCombatWith(summon);
|
||||||
|
|
||||||
plrTarget->CastSpell(summon, SPELL_CLONE_PLAYER, true);
|
|
||||||
summon->SetPhaseMask(1 | (1 << (4 + insanityCounter)), true);
|
summon->SetPhaseMask(1 | (1 << (4 + insanityCounter)), true);
|
||||||
summon->SetUInt32Value(UNIT_FIELD_MINDAMAGE, plrClone->GetUInt32Value(UNIT_FIELD_MINDAMAGE));
|
summon->SetUInt32Value(UNIT_FIELD_MINDAMAGE, plrClone->GetUInt32Value(UNIT_FIELD_MINDAMAGE));
|
||||||
summon->SetUInt32Value(UNIT_FIELD_MAXDAMAGE, plrClone->GetUInt32Value(UNIT_FIELD_MAXDAMAGE));
|
summon->SetUInt32Value(UNIT_FIELD_MAXDAMAGE, plrClone->GetUInt32Value(UNIT_FIELD_MAXDAMAGE));
|
||||||
|
|||||||
Reference in New Issue
Block a user