TrinityCore
Loading...
Searching...
No Matches
zone_terokkar_forest.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 "Containers.h"
20#include "CreatureAIImpl.h"
21#include "GameObject.h"
22#include "Group.h"
23#include "Map.h"
24#include "Player.h"
25#include "ScriptedEscortAI.h"
26#include "Spell.h"
27#include "SpellScript.h"
28#include "WorldSession.h"
29
30/*######
31## npc_unkor_the_ruthless
32######*/
33
42
44{
45public:
46 npc_unkor_the_ruthless() : CreatureScript("npc_unkor_the_ruthless") { }
47
48 CreatureAI* GetAI(Creature* creature) const override
49 {
50 return new npc_unkor_the_ruthlessAI(creature);
51 }
52
54 {
56 {
57 Initialize();
58 }
59
61 {
62 CanDoQuest = false;
64 Pulverize_Timer = 3000;
65 }
66
70
71 void Reset() override
72 {
73 Initialize();
76 }
77
78 void JustEngagedWith(Unit* /*who*/) override { }
79
90
91 void DamageTaken(Unit* done_by, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
92 {
93 if (!done_by || !me->HealthBelowPctDamaged(30, damage))
94 return;
95
96 if (Player* player = done_by->ToPlayer())
97 {
98 if (Group* group = player->GetGroup())
99 {
100 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
101 {
102 Player* groupie = itr->GetSource();
103 if (groupie && groupie->IsInMap(player) &&
106 {
108 if (!CanDoQuest)
109 CanDoQuest = true;
110 }
111 }
112 }
113 else if (player->GetQuestStatus(QUEST_DONTKILLTHEFATONE) == QUEST_STATUS_INCOMPLETE &&
114 player->GetReqKillOrCastCurrentCount(QUEST_DONTKILLTHEFATONE, NPC_BOULDERFIST_INVADER) == REQUIRED_KILL_COUNT)
115 {
116 player->AreaExploredOrEventHappens(QUEST_DONTKILLTHEFATONE);
117 CanDoQuest = true;
118 }
119 }
120 }
121
122 void UpdateAI(uint32 diff) override
123 {
124 if (CanDoQuest)
125 {
127 {
128 //DoCast(me, SPELL_QUID9889); //not using spell for now
129 DoNice();
130 }
131 else
132 {
133 if (UnkorUnfriendly_Timer <= diff)
134 {
136 return;
137 } else UnkorUnfriendly_Timer -= diff;
138 }
139 }
140
141 if (!UpdateVictim())
142 return;
143
144 if (Pulverize_Timer <= diff)
145 {
147 Pulverize_Timer = 9000;
148 } else Pulverize_Timer -= diff;
149
151 }
152 };
153};
154
155// 40655 - Skyguard Flare
170
171/*######
172## Quest 10873: Taken in the Night
173######*/
174
184
189
190// 38949 - Terrokar Free Webbed Creature
210
211// 38950 - Terokkar Free Webbed Creature ON QUEST
237
238/*######
239## Quest 10040 & 10041: Who Are They?
240######*/
241
248
249// 48917 - Who Are They: Cast from Questgiver
269
270// 32756 - Shadowy Disguise
299
300// 32780 - Cancel Shadowy Disguise
320
328
329// 25143 - Translocate
330// 29128 - Translocate
331// 29129 - Translocate
332// 25140 - Translocate
357
358/*######
359## Quest 10929: Fumping / 10930: The Big Bone Worm
360######*/
361
372
373// 39238 - Fumping
400
401// 39246 - Fumping
440
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint32_t uint32
Definition Define.h:133
#define MAX_HEIGHT
Definition Map.h:240
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:107
bool roll_chance_i(int chance)
Definition Random.h:59
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
#define RegisterSpellScriptWithArgs(spell_script, script_name,...)
Definition ScriptMgr.h:1127
SpellEffIndex
@ EFFECT_1
@ EFFECT_0
@ EFFECT_2
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCRIPT_EFFECT
@ GENDER_MALE
@ TARGET_DEST_TARGET_RANDOM
@ TARGET_DEST_CASTER
@ FACTION_FRIENDLY
@ FACTION_OGRE
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_FORCE_REACTION
#define SpellEffectFn(F, I, N)
#define SpellDestinationTargetSelectFn(F, I, N)
#define AuraEffectApplyFn(F, I, N, M)
@ UNIT_STAND_STATE_STAND
Definition UnitDefines.h:34
@ UNIT_STAND_STATE_SIT
Definition UnitDefines.h:35
DamageEffectType
Definition Unit.h:352
HookList< EffectApplyHandler > AfterEffectRemove
HookList< EffectApplyHandler > AfterEffectApply
Unit * GetTarget() const
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void EngagementOver()
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
Definition Group.h:165
float GetHeight(float x, float y, float z, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
Definition Map.cpp:2484
static Player * ToPlayer(Object *o)
Definition Object.h:180
uint16 GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry) const
Definition Player.cpp:15902
void AreaExploredOrEventHappens(uint32 questId)
Definition Player.cpp:16008
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition Player.cpp:15642
Unit * GetCaster() const
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
HookList< EffectHandler > OnEffectHit
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
void SetFaction(uint32 faction) override
Definition Unit.h:974
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
void SetStandState(UnitStandStateType state)
Definition Unit.cpp:10363
void RemoveAllAuras()
Definition Unit.cpp:4157
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition Unit.h:918
void CombatStop(bool includingCast=false, bool mutualPvP=true)
Definition Unit.cpp:5691
Map * GetMap() const
Definition Object.h:449
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
bool IsInMap(WorldObject const *obj) const
Definition Object.cpp:1160
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
CreatureAI * GetAI(Creature *creature) const override
PrepareSpellScript(spell_skyguard_flare)
void ModDestHeight(SpellDestination &dest)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_terokkar_cancel_shadowy_disguise)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_terokkar_free_webbed_on_quest)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_terokkar_free_webbed)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_terokkar_fumping_the_big_bone_worm)
bool Validate(SpellInfo const *) override
void SetDest(SpellDestination &dest)
void HandleDummy(SpellEffIndex)
PrepareSpellScript(spell_terokkar_fumping)
PrepareSpellScript(spell_terokkar_shadowy_disguise_cast_from_questgiver)
PrepareAuraScript(spell_terokkar_shadowy_disguise)
void AfterApply(AuraEffect const *, AuraEffectHandleModes)
void AfterRemove(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_terokkar_translocation_firewing_point)
spell_terokkar_translocation_firewing_point(Translocation triggeredSpellId)
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition Containers.h:108
float m_positionZ
Definition Position.h:58
float GetPositionX() const
Definition Position.h:79
float GetPositionY() const
Definition Position.h:80
void RelocateOffset(Position const &offset)
Definition Spell.cpp:110
WorldLocation _position
void DamageTaken(Unit *done_by, uint32 &damage, DamageEffectType, SpellInfo const *) override
void AddSC_terokkar_forest()
std::array< uint32, 5 > const CocoonSummonSpells
@ SPELL_FEMALE_SHADOWY_DISGUISE
@ SPELL_MALE_SHADOWY_DISGUISE
@ SPELL_SHADOWY_DISGUISE
@ SPELL_TRANSLOCATION_FIREWING_POINT_BUILDING_DOWN
@ SPELL_TRANSLOCATION_FIREWING_POINT_TOWER_DOWN
@ SPELL_TRANSLOCATION_FIREWING_POINT_BUILDING_UP
@ SPELL_TRANSLOCATION_FIREWING_POINT_TOWER_UP
@ REQUIRED_KILL_COUNT
@ SPELL_PULVERIZE
@ NPC_BOULDERFIST_INVADER
@ QUEST_DONTKILLTHEFATONE
@ SPELL_FREE_WEBBED_4
@ SPELL_FREE_WEBBED_6
@ SPELL_FREE_WEBBED_1
@ SPELL_FREE_WEBBED_3
@ SPELL_FREE_WEBBED_5
@ SPELL_FREE_WEBBED_2
@ SPELL_SUMMON_SAND_GNOME_1
@ SPELL_SUMMON_BONE_SLICER_1
@ SPELL_SUMMON_SAND_GNOME
@ SPELL_DESPAWN_CLEFTHOOF
@ SPELL_SUMMON_HAISHULUD
@ SPELL_SUMMON_BONE_SLICER