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 "Group.h"
21#include "Map.h"
22#include "Player.h"
23#include "ScriptedCreature.h"
24#include "SpellScript.h"
25
26/*######
27## npc_unkor_the_ruthless
28######*/
29
38
40{
41public:
42 npc_unkor_the_ruthless() : CreatureScript("npc_unkor_the_ruthless") { }
43
44 CreatureAI* GetAI(Creature* creature) const override
45 {
46 return new npc_unkor_the_ruthlessAI(creature);
47 }
48
50 {
52 {
53 Initialize();
54 }
55
57 {
58 CanDoQuest = false;
60 Pulverize_Timer = 3000;
61 }
62
66
67 void Reset() override
68 {
69 Initialize();
72 }
73
74 void JustEngagedWith(Unit* /*who*/) override { }
75
86
87 void DamageTaken(Unit* done_by, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
88 {
89 if (!done_by || !me->HealthBelowPctDamaged(30, damage))
90 return;
91
92 if (Player* player = done_by->ToPlayer())
93 {
94 if (Group const* group = player->GetGroup())
95 {
96 for (GroupReference const& itr : group->GetMembers())
97 {
98 Player* groupie = itr.GetSource();
99 if (groupie->IsInMap(player) &&
102 {
104 if (!CanDoQuest)
105 CanDoQuest = true;
106 }
107 }
108 }
109 else if (player->GetQuestStatus(QUEST_DONTKILLTHEFATONE) == QUEST_STATUS_INCOMPLETE &&
110 player->GetReqKillOrCastCurrentCount(QUEST_DONTKILLTHEFATONE, NPC_BOULDERFIST_INVADER) == REQUIRED_KILL_COUNT)
111 {
112 player->AreaExploredOrEventHappens(QUEST_DONTKILLTHEFATONE);
113 CanDoQuest = true;
114 }
115 }
116 }
117
118 void UpdateAI(uint32 diff) override
119 {
120 if (CanDoQuest)
121 {
123 {
124 //DoCast(me, SPELL_QUID9889); //not using spell for now
125 DoNice();
126 }
127 else
128 {
129 if (UnkorUnfriendly_Timer <= diff)
130 {
132 return;
133 } else UnkorUnfriendly_Timer -= diff;
134 }
135 }
136
137 if (!UpdateVictim())
138 return;
139
140 if (Pulverize_Timer <= diff)
141 {
143 Pulverize_Timer = 9000;
144 } else Pulverize_Timer -= diff;
145 }
146 };
147};
148
149// 40655 - Skyguard Flare
162
163/*######
164## Quest 10873: Taken in the Night
165######*/
166
176
181
182// 38949 - Terrokar Free Webbed Creature
200
201// 38950 - Terokkar Free Webbed Creature ON QUEST
203{
204 bool Validate(SpellInfo const* /*spellInfo*/) override
205 {
207 }
208
209 void HandleDummy(SpellEffIndex /*effIndex*/)
210 {
211 Unit* caster = GetCaster();
212 Unit* target = GetHitUnit();
213
214 if (roll_chance(66))
216 else
217 target->CastSpell(caster, SPELL_FREE_WEBBED_6, true);
218 }
219
224};
225
226/*######
227## Quest 10040 & 10041: Who Are They?
228######*/
229
236
237// 48917 - Who Are They: Cast from Questgiver
255
256// 32756 - Shadowy Disguise
283
284// 32780 - Cancel Shadowy Disguise
302
uint32_t uint32
Definition Define.h:154
#define MAX_HEIGHT
Definition GridDefines.h:60
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:150
bool roll_chance(T chance)
Definition Random.h:55
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_0
@ GENDER_MALE
@ TARGET_DEST_TARGET_RANDOM
@ SPELL_EFFECT_DUMMY
@ SPELL_EFFECT_SCRIPT_EFFECT
@ 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:205
float GetHeight(PhaseShift const &phaseShift, float x, float y, float z, bool vmap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH)
Definition Map.h:326
Player * ToPlayer()
Definition Object.h:126
uint16 GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry) const
Definition Player.cpp:16334
void AreaExploredOrEventHappens(uint32 questId)
Definition Player.cpp:16552
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition Player.cpp:15962
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:89
Definition Unit.h:635
void CombatStop(bool includingCast=false, bool mutualPvP=true, bool(*unitFilter)(Unit const *otherUnit)=nullptr)
Definition Unit.cpp:6012
void SetStandState(UnitStandStateType state, uint32 animKitID=0)
Definition Unit.cpp:10731
void SetFaction(uint32 faction) override
Definition Unit.h:872
bool HealthBelowPctDamaged(float pct, uint32 damage) const
Definition Unit.h:793
void RemoveAllAuras()
Definition Unit.cpp:4382
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3974
Map * GetMap() const
Definition Object.h:411
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
bool IsInMap(WorldObject const *obj) const
Definition Object.cpp:469
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
void AfterApply(AuraEffect const *, AuraEffectHandleModes)
void AfterRemove(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
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
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
@ 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