fix(Scripts/Karazhan): Fix Terestrian Illhoof not summoning any imps (#17297)

* fix(Scripts/Karazhan): Fix Terestrian Illhoof not summoning any imps

* Update rev_1695008245587651800.sql

* Update boss_terestian_illhoof.cpp

* make kilrek immune to enslave demon
This commit is contained in:
Skjalf
2023-09-18 15:54:52 -03:00
committed by GitHub
parent f9b0eea0fd
commit 5b3c5740fb
4 changed files with 36 additions and 128 deletions

View File

@@ -52,7 +52,6 @@ enum Spells
enum Creatures
{
NPC_DEMONCHAINS = 17248,
NPC_FIENDISHIMP = 17267,
NPC_PORTAL = 17265
};
@@ -146,64 +145,6 @@ private:
ObjectGuid sacrificeGUID;
};
struct npc_fiendish_portal : public PassiveAI
{
npc_fiendish_portal(Creature* creature) : PassiveAI(creature), summons(me) {}
void Reset() override
{
DespawnAllImp();
}
void JustSummoned(Creature* summon) override
{
summons.Summon(summon);
DoZoneInCombat(summon);
}
void DespawnAllImp()
{
summons.DespawnAll();
}
private:
SummonList summons;
};
struct npc_fiendish_imp : public ScriptedAI
{
npc_fiendish_imp(Creature* creature) : ScriptedAI(creature) {}
void Reset() override
{
_scheduler.CancelAll();
}
void JustEngagedWith(Unit* /*who*/) override
{
_scheduler.Schedule(2s, [this](TaskContext context)
{
DoCastVictim(SPELL_FIREBOLT);
context.Repeat(2200ms);
});
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
_scheduler.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
DoMeleeAttackIfReady();
}
private:
TaskScheduler _scheduler;
};
struct boss_terestian_illhoof : public BossAI
{
boss_terestian_illhoof(Creature* creature) : BossAI(creature, DATA_TERESTIAN)
@@ -218,20 +159,6 @@ struct boss_terestian_illhoof : public BossAI
{
_Reset();
SummonKilrek();
portalsCount = 0;
berserk = false;
for (uint8 i = 0; i < 2; ++i)
{
if (portalGUID[i])
{
if (Creature* pPortal = ObjectAccessor::GetCreature(*me, portalGUID[i]))
{
pPortal->AI()->Reset();
pPortal->DespawnOrUnsummon();
}
portalGUID[i].Clear();
}
}
}
void SummonKilrek()
@@ -267,31 +194,15 @@ struct boss_terestian_illhoof : public BossAI
{
DoCastVictim(SPELL_SHADOW_BOLT);
context.Repeat(10s);
}).Schedule(10s, [this](TaskContext context)
}).Schedule(10s, [this](TaskContext)
{
if (!portalGUID[0])
{
DoCastVictim(SPELL_FIENDISH_PORTAL);
}
if (!portalGUID[1])
{
DoCastVictim(SPELL_FIENDISH_PORTAL_1);
}
if (portalGUID[0] && portalGUID[1])
{
if (Creature* pPortal = ObjectAccessor::GetCreature(*me, portalGUID[urand(0, 1)]))
{
pPortal->CastSpell(me->GetVictim(), SPELL_SUMMON_FIENDISIMP);
}
context.Repeat(5s);
}
DoCastAOE(SPELL_FIENDISH_PORTAL);
}).Schedule(11s, [this](TaskContext)
{
DoCastAOE(SPELL_FIENDISH_PORTAL_1);
}).Schedule(10min, [this](TaskContext /*context*/)
{
if (!berserk)
{
DoCastSelf(SPELL_BERSERK);
berserk = true;
}
DoCastSelf(SPELL_BERSERK);
});
}
@@ -299,13 +210,14 @@ struct boss_terestian_illhoof : public BossAI
{
if (summoned->GetEntry() == NPC_PORTAL)
{
portalGUID[portalsCount] = summoned->GetGUID();
++portalsCount;
summoned->SetReactState(REACT_PASSIVE);
if (summoned->GetUInt32Value(UNIT_CREATED_BY_SPELL) == SPELL_FIENDISH_PORTAL_1)
{
Talk(SAY_SUMMON);
}
}
summons.Summon(summoned);
}
void KilledUnit(Unit* victim) override
@@ -318,44 +230,14 @@ struct boss_terestian_illhoof : public BossAI
void JustDied(Unit* /*killer*/) override
{
_JustDied();
Talk(SAY_DEATH);
for (uint8 i = 0; i < 2; ++i)
{
if (portalGUID[i])
{
if (Creature* pPortal = ObjectAccessor::GetCreature((*me), portalGUID[i]))
{
pPortal->AI()->Reset();
pPortal->DespawnOrUnsummon();
}
portalGUID[i].Clear();
}
}
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
scheduler.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
DoMeleeAttackIfReady();
}
private:
bool berserk;
ObjectGuid portalGUID[2];
uint8 portalsCount;
};
void AddSC_boss_terestian_illhoof()
{
RegisterKarazhanCreatureAI(boss_terestian_illhoof);
RegisterKarazhanCreatureAI(npc_fiendish_imp);
RegisterKarazhanCreatureAI(npc_fiendish_portal);
RegisterKarazhanCreatureAI(npc_kilrek);
RegisterKarazhanCreatureAI(npc_demon_chain);
}

View File

@@ -44,6 +44,7 @@ ObjectData const creatureData[] =
{ NPC_ROMULO, DATA_ROMULO },
{ NPC_JULIANNE, DATA_JULIANNE },
{ NPC_NIGHTBANE, DATA_NIGHTBANE },
{ NPC_TERESTIAN_ILLHOOF, DATA_TERESTIAN },
{ 0, 0 }
};
@@ -122,6 +123,16 @@ public:
case NPC_ECHO_OF_MEDIVH:
_echoOfMedivhGUID = creature->GetGUID();
break;
case NPC_FIENDISH_IMP:
if (Creature* terestrian = GetCreature(DATA_TERESTIAN))
{
if (terestrian->AI())
{
terestrian->AI()->JustSummoned(creature);
creature->SetInCombatWithZone();
}
}
break;
default:
break;
}

View File

@@ -117,6 +117,7 @@ enum KZCreatures
NPC_ROAR = 17546,
NPC_STRAWMAN = 17543,
NPC_TINHEAD = 17547,
NPC_FIENDISH_IMP = 17267,
// Chess Event
NPC_ECHO_OF_MEDIVH = 16816,