TrinityCore
Loading...
Searching...
No Matches
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
31
43
50
51// 17975 - High Botanist Freywinn
53{
55
56 void Reset() override
57 {
58 _Reset();
60 }
61
69
70 // Do not despawn them
71 void JustSummoned(Creature* summon) override
72 {
73 if (me->IsEngaged())
74 DoZoneInCombat(summon);
75 }
76
77 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
78 {
79 // Completely guessed, may be actually not used
80 if (spellInfo->Id == SPELL_CANCEL_TRANQUILITY)
81 {
83
84 if (_frayersKilled >= 3)
85 {
89 }
90 }
91 }
92
93 void KilledUnit(Unit* /*victim*/) override
94 {
96 }
97
98 void JustDied(Unit* /*killer*/) override
99 {
100 _JustDied();
102 }
103
104 void UpdateAI(uint32 diff) override
105 {
106 if (!UpdateVictim())
107 return;
108
109 events.Update(diff);
110
112 return;
113
114 while (uint32 eventId = events.ExecuteEvent())
115 {
116 switch (eventId)
117 {
120 events.Repeat(6s);
121 break;
122 case EVENT_TREE_FORM:
123 // Reset counter in case not all frayers were killed and tree phase was ended, otherwise next time it will be enough to
124 // kill only 1 or 2 to stop phase. It's an edge case, quite possible it was not even supported
125 _frayersKilled = 0;
126 Talk(SAY_TREE);
129 events.Repeat(60s);
131 break;
134 break;
135 default:
136 break;
137 }
138
140 return;
141 }
142
144 }
145
146private:
148};
149
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
@ CURRENT_CHANNELED_SPELL
Definition Unit.h:608
@ UNIT_STATE_CASTING
Definition Unit.h:235
void AddSC_boss_high_botanist_freywinn()
void JustEngagedWith(Unit *who) override
EventMap events
void DoZoneInCombat(Creature *creature=nullptr)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
bool IsEngaged() const override
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
uint32 Id
Definition SpellInfo.h:289
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
Definition Unit.h:769
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, SpellCastResult result=SPELL_FAILED_INTERRUPTED, Optional< SpellCastResult > resultOther={})
Definition Unit.cpp:3021
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
void JustSummoned(Creature *summon) override
@ DATA_HIGH_BOTANIST_FREYWINN
#define RegisterBotanicaCreatureAI(ai_name)