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
2311 {
2312 Unit* caster = GetCaster();
2313 if (!caster)
2314 return;
2315
2316 SpellInfo const* spellInfo = GetSpellInfo();
2317 if (!spellInfo)
2318 return;
2319
2320 // Check if the effect is energize
2321 if (spellInfo->Effects[EFFECT_1].Effect == SPELL_EFFECT_ENERGIZE)
2322 {
2323 int32 energizeAmount = spellInfo->Effects[EFFECT_1].CalcValue(caster);
2324
2325 // Apply the power gain directly to the caster
2326 caster->ModifyPower(POWER_ENERGY, energizeAmount);
2327 }
2328
2329 if (caster->GetPower(POWER_ENERGY) >= 100)
2330 {
2331 caster->CastSpell(caster, SPELL_OVERHEAT, true);
2332 if (Vehicle* vehicle = caster->GetVehicleKit())
2333 if (Unit* passenger = vehicle->GetPassenger(0))
2334 sCreatureTextMgr->SendChat(caster->ToCreature(), SAY_OVERHEAT, passenger);
2335 }
2336
2337 }
std::int32_t int32
Definition: Define.h:103
@ SPELL_OVERHEAT
Definition: boss_icecrown_gunship_battle.cpp:185
@ SAY_OVERHEAT
Definition: boss_icecrown_gunship_battle.cpp:72
@ EFFECT_1
Definition: SharedDefines.h:32
@ POWER_ENERGY
Definition: SharedDefines.h:272
@ SPELL_EFFECT_ENERGIZE
Definition: SharedDefines.h:808
#define sCreatureTextMgr
Definition: CreatureTextMgr.h:118
Creature * ToCreature()
Definition: Object.h:205
Definition: Unit.h:630
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition: Unit.cpp:14149
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:1167
uint32 GetPower(Powers power) const
Definition: Unit.h:1056
Vehicle * GetVehicleKit() const
Definition: Unit.h:1785
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.

2306 {
2307 return GetCaster()->IsCreature();
2308 }
bool IsCreature() const
Definition: Object.h:204

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
2340 {
2341 PreventHitDefaultEffect(effIndex);
2342 }
void PreventHitDefaultEffect(SpellEffIndex effIndex)
Definition: SpellScript.cpp:590

References SpellScript::PreventHitDefaultEffect().

Referenced by Register().

◆ Register()

void spell_igb_cannon_blast::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

2345 {
2348
2349 }
#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:2339
void CalculatePower()
Definition: boss_icecrown_gunship_battle.cpp:2310

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.

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

References SPELL_OVERHEAT, and _SpellScript::ValidateSpellInfo().