mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-29 00:23:48 +00:00
fix(Scripts/Karazhan): Malchezaar infernals now spawn in the correct locations under the right conditions (#17237)
* initial test Co-authored-by: <100873791+Gultask@users.noreply.github.com> * change spawnMask * better failsafe * get list once * extend search range for relays * put infernal spawn in separate method for readability * add more methods * remove leftover method * dumb and dumber mistakes
This commit is contained in:
@@ -47,11 +47,13 @@ enum Spells
|
||||
|
||||
enum creatures
|
||||
{
|
||||
NPC_NETHERSPITE_INFERNAL = 17646,
|
||||
NPC_MALCHEZARS_AXE = 17650,
|
||||
INFERNAL_MODEL_INVISIBLE = 11686,
|
||||
SPELL_INFERNAL_RELAY = 33814, // 30835,
|
||||
EQUIP_ID_AXE = 33542
|
||||
NPC_NETHERSPITE_INFERNAL = 17646,
|
||||
NPC_MALCHEZAARS_AXE = 17650,
|
||||
INFERNAL_MODEL_INVISIBLE = 11686,
|
||||
SPELL_INFERNAL_RELAY = 33814, // 30835,
|
||||
SPELL_INFERNAL_RELAY_ONE = 30834,
|
||||
SPELL_INFERNAL_RELAY_TWO = 30835,
|
||||
EQUIP_ID_AXE = 33542
|
||||
};
|
||||
|
||||
enum EventGroups
|
||||
@@ -68,44 +70,19 @@ enum Phases
|
||||
PHASE_THREE = 3
|
||||
};
|
||||
|
||||
struct InfernalPoint
|
||||
{
|
||||
float x, y;
|
||||
};
|
||||
|
||||
#define INFERNAL_Z 275.5f
|
||||
|
||||
/*static InfernalPoint InfernalPoints[] =
|
||||
{
|
||||
{ -10922.8f, -1985.2f },
|
||||
{ -10916.2f, -1996.2f },
|
||||
{ -10932.2f, -2008.1f },
|
||||
{ -10948.8f, -2022.1f },
|
||||
{ -10958.7f, -1997.7f },
|
||||
{ -10971.5f, -1997.5f },
|
||||
{ -10990.8f, -1995.1f },
|
||||
{ -10989.8f, -1976.5f },
|
||||
{ -10971.6f, -1973.0f },
|
||||
{ -10955.5f, -1974.0f },
|
||||
{ -10939.6f, -1969.8f },
|
||||
{ -10958.0f, -1952.2f },
|
||||
{ -10941.7f, -1954.8f },
|
||||
{ -10943.1f, -1988.5f },
|
||||
{ -10948.8f, -2005.1f },
|
||||
{ -10984.0f, -2019.3f },
|
||||
{ -10932.8f, -1979.6f },
|
||||
{ -10935.7f, -1996.0f }
|
||||
};*/
|
||||
|
||||
struct boss_malchezaar : public BossAI
|
||||
{
|
||||
boss_malchezaar(Creature* creature) : BossAI(creature, DATA_MALCHEZZAR) { }
|
||||
boss_malchezaar(Creature* creature) : BossAI(creature, DATA_MALCHEZAAR) { }
|
||||
|
||||
std::list<Creature*> relays;
|
||||
std::list<Creature*> infernalTargets;
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
_phase = 1;
|
||||
clearweapons();
|
||||
positions.clear();
|
||||
relays.clear();
|
||||
infernalTargets.clear();
|
||||
instance->HandleGameObject(instance->GetGuidData(DATA_GO_NETHER_DOOR), true);
|
||||
}
|
||||
|
||||
@@ -145,7 +122,7 @@ struct boss_malchezaar : public BossAI
|
||||
_phase = PHASE_THREE;
|
||||
clearweapons();
|
||||
|
||||
me->SummonCreature(NPC_MALCHEZARS_AXE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
|
||||
me->SummonCreature(NPC_MALCHEZAARS_AXE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
|
||||
|
||||
scheduler.Schedule(20s, 30s, [this](TaskContext context)
|
||||
{
|
||||
@@ -174,10 +151,48 @@ struct boss_malchezaar : public BossAI
|
||||
instance->HandleGameObject(instance->GetGuidData(DATA_GO_NETHER_DOOR), true);
|
||||
}
|
||||
|
||||
void SpawnInfernal(Creature* relay, Creature* target)
|
||||
{
|
||||
if (Creature* infernal = relay->SummonCreature(NPC_NETHERSPITE_INFERNAL, target->GetPosition(), TEMPSUMMON_TIMED_DESPAWN, 180000))
|
||||
{
|
||||
infernal->SetDisplayId(INFERNAL_MODEL_INVISIBLE);
|
||||
relay->CastSpell(target, SPELL_INFERNAL_RELAY_TWO);
|
||||
relay->CastSpell(infernal, SPELL_INFERNAL_RELAY);
|
||||
infernal->SetFaction(me->GetFaction());
|
||||
infernal->SetControlled(true, UNIT_STATE_ROOT);
|
||||
relay->CastSpell(infernal, SPELL_INFERNAL_RELAY);
|
||||
summons.Summon(infernal);
|
||||
}
|
||||
}
|
||||
|
||||
bool MaxSpawns(std::list<Creature*> spawns)
|
||||
{
|
||||
return spawns.size() == 0;
|
||||
}
|
||||
|
||||
Creature* PickTarget(std::list<Creature*> pickList)
|
||||
{
|
||||
uint8 index = urand(0, pickList.size()-1);
|
||||
uint8 counter = 0;
|
||||
for (Creature* creature : pickList)
|
||||
{
|
||||
if (counter == index)
|
||||
{
|
||||
return creature;
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void JustEngagedWith(Unit* /*who*/) override
|
||||
{
|
||||
Talk(SAY_AGGRO);
|
||||
_JustEngagedWith();
|
||||
|
||||
me->GetCreaturesWithEntryInRange(relays, 250.0f, NPC_INFERNAL_RELAY);
|
||||
me->GetCreaturesWithEntryInRange(infernalTargets, 100.0f, NPC_INFERNAL_TARGET);
|
||||
|
||||
instance->HandleGameObject(instance->GetGuidData(DATA_GO_NETHER_DOOR), false);
|
||||
|
||||
scheduler.Schedule(30s, [this](TaskContext context)
|
||||
@@ -199,23 +214,30 @@ struct boss_malchezaar : public BossAI
|
||||
context.Repeat();
|
||||
}).Schedule(40s, [this](TaskContext context)
|
||||
{
|
||||
Position pos = me->GetRandomNearPosition(40.0);;
|
||||
|
||||
if (Creature* RELAY = me->FindNearestCreature(NPC_RELAY, 100.0f))
|
||||
if (!MaxSpawns(infernalTargets)) // only spawn infernal when the area is not full
|
||||
{
|
||||
if (Creature* infernal = RELAY->SummonCreature(NPC_NETHERSPITE_INFERNAL, pos, TEMPSUMMON_TIMED_DESPAWN, 180000))
|
||||
Talk(SAY_SUMMON);
|
||||
if (Creature* infernalRelayOne = relays.back())
|
||||
{
|
||||
infernal->SetDisplayId(INFERNAL_MODEL_INVISIBLE);
|
||||
infernal->SetFaction(me->GetFaction());
|
||||
infernal->SetControlled(true, UNIT_STATE_ROOT);
|
||||
RELAY->AI()->DoCast(infernal, SPELL_INFERNAL_RELAY);
|
||||
summons.Summon(infernal);
|
||||
if (Creature* infernalRelayTwo = relays.front())
|
||||
{
|
||||
infernalRelayOne->CastSpell(infernalRelayTwo, SPELL_INFERNAL_RELAY_ONE, true);
|
||||
|
||||
if (Creature* infernalTarget = PickTarget(infernalTargets))
|
||||
{
|
||||
infernalTargets.remove(infernalTarget);
|
||||
SpawnInfernal(infernalRelayTwo, infernalTarget);
|
||||
|
||||
scheduler.Schedule(3min, [this, infernalTarget](TaskContext)
|
||||
{
|
||||
infernalTargets.push_back(infernalTarget); //adds to list again
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
context.Repeat(_phase == PHASE_THREE ? 15s : 45s);
|
||||
|
||||
Talk(SAY_SUMMON);
|
||||
}).Schedule(20s, [this](TaskContext context)
|
||||
{
|
||||
DoCastVictim(SPELL_SHADOW_WORD_PAIN);
|
||||
@@ -261,7 +283,6 @@ struct boss_malchezaar : public BossAI
|
||||
private:
|
||||
uint32 _phase;
|
||||
std::map<ObjectGuid, uint32> _enfeebleTargets;
|
||||
std::vector<InfernalPoint*> positions;
|
||||
};
|
||||
|
||||
struct npc_netherspite_infernal : public ScriptedAI
|
||||
|
||||
@@ -37,7 +37,7 @@ enum KZDataTypes
|
||||
DATA_TERESTIAN = 7,
|
||||
DATA_NETHERSPITE = 8,
|
||||
DATA_CHESS_EVENT = 9,
|
||||
DATA_MALCHEZZAR = 10,
|
||||
DATA_MALCHEZAAR = 10,
|
||||
DATA_NIGHTBANE = 11,
|
||||
DATA_SERVANT_QUARTERS = 12,
|
||||
DATA_OPERA_OZ_DEATHCOUNT = 13,
|
||||
@@ -132,7 +132,12 @@ enum KZCreatures
|
||||
NPC_ROOK_A = 21160,
|
||||
NPC_KING_H = 21752,
|
||||
NPC_KING_A = 21684,
|
||||
NPC_CHESS_EVENT_MEDIVH_CHEAT_FIRES = 22521
|
||||
NPC_CHESS_EVENT_MEDIVH_CHEAT_FIRES = 22521,
|
||||
|
||||
// Malchezaar Helpers
|
||||
NPC_INFERNAL_TARGET = 17644,
|
||||
NPC_INFERNAL_RELAY = 17645
|
||||
|
||||
};
|
||||
|
||||
enum KZGameObjectIds
|
||||
|
||||
Reference in New Issue
Block a user