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 }
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 SpellEffectValue 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
162 };
163
164 AuraScript* GetAuraScript() const override
165 {
167 }
168};
169
171{
172 new boss_marwyn();
174}
uint32_t uint32
Definition Define.h:154
@ IN_PROGRESS
@ DONE
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
Spells
Definition PlayerAI.cpp:32
@ EFFECT_0
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ AURA_REMOVE_BY_ENEMY_SPELL
@ SPELL_AURA_PERIODIC_DAMAGE
double SpellEffectValue
This is a double instead of float to be able to store full range of int32.
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
@ SPELLVALUE_BASE_POINT1
#define AuraEffectRemoveFn(F, I, N, M)
@ UNIT_STATE_CASTING
Definition Unit.h:276
@ 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
SpellEffectValue GetAmount() const
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
Unit * GetCaster() const
Unit * GetTarget() const
TypeID GetTypeId() const
Definition BaseEntity.h:166
InstanceScript *const instance
EventMap events
void DoZoneInCombat()
Definition CreatureAI.h:169
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
void Reset()
Definition EventMap.cpp:25
virtual bool SetBossState(uint32 id, EncounterState state)
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:162
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
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