AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
spell_mc_play_dead_aura Class Reference
Inheritance diagram for spell_mc_play_dead_aura:
AuraScript _SpellScript

Private Member Functions

 PrepareAuraScript (spell_mc_play_dead_aura)
 
bool Validate (SpellInfo const *) override
 
bool Load () override
 
void HandleEffectApply (AuraEffect const *, AuraEffectHandleModes)
 
void HandleEffectRemove (AuraEffect const *, AuraEffectHandleModes)
 
void Register () override
 

Additional Inherited Members

- Public Member Functions inherited from AuraScript
 AuraScript ()
 
bool _Validate (SpellInfo const *entry) override
 
bool _Load (Aura *aura)
 
void _PrepareScriptCall (AuraScriptHookType hookType, AuraApplication const *aurApp=nullptr)
 
void _FinishScriptCall ()
 
bool _IsDefaultActionPrevented ()
 
void PreventDefaultAction ()
 
SpellInfo const * GetSpellInfo () const
 
uint32 GetId () const
 
ObjectGuid GetCasterGUID () const
 
UnitGetCaster () const
 
WorldObjectGetOwner () const
 
UnitGetUnitOwner () const
 
DynamicObjectGetDynobjOwner () const
 
void Remove (AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
AuraGetAura () const
 
AuraObjectType GetType () const
 
int32 GetDuration () const
 
void SetDuration (int32 duration, bool withMods=false)
 
void RefreshDuration ()
 
time_t GetApplyTime () const
 
int32 GetMaxDuration () const
 
void SetMaxDuration (int32 duration)
 
int32 CalcMaxDuration () const
 
bool IsExpired () const
 
bool IsPermanent () const
 
uint8 GetCharges () const
 
void SetCharges (uint8 charges)
 
uint8 CalcMaxCharges () const
 
bool ModCharges (int8 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
bool DropCharge (AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
uint8 GetStackAmount () const
 
void SetStackAmount (uint8 num)
 
bool ModStackAmount (int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
bool IsPassive () const
 
bool IsDeathPersistent () const
 
bool HasEffect (uint8 effIndex) const
 
AuraEffectGetEffect (uint8 effIndex) const
 
bool HasEffectType (AuraType type) const
 
UnitGetTarget () const
 
AuraApplication const * GetTargetApplication () const
 
- Public Member Functions inherited from _SpellScript
 _SpellScript ()
 
virtual ~_SpellScript ()
 
virtual void _Register ()
 
virtual void _Unload ()
 
virtual void _Init (std::string const *scriptname, uint32 spellId)
 
std::string const * _GetScriptName () const
 
virtual void Unload ()
 
- Static Public Member Functions inherited from _SpellScript
static bool ValidateSpellInfo (std::initializer_list< uint32 > spellIds)
 
template<class T >
static bool ValidateSpellInfo (T const &spellIds)
 
- Public Attributes inherited from AuraScript
HookList< CheckAreaTargetHandlerDoCheckAreaTarget
 
HookList< AuraDispelHandlerOnDispel
 
HookList< AuraDispelHandlerAfterDispel
 
HookList< EffectApplyHandlerOnEffectApply
 
HookList< EffectApplyHandlerAfterEffectApply
 
HookList< EffectApplyHandlerOnEffectRemove
 
HookList< EffectApplyHandlerAfterEffectRemove
 
HookList< EffectPeriodicHandlerOnEffectPeriodic
 
HookList< EffectUpdatePeriodicHandlerOnEffectUpdatePeriodic
 
HookList< EffectCalcAmountHandlerDoEffectCalcAmount
 
HookList< EffectCalcPeriodicHandlerDoEffectCalcPeriodic
 
HookList< EffectCalcSpellModHandlerDoEffectCalcSpellMod
 
HookList< EffectAbsorbHandlerOnEffectAbsorb
 
HookList< EffectAbsorbHandlerAfterEffectAbsorb
 
HookList< EffectManaShieldHandlerOnEffectManaShield
 
HookList< EffectManaShieldHandlerAfterEffectManaShield
 
HookList< EffectSplitHandlerOnEffectSplit
 
HookList< CheckProcHandlerDoCheckProc
 
HookList< CheckEffectProcHandlerDoCheckEffectProc
 
HookList< AfterCheckProcHandlerDoAfterCheckProc
 
HookList< AuraProcHandlerDoPrepareProc
 
HookList< AuraProcHandlerOnProc
 
HookList< AuraProcHandlerAfterProc
 
HookList< EffectProcHandlerOnEffectProc
 
HookList< EffectProcHandlerAfterEffectProc
 
- Protected Attributes inherited from _SpellScript
uint8 m_currentScriptState
 
std::string const * m_scriptName
 
uint32 m_scriptSpellId
 

Detailed Description

Member Function Documentation

◆ HandleEffectApply()

void spell_mc_play_dead_aura::HandleEffectApply ( AuraEffect const *  ,
AuraEffectHandleModes   
)
inlineprivate
121 {
122 Creature* creatureTarget = GetTarget()->ToCreature();
123 if (!creatureTarget)
124 return;
125
126 creatureTarget->CastSpell(creatureTarget, SPELL_PLAY_DEAD_PACIFY, true);
127 creatureTarget->SetDynamicFlag(UNIT_DYNFLAG_DEAD);
128 creatureTarget->SetUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
129 //creatureTarget->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
130 creatureTarget->SetReactState(REACT_PASSIVE);
131 creatureTarget->SetControlled(true, UNIT_STATE_ROOT);
132
133 creatureTarget->AttackStop();
134 }
@ UNIT_DYNFLAG_DEAD
Definition SharedDefines.h:3361
@ UNIT_FLAG2_FEIGN_DEATH
Definition UnitDefines.h:296
@ UNIT_STATE_ROOT
Definition UnitDefines.h:183
@ REACT_PASSIVE
Definition Unit.h:566
Unit * GetTarget() const
Definition SpellScript.cpp:1180
Definition Creature.h:47
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition Creature.h:99
virtual void SetDynamicFlag(uint32 flag)
Definition Object.h:125
Creature * ToCreature()
Definition Object.h:206
void SetUnitFlag2(UnitFlags2 flags)
Definition Unit.h:754
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition Unit.cpp:14268
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition Unit.cpp:1350
bool AttackStop()
Force the unit to stop attacking. This will clear UNIT_STATE_MELEE_ATTACKING, Interrupt current spell...
Definition Unit.cpp:7436
@ SPELL_PLAY_DEAD_PACIFY
Definition molten_core.cpp:38

References Unit::AttackStop(), Unit::CastSpell(), AuraScript::GetTarget(), REACT_PASSIVE, Unit::SetControlled(), Object::SetDynamicFlag(), Creature::SetReactState(), Unit::SetUnitFlag2(), SPELL_PLAY_DEAD_PACIFY, Object::ToCreature(), UNIT_DYNFLAG_DEAD, UNIT_FLAG2_FEIGN_DEATH, and UNIT_STATE_ROOT.

Referenced by Register().

◆ HandleEffectRemove()

void spell_mc_play_dead_aura::HandleEffectRemove ( AuraEffect const *  ,
AuraEffectHandleModes   
)
inlineprivate
137 {
138 Creature* creatureTarget = GetTarget()->ToCreature();
139 if (!creatureTarget)
140 return;
141
143 creatureTarget->RemoveDynamicFlag(UNIT_DYNFLAG_DEAD);
145 //creatureTarget->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
146 creatureTarget->SetControlled(false, UNIT_STATE_ROOT);
147 creatureTarget->SetReactState(REACT_AGGRESSIVE);
148
149 if (!creatureTarget->IsInCombat())
150 return;
151
152 bool shouldDie = true;
153 std::list<Creature*> hounds;
154 creatureTarget->GetCreaturesWithEntryInRange(hounds, 80.0f, NPC_CORE_HOUND);
155
156 // Perform lambda based check to find if there is any nearby
157 if (!hounds.empty())
158 {
159 // Alive hound been found within 80 yards -> cancel suicide
160 if (std::find_if(hounds.begin(), hounds.end(), [creatureTarget](Creature const* hound)
161 {
162 return creatureTarget != hound && creatureTarget->IsWithinLOSInMap(hound) && hound->IsAlive() && hound->IsInCombat() && !hound->HasAura(SPELL_PLAY_DEAD);
163 }) != hounds.end())
164 {
165 shouldDie = false;
166 }
167 }
168
169 if (!shouldDie)
170 {
171 if (CreatureAI* targetAI = creatureTarget->AI())
172 {
173 targetAI->DoCastSelf(SPELL_FIRE_NOVA_VISUAL, true);
174 targetAI->DoCastSelf(SPELL_FULL_HEALTH, true);
175 targetAI->Talk(EMOTE_IGNITE);
176 }
177 }
178 else
179 {
180 Unit::Kill(creatureTarget, creatureTarget);
181 creatureTarget->DespawnOrUnsummon(14s);
182 }
183 }
@ REACT_AGGRESSIVE
Definition Unit.h:568
Definition CreatureAI.h:69
void DespawnOrUnsummon(Milliseconds msTimeToDespawn=0ms, Seconds forcedRespawnTimer=0s)
Definition Creature.cpp:2126
CreatureAI * AI() const
Definition Creature.h:143
virtual void RemoveDynamicFlag(uint32 flag)
Definition Object.h:126
static void Kill(Unit *killer, Unit *victim, bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
Definition Unit.cpp:13938
void RemoveUnitFlag2(UnitFlags2 flags)
Definition Unit.h:755
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:5157
bool IsInCombat() const
Definition Unit.h:935
void GetCreaturesWithEntryInRange(std::list< Creature * > &creatureList, float radius, uint32 entry)
Definition Object.cpp:3061
@ SPELL_FULL_HEALTH
Definition molten_core.cpp:36
@ SPELL_FIRE_NOVA_VISUAL
Definition molten_core.cpp:37
@ EMOTE_IGNITE
Definition molten_core.cpp:28
@ NPC_CORE_HOUND
Definition molten_core.h:63

References Creature::AI(), Creature::DespawnOrUnsummon(), EMOTE_IGNITE, WorldObject::GetCreaturesWithEntryInRange(), AuraScript::GetTarget(), Unit::IsInCombat(), Unit::Kill(), NPC_CORE_HOUND, REACT_AGGRESSIVE, Unit::RemoveAurasDueToSpell(), Object::RemoveDynamicFlag(), Unit::RemoveUnitFlag2(), Unit::SetControlled(), Creature::SetReactState(), SPELL_FIRE_NOVA_VISUAL, SPELL_FULL_HEALTH, SPELL_PLAY_DEAD_PACIFY, Object::ToCreature(), UNIT_DYNFLAG_DEAD, UNIT_FLAG2_FEIGN_DEATH, and UNIT_STATE_ROOT.

Referenced by Register().

◆ Load()

bool spell_mc_play_dead_aura::Load ( )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

116 {
117 return GetCaster()->IsCreature();
118 }
Unit * GetCaster() const
Definition SpellScript.cpp:1035
bool IsCreature() const
Definition Object.h:205

References AuraScript::GetCaster(), and Object::IsCreature().

◆ PrepareAuraScript()

spell_mc_play_dead_aura::PrepareAuraScript ( spell_mc_play_dead_aura  )
private

◆ Register()

void spell_mc_play_dead_aura::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

186 {
189 }
@ EFFECT_0
Definition SharedDefines.h:31
@ SPELL_AURA_FEIGN_DEATH
Definition SpellAuraDefines.h:129
@ AURA_EFFECT_HANDLE_REAL
Definition SpellAuraDefines.h:42
#define AuraEffectApplyFn(F, I, N, M)
Definition SpellScript.h:754
HookList< EffectApplyHandler > AfterEffectRemove
Definition SpellScript.h:764
HookList< EffectApplyHandler > AfterEffectApply
Definition SpellScript.h:753
void HandleEffectRemove(AuraEffect const *, AuraEffectHandleModes)
Definition molten_core.cpp:136
void HandleEffectApply(AuraEffect const *, AuraEffectHandleModes)
Definition molten_core.cpp:120

References AuraScript::AfterEffectApply, AuraScript::AfterEffectRemove, AURA_EFFECT_HANDLE_REAL, AuraEffectApplyFn, EFFECT_0, HandleEffectApply(), HandleEffectRemove(), and SPELL_AURA_FEIGN_DEATH.

◆ Validate()

bool spell_mc_play_dead_aura::Validate ( SpellInfo const *  )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

111 {
113 }
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition SpellScript.h:125
@ SPELL_PLAY_DEAD
Definition molten_core.cpp:35

References SPELL_PLAY_DEAD, SPELL_PLAY_DEAD_PACIFY, and _SpellScript::ValidateSpellInfo().


The documentation for this class was generated from the following file: