TrinityCore
blackfathom_deeps.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#include "ScriptMgr.h"
19#include "blackfathom_deeps.h"
20#include "InstanceScript.h"
21#include "GameObject.h"
22#include "GameObjectAI.h"
23#include "Player.h"
24#include "ScriptedEscortAI.h"
25#include "SpellScript.h"
26
28{
34};
35
37{
39
40 bool OnGossipHello(Player* player) override
41 {
44 return true;
45 }
46};
47
49{
50 go_blackfathom_fire(GameObject* go) : GameObjectAI(go), instance(go->GetInstanceScript()) { }
51
53
54 bool OnGossipHello(Player* /*player*/) override
55 {
59 return true;
60 }
61};
62
64{
68};
69
71{
72 npc_blackfathom_deeps_event(Creature* creature) : ScriptedAI(creature), _instance(me->GetInstanceScript()), _flee(false) { }
73
74 void JustEngagedWith(Unit* /*who*/) override
75 {
76 _flee = false;
77
78 switch (me->GetEntry())
79 {
82 break;
86 break;
87 default:
88 break;
89 }
90 }
91
92 void EnterEvadeMode(EvadeReason why) override
93 {
94 _events.Reset();
96 }
97
98 void IsSummonedBy(WorldObject* /*summoner*/) override
99 {
101 }
102
103 void JustDied(Unit* /*killer*/) override
104 {
105 if (me->IsSummon()) //we are not a normal spawn.
107 }
108
109 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
110 {
112 return;
113
114 if (!_flee && me->HealthBelowPctDamaged(15, damage))
115 {
116 _flee = true;
118 }
119 }
120
121 void UpdateAI(uint32 diff) override
122 {
123 if (!UpdateVictim())
124 return;
125
126 _events.Update(diff);
127
129 return;
130
131 while (uint32 eventId = _events.ExecuteEvent())
132 {
133 switch (eventId)
134 {
135 case EVENT_RAVAGE:
137 _events.Repeat(9s, 14s);
138 break;
139 case EVENT_FROST_NOVA:
141 _events.Repeat(25s, 30s);
142 break;
146 _events.Repeat(5s, 8s);
147 break;
148 default:
149 break;
150 }
151 }
152 }
153
154private:
157 bool _flee;
158};
159
161{
164
166};
167
168struct npc_morridune : public EscortAI
169{
170 npc_morridune(Creature* creature) : EscortAI(creature) { }
171
172 void Reset() override
173 {
177 Start(false);
178 }
179
180 void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
181 {
182 switch (waypointId)
183 {
184 case 4:
185 SetEscortPaused(true);
186 me->SetFacingTo(1.775791f);
189 break;
190 }
191 }
192
193 bool OnGossipSelect(Player* player, uint32 /*menuId*/, uint32 /*gossipListId*/) override
194 {
196 return false;
197 }
198};
199
200// 151159 - Darkness Calls
202{
203public:
204 spell_subjugator_korul_darkness_calls() : SpellScriptLoader("spell_subjugator_korul_darkness_calls") { }
205
207 {
208 void HandleScript(SpellEffIndex /*effIndex*/)
209 {
210 if (Unit* hitUnit = GetHitUnit())
211 GetCaster()->CastSpell(hitUnit, uint32(GetEffectValue()), true);
212 }
213
214 void Register() override
215 {
218 }
219 };
220
221 SpellScript* GetSpellScript() const override
222 {
224 }
225};
226
228{
234}
uint32_t uint32
Definition: Define.h:142
Spells
Definition: PlayerAI.cpp:32
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_1
Definition: SharedDefines.h:31
@ EFFECT_0
Definition: SharedDefines.h:30
@ SPELL_EFFECT_DUMMY
@ GO_FLAG_NOT_SELECTABLE
@ GO_STATE_ACTIVE
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
EvadeReason
Definition: UnitAICommon.h:30
@ UNIT_NPC_FLAG_GOSSIP
Definition: UnitDefines.h:297
DamageEffectType
Definition: UnitDefines.h:131
@ UNIT_STATE_CASTING
Definition: Unit.h:270
@ SAY_MORRIDUNE_2
@ PATH_ESCORT_MORRIDUNE
@ SAY_MORRIDUNE_1
void AddSC_blackfathom_deeps()
@ SPELL_TELEPORT_DARNASSUS
@ SPELL_RAVAGE
@ SPELL_BLESSING_OF_BLACKFATHOM
@ SPELL_FROST_NOVA
@ SPELL_FROST_BOLT_VOLLEY
@ EVENT_FROST_NOVA
@ EVENT_RAVAGE
@ EVENT_FROST_BOLT_VOLLEY
#define RegisterBlackfathomDeepsGameObjectAI(ai_name)
@ NPC_BARBED_CRUSTACEAN
@ NPC_AKU_MAI_SERVANT
@ NPC_MURKSHALLOW_SOFTSHELL
@ NPC_AKU_MAI_SNAPJAW
#define RegisterBlackfathomDeepsCreatureAI(ai_name)
@ DATA_EVENT
@ DATA_FIRE
void DoZoneInCombat()
Definition: CreatureAI.h:161
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
Definition: CreatureAI.cpp:219
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
void DoFleeToGetAssistance()
Definition: Creature.cpp:1002
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void Repeat(Milliseconds time)
Definition: EventMap.cpp:63
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void Reset()
Definition: EventMap.cpp:21
GameObject *const me
Definition: GameObjectAI.h:50
void SetGoState(GOState state)
void SetFlag(GameObjectFlags flags)
Definition: GameObject.h:274
uint32 GetEntry() const
Definition: Object.h:161
Unit * GetCaster() const
Unit * GetHitUnit() const
int32 GetEffectValue() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
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
Aura * AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:11618
void RemoveNpcFlag(NPCFlags flags)
Definition: Unit.h:983
bool IsSummon() const
Definition: Unit.h:738
void SetNpcFlag(NPCFlags flags)
Definition: Unit.h:982
void SetFacingTo(float const ori, bool force=true)
Definition: Unit.cpp:12653
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4664
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition: Unit.h:781
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
virtual uint32 GetData(uint32) const
Definition: ZoneScript.h:91
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:92
SpellScript * GetSpellScript() const override
void Start(bool isActiveAttacker=true, ObjectGuid playerGUID=ObjectGuid::Empty, Quest const *quest=nullptr, bool instantRespawn=false, bool canLoopPath=false)
void LoadPath(uint32 pathId)
void SetEscortPaused(bool on)
bool OnGossipHello(Player *player) override
go_blackfathom_altar(GameObject *go)
bool OnGossipHello(Player *) override
InstanceScript * instance
go_blackfathom_fire(GameObject *go)
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void IsSummonedBy(WorldObject *) override
npc_blackfathom_deeps_event(Creature *creature)
void JustEngagedWith(Unit *) override
void EnterEvadeMode(EvadeReason why) override
void UpdateAI(uint32 diff) override
void JustDied(Unit *) override
void WaypointReached(uint32 waypointId, uint32) override
bool OnGossipSelect(Player *player, uint32, uint32) override
void Reset() override
npc_morridune(Creature *creature)