refactor(Scripts/TheBotanica): Modernize Thorngrin the Tender's script (#15277)
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
--
|
||||||
|
UPDATE `creature_template` SET `ScriptName` = 'boss_thorngrin_the_tender' WHERE `entry` = 17978;
|
||||||
@@ -39,24 +39,16 @@ enum Spells
|
|||||||
SPELL_ENRAGE = 34670
|
SPELL_ENRAGE = 34670
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Events
|
struct boss_thorngrin_the_tender : public BossAI
|
||||||
{
|
{
|
||||||
EVENT_SACRIFICE = 1,
|
boss_thorngrin_the_tender(Creature* creature) : BossAI(creature, DATA_THORNGRIN_THE_TENDER)
|
||||||
EVENT_HELLFIRE = 2,
|
|
||||||
EVENT_ENRAGE = 3,
|
|
||||||
};
|
|
||||||
|
|
||||||
class boss_thorngrin_the_tender : public CreatureScript
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
boss_thorngrin_the_tender() : CreatureScript("thorngrin_the_tender") { }
|
|
||||||
|
|
||||||
struct boss_thorngrin_the_tenderAI : public BossAI
|
|
||||||
{
|
|
||||||
boss_thorngrin_the_tenderAI(Creature* creature) : BossAI(creature, DATA_THORNGRIN_THE_TENDER)
|
|
||||||
{
|
{
|
||||||
me->m_SightDistance = 100.0f;
|
me->m_SightDistance = 100.0f;
|
||||||
_intro = false;
|
_intro = false;
|
||||||
|
scheduler.SetValidator([this]
|
||||||
|
{
|
||||||
|
return !me->HasUnitState(UNIT_STATE_CASTING);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Reset() override
|
void Reset() override
|
||||||
@@ -72,7 +64,7 @@ public:
|
|||||||
|
|
||||||
void MoveInLineOfSight(Unit* who) override
|
void MoveInLineOfSight(Unit* who) override
|
||||||
{
|
{
|
||||||
if (!_intro && who->GetTypeId() == TYPEID_PLAYER)
|
if (!_intro && who->IsPlayer())
|
||||||
{
|
{
|
||||||
_intro = true;
|
_intro = true;
|
||||||
Talk(SAY_INTRO);
|
Talk(SAY_INTRO);
|
||||||
@@ -84,16 +76,35 @@ public:
|
|||||||
{
|
{
|
||||||
_JustEngagedWith();
|
_JustEngagedWith();
|
||||||
Talk(SAY_AGGRO);
|
Talk(SAY_AGGRO);
|
||||||
events.ScheduleEvent(EVENT_SACRIFICE, 6000);
|
|
||||||
events.ScheduleEvent(EVENT_HELLFIRE, 18000);
|
scheduler.Schedule(6s, [this](TaskContext context)
|
||||||
events.ScheduleEvent(EVENT_ENRAGE, 15000);
|
{
|
||||||
|
if (DoCastRandomTarget(SPELL_SACRIFICE, 1) == SPELL_CAST_OK)
|
||||||
|
{
|
||||||
|
Talk(SAY_CAST_SACRIFICE);
|
||||||
|
}
|
||||||
|
context.Repeat(30s);
|
||||||
|
}).Schedule(18s, [this](TaskContext context)
|
||||||
|
{
|
||||||
|
if (roll_chance_i(50))
|
||||||
|
Talk(SAY_CAST_HELLFIRE);
|
||||||
|
DoCastAOE(SPELL_HELLFIRE);
|
||||||
|
context.Repeat(22s);
|
||||||
|
}).Schedule(15s, [this](TaskContext context)
|
||||||
|
{
|
||||||
|
Talk(EMOTE_ENRAGE);
|
||||||
|
DoCastSelf(SPELL_ENRAGE);
|
||||||
|
context.Repeat(30s);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void KilledUnit(Unit* victim) override
|
void KilledUnit(Unit* victim) override
|
||||||
{
|
{
|
||||||
if (victim->GetTypeId() == TYPEID_PLAYER)
|
if (victim->IsPlayer())
|
||||||
|
{
|
||||||
Talk(SAY_KILL);
|
Talk(SAY_KILL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void JustDied(Unit* /*killer*/) override
|
void JustDied(Unit* /*killer*/) override
|
||||||
{
|
{
|
||||||
@@ -101,52 +112,11 @@ public:
|
|||||||
Talk(SAY_DEATH);
|
Talk(SAY_DEATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateAI(uint32 diff) override
|
|
||||||
{
|
|
||||||
if (!UpdateVictim())
|
|
||||||
return;
|
|
||||||
|
|
||||||
events.Update(diff);
|
|
||||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
|
||||||
return;
|
|
||||||
|
|
||||||
switch (events.ExecuteEvent())
|
|
||||||
{
|
|
||||||
case EVENT_SACRIFICE:
|
|
||||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true))
|
|
||||||
{
|
|
||||||
Talk(SAY_CAST_SACRIFICE);
|
|
||||||
me->CastSpell(target, SPELL_SACRIFICE, false);
|
|
||||||
}
|
|
||||||
events.ScheduleEvent(EVENT_SACRIFICE, 30000);
|
|
||||||
break;
|
|
||||||
case EVENT_HELLFIRE:
|
|
||||||
if (roll_chance_i(50))
|
|
||||||
Talk(SAY_CAST_HELLFIRE);
|
|
||||||
me->CastSpell(me, SPELL_HELLFIRE, false);
|
|
||||||
events.ScheduleEvent(EVENT_HELLFIRE, 22000);
|
|
||||||
break;
|
|
||||||
case EVENT_ENRAGE:
|
|
||||||
Talk(EMOTE_ENRAGE);
|
|
||||||
me->CastSpell(me, SPELL_ENRAGE, false);
|
|
||||||
events.ScheduleEvent(EVENT_ENRAGE, 30000);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
DoMeleeAttackIfReady();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _intro;
|
bool _intro;
|
||||||
};
|
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* creature) const override
|
|
||||||
{
|
|
||||||
return GetTheBotanicaAI<boss_thorngrin_the_tenderAI>(creature);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddSC_boss_thorngrin_the_tender()
|
void AddSC_boss_thorngrin_the_tender()
|
||||||
{
|
{
|
||||||
new boss_thorngrin_the_tender();
|
RegisterTheBotanicaCreatureAI(boss_thorngrin_the_tender);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user