TrinityCore
boss_marwyn.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 "boss_horAI.h"
20#include "halls_of_reflection.h"
21#include "InstanceScript.h"
22#include "SpellAuraEffects.h"
23#include "SpellScript.h"
24
26{
31};
32
34{
40};
41
43{
49};
50
52{
53 public:
54 boss_marwyn() : CreatureScript("boss_marwyn") { }
55
56 struct boss_marwynAI : public boss_horAI
57 {
58 boss_marwynAI(Creature* creature) : boss_horAI(creature, DATA_MARWYN) { }
59
60 void Reset() override
61 {
63 }
64
65 void JustEngagedWith(Unit* /*who*/) override
66 {
70
75 }
76
77 void JustDied(Unit* /*killer*/) override
78 {
80 events.Reset();
82 }
83
84 void KilledUnit(Unit* who) override
85 {
86 if (who->GetTypeId() == TYPEID_PLAYER)
88 }
89
90 void UpdateAI(uint32 diff) override
91 {
92 if (!UpdateVictim())
93 return;
94
95 events.Update(diff);
96
98 return;
99
100 switch (events.ExecuteEvent())
101 {
102 case EVENT_OBLITERATE:
105 break;
107 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
110 break;
115 break;
117 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
120 break;
121 default:
122 break;
123 }
124 }
125 };
126
127 CreatureAI* GetAI(Creature* creature) const override
128 {
129 return GetHallsOfReflectionAI<boss_marwynAI>(creature);
130 }
131};
132
133// 72368, 72369 - Shared Suffering
135{
136 public:
137 spell_marwyn_shared_suffering() : SpellScriptLoader("spell_marwyn_shared_suffering") { }
138
140 {
142 {
143 if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL)
144 return;
145
146 if (Unit* caster = GetCaster())
147 {
148 int32 remainingDamage = aurEff->GetAmount() * aurEff->GetRemainingTicks();
149 if (remainingDamage > 0)
150 {
152 args.AddSpellMod(SPELLVALUE_BASE_POINT1, remainingDamage);
153 caster->CastSpell(GetTarget(), SPELL_SHARED_SUFFERING_DISPEL, args);
154 }
155 }
156 }
157
158 void Register() override
159 {
161 }
162 };
163
164 AuraScript* GetAuraScript() const override
165 {
167 }
168};
169
171{
172 new boss_marwyn();
174}
Texts
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
@ IN_PROGRESS
@ DONE
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
Spells
Definition: PlayerAI.cpp:32
@ EFFECT_0
Definition: SharedDefines.h:30
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ AURA_REMOVE_BY_ENEMY_SPELL
@ SPELL_AURA_PERIODIC_DAMAGE
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
Definition: SpellDefines.h:266
@ SPELLVALUE_BASE_POINT1
Definition: SpellDefines.h:197
#define AuraEffectRemoveFn(F, I, N, M)
Definition: SpellScript.h:2040
@ UNIT_STATE_CASTING
Definition: Unit.h:270
@ SPELL_SHARED_SUFFERING
Definition: boss_marwyn.cpp:38
@ SPELL_SHARED_SUFFERING_DISPEL
Definition: boss_marwyn.cpp:39
@ SPELL_WELL_OF_CORRUPTION
Definition: boss_marwyn.cpp:36
@ SPELL_CORRUPTED_FLESH
Definition: boss_marwyn.cpp:37
@ SPELL_OBLITERATE
Definition: boss_marwyn.cpp:35
void AddSC_boss_marwyn()
@ SAY_DEATH
Definition: boss_marwyn.cpp:29
@ SAY_AGGRO
Definition: boss_marwyn.cpp:27
@ SAY_SLAY
Definition: boss_marwyn.cpp:28
@ SAY_CORRUPTED_FLESH
Definition: boss_marwyn.cpp:30
@ EVENT_WELL_OF_CORRUPTION
Definition: boss_marwyn.cpp:46
@ EVENT_NONE
Definition: boss_marwyn.cpp:44
@ EVENT_CORRUPTED_FLESH
Definition: boss_marwyn.cpp:47
@ EVENT_OBLITERATE
Definition: boss_marwyn.cpp:45
@ EVENT_SHARED_SUFFERING
Definition: boss_marwyn.cpp:48
uint32 GetRemainingTicks() const
int32 GetAmount() const
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
Definition: SpellScript.h:2039
Unit * GetCaster() const
Unit * GetTarget() const
InstanceScript *const instance
EventMap events
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
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void Reset()
Definition: EventMap.cpp:21
virtual bool SetBossState(uint32 id, EncounterState state)
TypeID GetTypeId() const
Definition: Object.h:173
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:79
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
CreatureAI * GetAI(Creature *creature) const override
void HandleEffectRemove(AuraEffect const *aurEff, AuraEffectHandleModes)
AuraScript * GetAuraScript() const override
@ DATA_MARWYN
CastSpellExtraArgs & AddSpellMod(SpellValueMod mod, int32 val)
Definition: SpellDefines.h:474
void Reset() override
Definition: boss_horAI.cpp:26
void JustDied(Unit *) override
Definition: boss_marwyn.cpp:77
void KilledUnit(Unit *who) override
Definition: boss_marwyn.cpp:84
void UpdateAI(uint32 diff) override
Definition: boss_marwyn.cpp:90
boss_marwynAI(Creature *creature)
Definition: boss_marwyn.cpp:58
void JustEngagedWith(Unit *) override
Definition: boss_marwyn.cpp:65