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

Private Member Functions

 PrepareSpellScript (spell_igb_cannon_blast)
 
bool Validate (SpellInfo const *) override
 
bool Load () override
 
void CalculatePower ()
 
void PreventPowerGainOnHit (SpellEffIndex effIndex)
 
void Register () override
 

Additional Inherited Members

- Public Member Functions inherited from SpellScript
bool _Validate (SpellInfo const *entry) override
 
bool _Load (Spell *spell)
 
void _InitHit ()
 
bool _IsEffectPrevented (SpellEffIndex effIndex)
 
bool _IsDefaultEffectPrevented (SpellEffIndex effIndex)
 
void _PrepareScriptCall (SpellScriptHookType hookType)
 
void _FinishScriptCall ()
 
bool IsInCheckCastHook () const
 
bool IsInTargetHook () const
 
bool IsInHitPhase () const
 
bool IsInEffectHook () const
 
UnitGetCaster ()
 
UnitGetOriginalCaster ()
 
SpellInfo const * GetSpellInfo ()
 
SpellValue const * GetSpellValue ()
 
WorldLocation const * GetExplTargetDest ()
 
void SetExplTargetDest (WorldLocation &loc)
 
WorldObjectGetExplTargetWorldObject ()
 
UnitGetExplTargetUnit ()
 
GameObjectGetExplTargetGObj ()
 
ItemGetExplTargetItem ()
 
UnitGetHitUnit ()
 
CreatureGetHitCreature ()
 
PlayerGetHitPlayer ()
 
ItemGetHitItem ()
 
GameObjectGetHitGObj ()
 
WorldLocationGetHitDest ()
 
int32 GetHitDamage ()
 
void SetHitDamage (int32 damage)
 
void PreventHitDamage ()
 
int32 GetHitHeal ()
 
void SetHitHeal (int32 heal)
 
void PreventHitHeal ()
 
SpellGetSpell ()
 
AuraGetHitAura ()
 
void PreventHitAura ()
 
void PreventHitEffect (SpellEffIndex effIndex)
 
void PreventHitDefaultEffect (SpellEffIndex effIndex)
 
int32 GetEffectValue () const
 
void SetEffectValue (int32 value)
 
ItemGetCastItem ()
 
void CreateItem (uint32 effIndex, uint32 itemId)
 
SpellInfo const * GetTriggeringSpell ()
 
void FinishCast (SpellCastResult result)
 
void Cancel ()
 
void SetCustomCastResultMessage (SpellCustomErrors result)
 
- 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 Register ()=0
 
virtual bool Validate (SpellInfo const *)
 
virtual bool Load ()
 
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 SpellScript
HookList< CastHandlerBeforeCast
 
HookList< CastHandlerOnCast
 
HookList< CastHandlerAfterCast
 
HookList< CheckCastHandlerOnCheckCast
 
HookList< EffectHandlerOnEffectLaunch
 
HookList< EffectHandlerOnEffectLaunchTarget
 
HookList< EffectHandlerOnEffectHit
 
HookList< EffectHandlerOnEffectHitTarget
 
HookList< BeforeHitHandlerBeforeHit
 
HookList< HitHandlerOnHit
 
HookList< HitHandlerAfterHit
 
HookList< ObjectAreaTargetSelectHandlerOnObjectAreaTargetSelect
 
HookList< ObjectTargetSelectHandlerOnObjectTargetSelect
 
HookList< DestinationTargetSelectHandlerOnDestinationTargetSelect
 
virtual bool _Validate (SpellInfo const *entry)
 
- Protected Attributes inherited from _SpellScript
uint8 m_currentScriptState
 
std::string const * m_scriptName
 
uint32 m_scriptSpellId
 

Detailed Description

Member Function Documentation

◆ CalculatePower()

void spell_igb_cannon_blast::CalculatePower ( )
inlineprivate
2309 {
2310 Unit* caster = GetCaster();
2311 if (!caster)
2312 return;
2313
2314 SpellInfo const* spellInfo = GetSpellInfo();
2315 if (!spellInfo)
2316 return;
2317
2318 // Check if the effect is energize
2319 if (spellInfo->Effects[EFFECT_1].Effect == SPELL_EFFECT_ENERGIZE)
2320 {
2321 int32 energizeAmount = spellInfo->Effects[EFFECT_1].CalcValue(caster);
2322
2323 // Apply the power gain directly to the caster
2324 caster->ModifyPower(POWER_ENERGY, energizeAmount);
2325 }
2326
2327 if (caster->GetPower(POWER_ENERGY) >= 100)
2328 {
2329 caster->CastSpell(caster, SPELL_OVERHEAT, true);
2330 if (Vehicle* vehicle = caster->GetVehicleKit())
2331 if (Unit* passenger = vehicle->GetPassenger(0))
2332 sCreatureTextMgr->SendChat(caster->ToCreature(), SAY_OVERHEAT, passenger);
2333 }
2334
2335 }
std::int32_t int32
Definition: Define.h:103
#define sCreatureTextMgr
Definition: CreatureTextMgr.h:119
@ SPELL_OVERHEAT
Definition: boss_icecrown_gunship_battle.cpp:183
@ SAY_OVERHEAT
Definition: boss_icecrown_gunship_battle.cpp:70
@ EFFECT_1
Definition: SharedDefines.h:32
@ POWER_ENERGY
Definition: SharedDefines.h:272
@ SPELL_EFFECT_ENERGIZE
Definition: SharedDefines.h:808
Creature * ToCreature()
Definition: Object.h:202
Definition: Unit.h:630
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition: Unit.cpp:14106
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:1168
uint32 GetPower(Powers power) const
Definition: Unit.h:891
Vehicle * GetVehicleKit() const
Definition: Unit.h:1672
Definition: Vehicle.h:28
Definition: SpellInfo.h:316
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition: SpellInfo.h:393
SpellInfo const * GetSpellInfo()
Definition: SpellScript.cpp:411
Unit * GetCaster()
Definition: SpellScript.cpp:401

References Unit::CastSpell(), EFFECT_1, SpellInfo::Effects, SpellScript::GetCaster(), Unit::GetPower(), SpellScript::GetSpellInfo(), Unit::GetVehicleKit(), Unit::ModifyPower(), POWER_ENERGY, SAY_OVERHEAT, sCreatureTextMgr, SPELL_EFFECT_ENERGIZE, SPELL_OVERHEAT, and Object::ToCreature().

Referenced by Register().

◆ Load()

bool spell_igb_cannon_blast::Load ( )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

2304 {
2305 return GetCaster()->IsCreature();
2306 }
bool IsCreature() const
Definition: Object.h:201

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

◆ PrepareSpellScript()

spell_igb_cannon_blast::PrepareSpellScript ( spell_igb_cannon_blast  )
private

◆ PreventPowerGainOnHit()

void spell_igb_cannon_blast::PreventPowerGainOnHit ( SpellEffIndex  effIndex)
inlineprivate
2338 {
2339 PreventHitDefaultEffect(effIndex);
2340 }
void PreventHitDefaultEffect(SpellEffIndex effIndex)
Definition: SpellScript.cpp:590

References SpellScript::PreventHitDefaultEffect().

Referenced by Register().

◆ Register()

void spell_igb_cannon_blast::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

2343 {
2346
2347 }
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:337
#define SpellCastFn(F)
Definition: SpellScript.h:324
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:336
HookList< CastHandler > OnCast
Definition: SpellScript.h:321
void PreventPowerGainOnHit(SpellEffIndex effIndex)
Definition: boss_icecrown_gunship_battle.cpp:2337
void CalculatePower()
Definition: boss_icecrown_gunship_battle.cpp:2308

References CalculatePower(), EFFECT_1, SpellScript::OnCast, SpellScript::OnEffectHitTarget, PreventPowerGainOnHit(), SPELL_EFFECT_ENERGIZE, SpellCastFn, and SpellEffectFn.

◆ Validate()

bool spell_igb_cannon_blast::Validate ( SpellInfo const *  )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

2299 {
2301 }
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:125

References SPELL_OVERHEAT, and _SpellScript::ValidateSpellInfo().