TrinityCore
zone_duskwood.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18/* ScriptData
19SDName: Duskwood
20SD%Complete: 100
21SDComment: Quest Support:8735
22SDCategory: Duskwood
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "ScriptedCreature.h"
27#include "Player.h"
28#include "TemporarySummon.h"
29
31{
36
40
43
45};
46
47/*######
48# boss_twilight_corrupter
49######*/
50
52{
53public:
54 boss_twilight_corrupter() : CreatureScript("boss_twilight_corrupter") { }
55
57 {
59 {
60 Initialize();
61 }
62
64 {
65 KillCount = 0;
66 }
67
68 void Reset() override
69 {
70 _events.Reset();
71 Initialize();
72 }
73
74 void JustEngagedWith(Unit* /*who*/) override
75 {
79 }
80
81 void KilledUnit(Unit* victim) override
82 {
83 if (victim->GetTypeId() == TYPEID_PLAYER)
84 {
85 ++KillCount;
87
88 if (KillCount == 3)
89 {
90 DoCast(me, SPELL_LEVEL_UP, true);
91 KillCount = 0;
92 }
93 }
94 }
95
96 void UpdateAI(uint32 diff) override
97 {
98 if (!UpdateVictim())
99 return;
100
101 _events.Update(diff);
102
104 return;
105
106 while (uint32 eventId = _events.ExecuteEvent())
107 {
108 switch (eventId)
109 {
113 break;
115 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
118 break;
119 default:
120 break;
121 }
122 }
123 }
124
125 private:
128 };
129
130 CreatureAI* GetAI(Creature* creature) const override
131 {
132 return new boss_twilight_corrupterAI(creature);
133 }
134};
135
136/*######
137# at_twilight_grove
138######*/
139
140Position const TwillightCorrupter = { -10328.16f, -489.57f, 49.95f, 0.0f };
141
143{
144 public:
145 at_twilight_grove() : AreaTriggerScript("at_twilight_grove") { }
146
147 bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) override
148 {
150 if (!player->FindNearestCreature(NPC_TWILIGHT_CORRUPTER, 500.0f, true))
152 corrupter->AI()->Talk(YELL_TWILIGHT_CORRUPTOR_RESPAWN, player);
153
154 return false;
155 };
156};
157
159{
161 new at_twilight_grove();
162}
uint8_t uint8
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:142
@ TEMPSUMMON_MANUAL_DESPAWN
Definition: ObjectDefines.h:70
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
@ QUEST_STATUS_INCOMPLETE
Definition: QuestDef.h:145
@ UNIT_STATE_CASTING
Definition: Unit.h:270
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void Reset()
Definition: EventMap.cpp:21
TypeID GetTypeId() const
Definition: Object.h:173
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition: Player.cpp:16050
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:79
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition: Object.cpp:2025
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2148
bool OnTrigger(Player *player, AreaTriggerEntry const *) override
CreatureAI * GetAI(Creature *creature) const override
TwilightCorrupter
@ EVENT_SOUL_CORRUPTION
@ YELL_TWILIGHT_CORRUPTOR_KILL
@ SPELL_CREATURE_OF_NIGHTMARE
@ QUEST_NIGHTMARES_CORRUPTION
@ YELL_TWILIGHT_CORRUPTOR_AGGRO
@ EVENT_CREATURE_OF_NIGHTMARE
@ YELL_TWILIGHT_CORRUPTOR_RESPAWN
@ SPELL_SOUL_CORRUPTION
@ SPELL_LEVEL_UP
@ NPC_TWILIGHT_CORRUPTER
void AddSC_duskwood()
Position const TwillightCorrupter