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 "Group.h"
22#include "Map.h"
23#include "Player.h"
24#include "ScriptedCreature.h"
25#include "SpellScript.h"
26
27/*######
28## npc_unkor_the_ruthless
29######*/
30
39
41{
42public:
43 npc_unkor_the_ruthless() : CreatureScript("npc_unkor_the_ruthless") { }
44
45 CreatureAI* GetAI(Creature* creature) const override
46 {
47 return new npc_unkor_the_ruthlessAI(creature);
48 }
49
51 {
53 {
54 Initialize();
55 }
56
58 {
59 CanDoQuest = false;
61 Pulverize_Timer = 3000;
62 }
63
67
68 void Reset() override
69 {
70 Initialize();
73 }
74
75 void JustEngagedWith(Unit* /*who*/) override { }
76
87
88 void DamageTaken(Unit* done_by, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
89 {
90 if (!done_by || !me->HealthBelowPctDamaged(30, damage))
91 return;
92
93 if (Player* player = done_by->ToPlayer())
94 {
95 if (Group const* group = player->GetGroup())
96 {
97 for (GroupReference const& itr : group->GetMembers())
98 {
99 Player* groupie = itr.GetSource();
100 if (groupie->IsInMap(player) &&
103 {
105 if (!CanDoQuest)
106 CanDoQuest = true;
107 }
108 }
109 }
110 else if (player->GetQuestStatus(QUEST_DONTKILLTHEFATONE) == QUEST_STATUS_INCOMPLETE &&
111 player->GetReqKillOrCastCurrentCount(QUEST_DONTKILLTHEFATONE, NPC_BOULDERFIST_INVADER) == REQUIRED_KILL_COUNT)
112 {
113 player->AreaExploredOrEventHappens(QUEST_DONTKILLTHEFATONE);
114 CanDoQuest = true;
115 }
116 }
117 }
118
119 void UpdateAI(uint32 diff) override
120 {
121 if (CanDoQuest)
122 {
124 {
125 //DoCast(me, SPELL_QUID9889); //not using spell for now
126 DoNice();
127 }
128 else
129 {
130 if (UnkorUnfriendly_Timer <= diff)
131 {
133 return;
134 } else UnkorUnfriendly_Timer -= diff;
135 }
136 }
137
138 if (!UpdateVictim())
139 return;
140
141 if (Pulverize_Timer <= diff)
142 {
144 Pulverize_Timer = 9000;
145 } else Pulverize_Timer -= diff;
146 }
147 };
148};
149
150// 40655 - Skyguard Flare
163
164/*######
165## Quest 10873: Taken in the Night
166######*/
167
177
182
183// 38949 - Terrokar Free Webbed Creature
201
202// 38950 - Terokkar Free Webbed Creature ON QUEST
204{
205 bool Validate(SpellInfo const* /*spellInfo*/) override
206 {
208 }
209
210 void HandleDummy(SpellEffIndex /*effIndex*/)
211 {
212 Unit* caster = GetCaster();
213 Unit* target = GetHitUnit();
214
215 if (roll_chance(66))
217 else
218 target->CastSpell(caster, SPELL_FREE_WEBBED_6, true);
219 }
220
225};
226
227/*######
228## Quest 10040 & 10041: Who Are They?
229######*/
230
237
238// 48917 - Who Are They: Cast from Questgiver
256
257// 32756 - Shadowy Disguise
284
285// 32780 - Cancel Shadowy Disguise
303
311
312// 25143 - Translocate
313// 29128 - Translocate
314// 29129 - Translocate
315// 25140 - Translocate
338
339/*######
340## Quest 10929: Fumping / 10930: The Big Bone Worm
341######*/
342
353
354// 39238 - Fumping
379
380// 39246 - Fumping
417
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint32_t uint32
Definition Define.h:154
#define MAX_HEIGHT
Definition GridDefines.h:60
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:146
bool roll_chance(float chance, PseudoRandomDistributionState &state)
Definition Random.cpp:131
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
#define RegisterSpellScriptWithArgs(spell_script, script_name,...)
Definition ScriptMgr.h:1382
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:42
@ UNIT_STAND_STATE_SIT
Definition UnitDefines.h:43
DamageEffectType
HookList< EffectApplyHandler > AfterEffectRemove
HookList< EffectApplyHandler > AfterEffectApply
Unit * GetTarget() const
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void EngagementOver()
Definition Group.h:209
float GetHeight(PhaseShift const &phaseShift, float x, float y, float z, bool vmap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH)
Definition Map.h:329
Player * ToPlayer()
Definition Object.h:126
uint16 GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry) const
Definition Player.cpp:16301
void AreaExploredOrEventHappens(uint32 questId)
Definition Player.cpp:16519
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition Player.cpp:15929
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Unit * GetCaster() const
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
HookList< EffectHandler > OnEffectHit
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:81
Definition Unit.h:647
void CombatStop(bool includingCast=false, bool mutualPvP=true, bool(*unitFilter)(Unit const *otherUnit)=nullptr)
Definition Unit.cpp:6031
void SetStandState(UnitStandStateType state, uint32 animKitID=0)
Definition Unit.cpp:10804
void SetFaction(uint32 faction) override
Definition Unit.h:887
bool HealthBelowPctDamaged(float pct, uint32 damage) const
Definition Unit.h:805
void RemoveAllAuras()
Definition Unit.cpp:4400
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3992
Map * GetMap() const
Definition Object.h:411
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
bool IsInMap(WorldObject const *obj) const
Definition Object.cpp:467
CreatureAI * GetAI(Creature *creature) const override
void ModDestHeight(SpellDestination &dest)
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
bool Validate(SpellInfo const *) override
void SetDest(SpellDestination &dest)
void HandleDummy(SpellEffIndex)
void AfterApply(AuraEffect const *, AuraEffectHandleModes)
void AfterRemove(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
spell_terokkar_translocation_firewing_point(Translocation triggeredSpellId)
auto SelectRandomContainerElement(C const &container) -> std::add_const_t< decltype(*std::ranges::begin(container))> &
Definition Containers.h:110
constexpr float GetPositionX() const
Definition Position.h:87
float m_positionZ
Definition Position.h:66
constexpr float GetPositionY() const
Definition Position.h:88
void RelocateOffset(Position const &offset)
Definition Spell.cpp:90
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