TrinityCore
Loading...
Searching...
No Matches
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
32
41
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
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
126 }
127 };
128
129 CreatureAI* GetAI(Creature* creature) const override
130 {
131 return GetHallsOfReflectionAI<boss_marwynAI>(creature);
132 }
133};
134
135// 72368, 72369 - Shared Suffering
137{
138 public:
139 spell_marwyn_shared_suffering() : SpellScriptLoader("spell_marwyn_shared_suffering") { }
140
142 {
144
146 {
147 if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL)
148 return;
149
150 if (Unit* caster = GetCaster())
151 {
152 int32 remainingDamage = aurEff->GetAmount() * aurEff->GetRemainingTicks();
153 if (remainingDamage > 0)
154 {
156 args.AddSpellMod(SPELLVALUE_BASE_POINT1, remainingDamage);
157 caster->CastSpell(GetTarget(), SPELL_SHARED_SUFFERING_DISPEL, args);
158 }
159 }
160 }
161
166 };
167
168 AuraScript* GetAuraScript() const override
169 {
171 }
172};
173
175{
176 new boss_marwyn();
178}
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ IN_PROGRESS
@ DONE
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
Spells
Definition PlayerAI.cpp:32
@ EFFECT_0
@ AURA_REMOVE_BY_ENEMY_SPELL
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_PERIODIC_DAMAGE
@ TRIGGERED_FULL_MASK
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
@ SPELLVALUE_BASE_POINT1
#define AuraEffectRemoveFn(F, I, N, M)
@ UNIT_STATE_CASTING
Definition Unit.h:235
@ SPELL_SHARED_SUFFERING
@ SPELL_SHARED_SUFFERING_DISPEL
@ SPELL_WELL_OF_CORRUPTION
@ SPELL_CORRUPTED_FLESH
@ SPELL_OBLITERATE
void AddSC_boss_marwyn()
@ SAY_DEATH
@ SAY_AGGRO
@ SAY_SLAY
@ SAY_CORRUPTED_FLESH
@ EVENT_WELL_OF_CORRUPTION
@ EVENT_NONE
@ EVENT_CORRUPTED_FLESH
@ EVENT_OBLITERATE
@ EVENT_SHARED_SUFFERING
uint32 GetRemainingTicks() const
int32 GetAmount() const
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
Unit * GetCaster() const
Unit * GetTarget() const
InstanceScript *const instance
EventMap events
void DoZoneInCombat(Creature *creature=nullptr)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void Update(uint32 time)
Definition EventMap.h:67
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
void Reset()
Definition EventMap.cpp:21
virtual bool SetBossState(uint32 id, EncounterState state)
TypeID GetTypeId() const
Definition Object.h:93
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:243
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
CreatureAI * GetAI(Creature *creature) const override
void HandleEffectRemove(AuraEffect const *aurEff, AuraEffectHandleModes)
AuraScript * GetAuraScript() const override
@ DATA_MARWYN
CastSpellExtraArgs & AddSpellMod(SpellValueMod mod, int32 val)
void Reset() override
void JustDied(Unit *) override
void KilledUnit(Unit *who) override
void UpdateAI(uint32 diff) override
boss_marwynAI(Creature *creature)
void JustEngagedWith(Unit *) override