mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-09 08:17:56 +00:00
fix(Script/Quest): Arelion's Secret. Add combat sequence to Magister … (#15878)
* fix(Script/Quest): Arelion's Secret. Add combat sequence to Magister Aledis Co-authored-by: SnapperRy * Use single quotes for SQL * Update based on review comments Co-authored-by: SnapperRy <snapperryen@gmail.com>
This commit is contained in:
committed by
GitHub
parent
c3c6ce9d7a
commit
23a420acbb
@@ -0,0 +1,9 @@
|
|||||||
|
--
|
||||||
|
UPDATE `creature_template` SET `ScriptName` = 'npc_magister_aledis' WHERE `entry` = 20159;
|
||||||
|
|
||||||
|
-- Gossip to start combat vs event completion and quest reward
|
||||||
|
UPDATE `conditions` SET `ConditionTypeOrReference`=28, `Comment`='Show gossip option 0 if player has quest Arelion\'s Secret completed OR' WHERE `SourceGroup`=8081 AND `ElseGroup`=0;
|
||||||
|
|
||||||
|
DELETE FROM `conditions` WHERE `SourceGroup`=8081 AND `ElseGroup`=1;
|
||||||
|
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
|
||||||
|
(15, 8081, 0, 0, 1, 8, 0, 10286, 0, 0, 0, 0, 0, '', 'Show gossip option 0 if player has quest Arelion\'s Secret rewarded');
|
||||||
@@ -397,6 +397,113 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum Aledis
|
||||||
|
{
|
||||||
|
SAY_CHALLENGE = 0,
|
||||||
|
SAY_DEFEATED = 1,
|
||||||
|
EVENT_TALK = 1,
|
||||||
|
EVENT_ATTACK = 2,
|
||||||
|
EVENT_EVADE = 3,
|
||||||
|
EVENT_FIREBALL = 4,
|
||||||
|
EVENT_FROSTNOVA = 5,
|
||||||
|
SPELL_FIREBALL = 20823,
|
||||||
|
SPELL_FROSTNOVA = 11831,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct npc_magister_aledis : public ScriptedAI
|
||||||
|
{
|
||||||
|
npc_magister_aledis(Creature* creature) : ScriptedAI(creature) { }
|
||||||
|
|
||||||
|
void StartFight(Player* player)
|
||||||
|
{
|
||||||
|
me->Dismount();
|
||||||
|
me->SetFacingToObject(player);
|
||||||
|
me->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||||
|
_playerGUID = player->GetGUID();
|
||||||
|
_events.ScheduleEvent(EVENT_TALK, 2s);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Reset() override
|
||||||
|
{
|
||||||
|
me->RestoreFaction();
|
||||||
|
me->RemoveNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
|
||||||
|
me->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||||
|
me->SetImmuneToPC(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellSchoolMask /*spellInfo = nullptr*/) override
|
||||||
|
{
|
||||||
|
if (damage > me->GetHealth() || me->HealthBelowPctDamaged(20, damage))
|
||||||
|
{
|
||||||
|
damage = 0;
|
||||||
|
|
||||||
|
_events.Reset();
|
||||||
|
me->RestoreFaction();
|
||||||
|
me->RemoveAllAuras();
|
||||||
|
me->GetThreatMgr().ClearAllThreat();
|
||||||
|
me->CombatStop(true);
|
||||||
|
me->SetNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
|
||||||
|
me->SetImmuneToPC(true);
|
||||||
|
Talk(SAY_DEFEATED);
|
||||||
|
|
||||||
|
_events.ScheduleEvent(EVENT_EVADE, 1min);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateAI(uint32 diff) override
|
||||||
|
{
|
||||||
|
_events.Update(diff);
|
||||||
|
|
||||||
|
while (uint32 eventId = _events.ExecuteEvent())
|
||||||
|
{
|
||||||
|
switch (eventId)
|
||||||
|
{
|
||||||
|
case EVENT_TALK:
|
||||||
|
Talk(SAY_CHALLENGE);
|
||||||
|
_events.ScheduleEvent(EVENT_ATTACK, 2s);
|
||||||
|
break;
|
||||||
|
case EVENT_ATTACK:
|
||||||
|
me->SetImmuneToPC(false);
|
||||||
|
me->SetFaction(FACTION_MONSTER);
|
||||||
|
if (Player* player = ObjectAccessor::GetPlayer(*me, _playerGUID))
|
||||||
|
{
|
||||||
|
AttackStart(player);
|
||||||
|
}
|
||||||
|
_events.ScheduleEvent(EVENT_FIREBALL, 1ms);
|
||||||
|
_events.ScheduleEvent(EVENT_FROSTNOVA, 5s);
|
||||||
|
break;
|
||||||
|
case EVENT_FIREBALL:
|
||||||
|
DoCast(SPELL_FIREBALL);
|
||||||
|
_events.ScheduleEvent(EVENT_FIREBALL, 10s);
|
||||||
|
break;
|
||||||
|
case EVENT_FROSTNOVA:
|
||||||
|
DoCastAOE(SPELL_FROSTNOVA);
|
||||||
|
_events.ScheduleEvent(EVENT_FROSTNOVA, 20s);
|
||||||
|
break;
|
||||||
|
case EVENT_EVADE:
|
||||||
|
EnterEvadeMode();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (UpdateVictim())
|
||||||
|
{
|
||||||
|
DoMeleeAttackIfReady();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sGossipSelect(Player* player, uint32 /*sender*/, uint32 /*action*/) override
|
||||||
|
{
|
||||||
|
CloseGossipMenuFor(player);
|
||||||
|
me->StopMoving();
|
||||||
|
StartFight(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
EventMap _events;
|
||||||
|
ObjectGuid _playerGUID;
|
||||||
|
};
|
||||||
|
|
||||||
enum Beacon
|
enum Beacon
|
||||||
{
|
{
|
||||||
NPC_STONESCHYE_WHELP = 16927,
|
NPC_STONESCHYE_WHELP = 16927,
|
||||||
@@ -464,4 +571,6 @@ void AddSC_hellfire_peninsula()
|
|||||||
new npc_wounded_blood_elf();
|
new npc_wounded_blood_elf();
|
||||||
new npc_fel_guard_hound();
|
new npc_fel_guard_hound();
|
||||||
new go_beacon();
|
new go_beacon();
|
||||||
|
|
||||||
|
RegisterCreatureAI(npc_magister_aledis);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user