Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class spell_mage_combustion : public SpellScriptLoader
- {
- public :
- spell_mage_combustion() : SpellScriptLoader("spell_mage_combustion")
- {
- }
- class spell_mage_combustion_SpellScript : public SpellScript
- {
- PrepareSpellScript(spell_mage_combustion_SpellScript);
- bool Validate(SpellInfo const* spellInfo)
- {
- return true ;
- }
- bool Load()
- {
- return true ;
- }
- void handleResetInfernoBlastCooldownOnCast()
- {
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Entering Combusion OnCast Handler");
- if(GetCaster())
- {
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Combustion's Caster as unit is not null");
- if(Player* p = GetCaster()->ToPlayer())
- {
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Combustion's Caster as player is not null ; resetting cooldown");
- SpellCooldowns cooldowns = p->GetSpellCooldownMap();
- for(SpellCooldowns::iterator iter = cooldowns.begin() ; iter != cooldowns.end() ; ++iter)
- {
- SpellInfo const* spell = sSpellMgr->GetSpellInfo(iter->first);
- if(!spell)
- continue ;
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Player %s (guid : %u) has spell cooldown on spell %s (id : %u)", p->GetName().c_str(), p->GetGUIDLow(), spell->SpellName, spell->Id);
- }
- p->RemoveSpellCooldown(108853, true);
- /*p->RemoveAllSpellCooldown();*/ // This test has proved that event this way, the cooldown is not reset => WHY ?
- }
- }
- }
- void handleMiscOnEffectScriptEffect(SpellEffIndex effectIndex)
- {
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Entering Combusion OnEffectHitTarget Handler");
- if(Unit* target = GetExplTargetUnit())
- {
- // Combusion impact = stun
- if(GetCaster())
- {
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Combustion's Target not null ; ready to impact");
- GetCaster()->CastSpell(target, SPELL_MAGE_COMBUSTION_IMPACT);
- }
- // Periodic damages
- if(Aura* ignite = target->GetAura(SPELL_MAGE_IGNITE))
- {
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Combustion's Target has Ignite aura ; ready to apply the dot");
- if(GetCaster() && target)
- {
- GetCaster()->CastSpell(target, SPELL_MAGE_COMBUSTION_DOT) ;
- Aura* combustionDot = target->GetAura(SPELL_MAGE_COMBUSTION_DOT) ;
- if(combustionDot && ignite)
- {
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Applying the dot on Combusion target");
- combustionDot->GetEffect(0)->SetAmount(ignite->GetEffect(0)->GetAmount()) ;
- }
- }
- }
- }
- }
- void Register()
- {
- OnCast += SpellCastFn(spell_mage_combustion_SpellScript::handleResetInfernoBlastCooldownOnCast);
- OnEffectHitTarget += SpellEffectFn(spell_mage_combustion_SpellScript::handleMiscOnEffectScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
- }
- };
- SpellScript* GetSpellScript() const
- {
- return new spell_mage_combustion_SpellScript();
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment