TrinityCore
Loading...
Searching...
No Matches
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 "Map.h"
24#include "Player.h"
25#include "ScriptedEscortAI.h"
26#include "ScriptedGossip.h"
27
36
37const Position HomePosition = {-815.817f, -145.299f, -25.870f, 0};
38
40{
42
43 bool OnGossipHello(Player* player) override
44 {
47 return true;
48 }
49};
50
52{
53 go_blackfathom_fire(GameObject* go) : GameObjectAI(go), instance(go->GetInstanceScript()) { }
54
56
57 bool OnGossipHello(Player* /*player*/) override
58 {
62 return true;
63 }
64};
65
72
74{
75 npc_blackfathom_deeps_event(Creature* creature) : ScriptedAI(creature), _instance(me->GetInstanceScript()), _flee(false) { }
76
77 void JustEngagedWith(Unit* /*who*/) override
78 {
79 _flee = false;
80
81 switch (me->GetEntry())
82 {
85 break;
89 break;
90 default:
91 break;
92 }
93 }
94
95 void EnterEvadeMode(EvadeReason why) override
96 {
97 _events.Reset();
99 }
100
101 void IsSummonedBy(WorldObject* /*summoner*/) override
102 {
104 }
105
106 void JustDied(Unit* /*killer*/) override
107 {
108 if (me->IsSummon()) //we are not a normal spawn.
110 }
111
112 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
113 {
115 return;
116
117 if (!_flee && me->HealthBelowPctDamaged(15, damage))
118 {
119 _flee = true;
121 }
122 }
123
124 void UpdateAI(uint32 diff) override
125 {
126 if (!UpdateVictim())
127 return;
128
129 _events.Update(diff);
130
132 return;
133
134 while (uint32 eventId = _events.ExecuteEvent())
135 {
136 switch (eventId)
137 {
138 case EVENT_RAVAGE:
140 _events.Repeat(9s, 14s);
141 break;
142 case EVENT_FROST_NOVA:
144 _events.Repeat(25s, 30s);
145 break;
149 _events.Repeat(5s, 8s);
150 break;
151 default:
152 break;
153 }
154 }
155
157 }
158
159private:
162 bool _flee;
163};
164
172
173struct npc_morridune : public EscortAI
174{
175 npc_morridune(Creature* creature) : EscortAI(creature) { }
176
177 void Reset() override
178 {
182 Start(false);
183 }
184
185 void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
186 {
187 switch (waypointId)
188 {
189 case 4:
190 SetEscortPaused(true);
191 me->SetFacingTo(1.775791f);
194 break;
195 }
196 }
197
198 bool OnGossipSelect(Player* player, uint32 /*menuId*/, uint32 /*gossipListId*/) override
199 {
201 return false;
202 }
203};
204
uint32_t uint32
Definition Define.h:133
Spells
Definition PlayerAI.cpp:32
@ GO_FLAG_NOT_SELECTABLE
@ GO_STATE_ACTIVE
@ UNIT_NPC_FLAG_GOSSIP
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
@ 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
const Position HomePosition
@ 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(Creature *creature=nullptr)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
void DoFleeToGetAssistance()
Definition Creature.cpp:973
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
void Reset()
Definition EventMap.cpp:21
GameObject *const me
void SetGoState(GOState state)
void SetFlag(GameObjectFlags flags)
Definition GameObject.h:171
uint32 GetEntry() const
Definition Object.h:81
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:243
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
Aura * AddAura(uint32 spellId, Unit *target)
Definition Unit.cpp:11964
void RemoveNpcFlag(NPCFlags flags)
Definition Unit.h:1098
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4535
bool IsSummon() const
Definition Unit.h:882
void SetNpcFlag(NPCFlags flags)
Definition Unit.h:1097
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
void SetFacingTo(float ori, bool force=true, uint32 movementId=EVENT_FACE)
Definition Unit.cpp:13250
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition Unit.h:918
virtual uint32 GetData(uint32) const
Definition ZoneScript.h:55
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:56
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 WaypointReached(uint32 waypointId, uint32) override
bool OnGossipSelect(Player *player, uint32, uint32) override
void Reset() override
npc_morridune(Creature *creature)