Skip to content

Commit

Permalink
Spell/Auras: Implement last custom aura damage switchcase using spell…
Browse files Browse the repository at this point in the history
… scripts

Actually a functional change because now it will be used during stacking step
  • Loading branch information
killerwife committed Sep 30, 2023
1 parent 48a34f1 commit 5d15c9a
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 30 deletions.
17 changes: 17 additions & 0 deletions sql/scriptdev2/spell.sql
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,18 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(12983,'spell_shatter_mage'),
(12984,'spell_shatter_mage'),
(12985,'spell_shatter_mage'),
(543,'spell_fire_ward_mage'),
(8457,'spell_fire_ward_mage'),
(8458,'spell_fire_ward_mage'),
(10223,'spell_fire_ward_mage'),
(10225,'spell_fire_ward_mage'),
(27128,'spell_fire_ward_mage'),
(6143,'spell_frost_ward_mage'),
(8461,'spell_frost_ward_mage'),
(8462,'spell_frost_ward_mage'),
(10177,'spell_frost_ward_mage'),
(28609,'spell_frost_ward_mage'),
(32796,'spell_frost_ward_mage'),
(31679,'spell_molten_fury'),
(31680,'spell_molten_fury'),
(30455,'spell_ice_lance'),
Expand Down Expand Up @@ -898,6 +910,11 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
INSERT INTO spell_scripts(Id, ScriptName) VALUES
(6495,'spell_sentry_totem'),
(29203,'spell_healing_way'),
(8516,'spell_windfury_totem_aura'),
(10608,'spell_windfury_totem_aura'),
(10610,'spell_windfury_totem_aura'),
(25583,'spell_windfury_totem_aura'),
(25584,'spell_windfury_totem_aura'),
(974,'spell_earth_shield'),
(32593,'spell_earth_shield'),
(32594,'spell_earth_shield');
Expand Down
36 changes: 36 additions & 0 deletions src/game/Spells/Scripts/Scripting/ClassScripts/Mage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,40 @@ struct ShatterMage : public AuraScript
}
};

// 543 - Fire Ward
struct FireWardMage : public AuraScript
{
int32 OnAuraValueCalculate(AuraCalcData& data, int32 value) const override
{
if (data.caster)
{
if (data.caster->HasSpell(13043)) // Molten Shields
value += data.caster->CalculateSpellEffectValue(data.target, sSpellTemplate.LookupEntry<SpellEntry>(13043), EFFECT_INDEX_0);
else if (data.caster->HasSpell(11094)) // Molten Shields
value += data.caster->CalculateSpellEffectValue(data.target, sSpellTemplate.LookupEntry<SpellEntry>(11094), EFFECT_INDEX_0);

}
return value;
}
};

// 6143 - Frost Ward
struct FrostWardMage : public AuraScript
{
int32 OnAuraValueCalculate(AuraCalcData& data, int32 value) const override
{
if (data.caster)
{
if (data.caster->HasAura(11189)) // Frost Warding
value += data.caster->CalculateSpellEffectValue(data.target, sSpellTemplate.LookupEntry<SpellEntry>(11189), EFFECT_INDEX_1);
else if (data.caster->HasAura(28332)) // Frost Warding
value += data.caster->CalculateSpellEffectValue(data.target, sSpellTemplate.LookupEntry<SpellEntry>(28332), EFFECT_INDEX_1);

}
return value;
}
};

// 42208 - Blizzard
struct Blizzard : public SpellScript
{
Expand Down Expand Up @@ -113,6 +147,8 @@ void LoadMageScripts()
{
RegisterSpellScript<ArcaneConcentration>("spell_arcane_concentration");
RegisterSpellScript<ShatterMage>("spell_shatter_mage");
RegisterSpellScript<FireWardMage>("spell_fire_ward_mage");
RegisterSpellScript<FrostWardMage>("spell_frost_ward_mage");
RegisterSpellScript<Blizzard>("spell_blizzard");
RegisterSpellScript<MoltenFury>("spell_molten_fury");
RegisterSpellScript<IceLance>("spell_ice_lance");
Expand Down
12 changes: 12 additions & 0 deletions src/game/Spells/Scripts/Scripting/ClassScripts/Shaman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,17 @@ struct HealingWay : public AuraScript
}
};

// 8516 - Windfury Totem
struct WindfuryTotemAura : public AuraScript
{
int32 OnAuraValueCalculate(AuraCalcData& data, int32 value) const override
{
if (data.castItem)
value += (value * data.castItem->GetEnchantmentModifier() / 100);
return value;
}
};

void LoadShamanScripts()
{
Script* pNewScript = new Script;
Expand All @@ -134,4 +145,5 @@ void LoadShamanScripts()
RegisterSpellScript<SentryTotem>("spell_sentry_totem");
RegisterSpellScript<EarthShield>("spell_earth_shield");
RegisterSpellScript<HealingWay>("spell_healing_way");
RegisterSpellScript<WindfuryTotemAura>("spell_windfury_totem_aura");
}
30 changes: 0 additions & 30 deletions src/game/Spells/SpellAuras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,36 +369,6 @@ Aura::Aura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 const* curr
}
}

// scripting location for custom aura damage - needs to be moved to spellscripting for proper checkcast interaction
switch (spellproto->Id)
{
case 6143: // Frost Ward
case 8461: // spell reflect chance
case 8462:
case 10177:
case 28609:
case 32796:
{
if (eff != EFFECT_INDEX_1)
break;
SpellAuraHolder* holder = target->GetSpellAuraHolder(11189);
if (!holder)
holder = target->GetSpellAuraHolder(28332);
if (holder)
damage += target->CalculateSpellEffectValue(target, holder->GetSpellProto(), EFFECT_INDEX_1);
break;
}
case 8516: // Windfury Totem
case 10608:
case 10610:
case 25583:
case 25584:
if (castItem)
damage += (damage * castItem->GetEnchantmentModifier() / 100);
break;
default: break;
}

damage = CalculateAuraEffectValue(caster, target, spellproto, eff, damage);

damage = OnAuraValueCalculate(caster, damage, castItem);
Expand Down

0 comments on commit 5d15c9a

Please sign in to comment.