Skip to content

Commit

Permalink
Shaman/Spell: Port fire nova to spellscript
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Sep 4, 2023
1 parent 229a26f commit b5f4b64
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 36 deletions.
9 changes: 9 additions & 0 deletions sql/scriptdev2/spell.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1337,6 +1337,15 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(49283,'spell_earth_shield'),
(49284,'spell_earth_shield'),
(2484,'spell_earthbind_totem'),
(1535,'spell_fire_nova_shaman'),
(8498,'spell_fire_nova_shaman'),
(8499,'spell_fire_nova_shaman'),
(11314,'spell_fire_nova_shaman'),
(11315,'spell_fire_nova_shaman'),
(25546,'spell_fire_nova_shaman'),
(25547,'spell_fire_nova_shaman'),
(61649,'spell_fire_nova_shaman'),
(61657,'spell_fire_nova_shaman'),
(60103,'spell_lava_lash'),
(51556,'spell_ancestral_awakening'),
(51557,'spell_ancestral_awakening'),
Expand Down
44 changes: 44 additions & 0 deletions src/game/Spells/Scripts/Scripting/ClassScripts/Shaman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,49 @@ struct HeroismBloodlust : public SpellScript
}
};

// 1535 - Fire Nova
struct FireNovaShaman : public SpellScript
{
SpellCastResult OnCheckCast(Spell* spell, bool /*strict*/) const override
{
// fire totems slot
if (!spell->GetCaster()->GetTotemGuid(TOTEM_SLOT_FIRE))
return SPELL_FAILED_TOTEMS;
return SPELL_CAST_OK;
}

void OnEffectExecute(Spell* spell, SpellEffectIndex effIdx) const override
{
if (effIdx != EFFECT_INDEX_0)
return;

// fire totems slot
Totem* totem = spell->GetCaster()->GetTotem(TOTEM_SLOT_FIRE);
if (!totem)
return;

uint32 triggered_spell_id;
switch (spell->m_spellInfo->Id)
{
case 1535: triggered_spell_id = 8349; break;
case 8498: triggered_spell_id = 8502; break;
case 8499: triggered_spell_id = 8503; break;
case 11314: triggered_spell_id = 11306; break;
case 11315: triggered_spell_id = 11307; break;
case 25546: triggered_spell_id = 25535; break;
case 25547: triggered_spell_id = 25537; break;
case 61649: triggered_spell_id = 61650; break;
case 61657: triggered_spell_id = 61654; break;
default: return;
}

totem->CastSpell(totem, triggered_spell_id, TRIGGERED_OLD_TRIGGERED, nullptr, nullptr, spell->GetCaster()->GetObjectGuid());

// Fire Nova Visual
totem->CastSpell(nullptr, 19823, TRIGGERED_OLD_TRIGGERED, nullptr, nullptr, spell->GetCaster()->GetObjectGuid());
}
};

void LoadShamanScripts()
{
Script* pNewScript = new Script;
Expand All @@ -273,4 +316,5 @@ void LoadShamanScripts()
RegisterSpellScript<StoneclawTotem>("spell_stoneclaw_totem");
RegisterSpellScript<StoneclawTotemAbsorb>("spell_stoneclaw_totem_absorb");
RegisterSpellScript<HeroismBloodlust>("spell_heroism_bloodlust");
RegisterSpellScript<FireNovaShaman>("spell_fire_nova_shaman");
}
7 changes: 0 additions & 7 deletions src/game/Spells/Spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6158,13 +6158,6 @@ SpellCastResult Spell::CheckCast(bool strict)
else if (!m_caster->CanAssistSpell(target, m_spellInfo))
return SPELL_FAILED_BAD_TARGETS;
}
// Fire Nova
if (m_caster->IsPlayer() && m_spellInfo->SpellFamilyName == SPELLFAMILY_SHAMAN && m_spellInfo->SpellIconID == 33)
{
// fire totems slot
if (!m_caster->GetTotemGuid(TOTEM_SLOT_FIRE))
return SPELL_FAILED_TOTEMS;
}
break;
}
case SPELL_EFFECT_DISTRACT: // All nearby enemies must not be in combat
Expand Down
29 changes: 0 additions & 29 deletions src/game/Spells/SpellEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4344,35 +4344,6 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx)
m_caster->CastCustomSpell(unitTarget, 39609, &EffectBasePoints0, nullptr, nullptr, TRIGGERED_OLD_TRIGGERED, nullptr, nullptr, m_originalCasterGUID);
return;
}
// Fire Nova
if (m_spellInfo->SpellIconID == 33)
{
// fire totems slot
Totem* totem = m_caster->GetTotem(TOTEM_SLOT_FIRE);
if (!totem)
return;

uint32 triggered_spell_id;
switch (m_spellInfo->Id)
{
case 1535: triggered_spell_id = 8349; break;
case 8498: triggered_spell_id = 8502; break;
case 8499: triggered_spell_id = 8503; break;
case 11314: triggered_spell_id = 11306; break;
case 11315: triggered_spell_id = 11307; break;
case 25546: triggered_spell_id = 25535; break;
case 25547: triggered_spell_id = 25537; break;
case 61649: triggered_spell_id = 61650; break;
case 61657: triggered_spell_id = 61654; break;
default: return;
}

totem->CastSpell(totem, triggered_spell_id, TRIGGERED_OLD_TRIGGERED, nullptr, nullptr, m_caster->GetObjectGuid());

// Fire Nova Visual
totem->CastSpell(totem, 19823, TRIGGERED_OLD_TRIGGERED, nullptr, nullptr, m_caster->GetObjectGuid());
return;
}
break;
}
case SPELLFAMILY_DEATHKNIGHT:
Expand Down

0 comments on commit b5f4b64

Please sign in to comment.