TrinityCore
boss_high_botanist_freywinn.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 "ScriptedCreature.h"
20#include "SpellInfo.h"
21#include "the_botanica.h"
22
24{
30};
31
33{
42};
43
45{
49};
50
52{
54
55 void Reset() override
56 {
57 _Reset();
59 }
60
61 void JustEngagedWith(Unit* who) override
62 {
67 }
68
69 void KilledUnit(Unit* /*victim*/) override
70 {
72 }
73
74 void JustDied(Unit* /*killer*/) override
75 {
76 _JustDied();
78 }
79
80 // Do not despawn them
81 void JustSummoned(Creature* summon) override
82 {
83 if (me->IsEngaged())
84 DoZoneInCombat(summon);
85 }
86
87 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
88 {
89 // Completely guessed, may be actually not used
90 if (spellInfo->Id == SPELL_CANCEL_TRANQUILITY)
91 {
93
94 if (_frayersKilled >= 3)
95 {
99 }
100 }
101 }
102
103 void UpdateAI(uint32 diff) override
104 {
105 if (!UpdateVictim())
106 return;
107
108 events.Update(diff);
109
111 return;
112
113 while (uint32 eventId = events.ExecuteEvent())
114 {
115 switch (eventId)
116 {
119 events.Repeat(6s);
120 break;
121 case EVENT_TREE_FORM:
122 // Reset counter in case not all frayers were killed and tree phase was ended, otherwise next time it will be enough to
123 // kill only 1 or 2 to stop phase. It's an edge case, quite possible it was not even supported
124 _frayersKilled = 0;
125 Talk(SAY_TREE);
128 events.Repeat(60s);
130 break;
133 break;
134 default:
135 break;
136 }
137
139 return;
140 }
141 }
142
143private:
145};
146
148{
150}
Texts
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint8_t uint8
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:142
Spells
Definition: PlayerAI.cpp:32
@ CURRENT_CHANNELED_SPELL
Definition: Unit.h:591
@ UNIT_STATE_CASTING
Definition: Unit.h:270
void AddSC_boss_high_botanist_freywinn()
void JustEngagedWith(Unit *who) override
EventMap events
void _JustDied()
void DoZoneInCombat()
Definition: CreatureAI.h:161
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
bool IsEngaged() const override
Definition: Creature.cpp:3601
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
uint32 const Id
Definition: SpellInfo.h:325
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:159
Definition: Unit.h:627
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true)
Definition: Unit.cpp:3017
void JustEngagedWith(Unit *who) override
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
void JustSummoned(Creature *summon) override
@ DATA_HIGH_BOTANIST_FREYWINN
Definition: the_botanica.h:31
#define RegisterBotanicaCreatureAI(ai_name)
Definition: the_botanica.h:52