diff options
author | Sorikoff <46191832+Sorikoff@users.noreply.github.com> | 2019-04-16 07:49:39 +0000 |
---|---|---|
committer | Giacomo Pozzoni <giacomopoz@gmail.com> | 2019-04-16 09:49:39 +0200 |
commit | 2cfaeb14004cfbb5500855472ad89ab9238df13d (patch) | |
tree | e8c5c694cfa4f548bc3a3b988bc037557b65147c | |
parent | 50d32fe49386598c7cd876e51cf02478669cc252 (diff) |
Scripts/Spells: Migrate Some Scripted Spells to Scripts (#23185)
* Migrate spells to scripts
* Simplify code
* I need to sleep
* Update chapter1.cpp
* Use actual damage
* No need in null check here
-rw-r--r-- | sql/updates/world/3.3.5/9999_99_99_99_world.sql | 20 | ||||
-rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 168 | ||||
-rw-r--r-- | src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp | 47 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_dk.cpp | 44 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 36 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_item.cpp | 67 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_quest.cpp | 28 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_shaman.cpp | 41 |
8 files changed, 283 insertions, 168 deletions
diff --git a/sql/updates/world/3.3.5/9999_99_99_99_world.sql b/sql/updates/world/3.3.5/9999_99_99_99_world.sql new file mode 100644 index 00000000000..6056582868d --- /dev/null +++ b/sql/updates/world/3.3.5/9999_99_99_99_world.sql @@ -0,0 +1,20 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_death_knight_initiate_visual', 'spell_dk_glyph_of_scourge_strike_script', 'spell_item_mirrens_drinking_hat', 'spell_item_goblin_weather_machine', 'spell_gen_5000_gold', 'spell_sha_stoneclaw_totem', 'spell_gen_remove_impairing_auras', 'spell_q1846_bending_shinbone'); +INSERT INTO `spell_script_names` VALUES +(51519, 'spell_death_knight_initiate_visual'), +(69961, 'spell_dk_glyph_of_scourge_strike_script'), +(29830, 'spell_item_mirrens_drinking_hat'), +(46203, 'spell_item_goblin_weather_machine'), +(46642, 'spell_gen_5000_gold'), +(55328, 'spell_sha_stoneclaw_totem'), +(55329, 'spell_sha_stoneclaw_totem'), +(55330, 'spell_sha_stoneclaw_totem'), +(55332, 'spell_sha_stoneclaw_totem'), +(55333, 'spell_sha_stoneclaw_totem'), +(55335, 'spell_sha_stoneclaw_totem'), +(55278, 'spell_sha_stoneclaw_totem'), +(58589, 'spell_sha_stoneclaw_totem'), +(58590, 'spell_sha_stoneclaw_totem'), +(58591, 'spell_sha_stoneclaw_totem'), +(20589, 'spell_gen_remove_impairing_auras'), +(30918, 'spell_gen_remove_impairing_auras'), +(8856, 'spell_q1846_bending_shinbone'); diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index cbcd6e95e70..23539d25bb6 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -3487,54 +3487,11 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) { switch (m_spellInfo->Id) { - // Glyph of Scourge Strike - case 69961: - { - if (!unitCaster) - return; - - Unit::AuraEffectList const& mPeriodic = unitTarget->GetAuraEffectsByType(SPELL_AURA_PERIODIC_DAMAGE); - for (Unit::AuraEffectList::const_iterator i = mPeriodic.begin(); i != mPeriodic.end(); ++i) - { - AuraEffect const* aurEff = *i; - SpellInfo const* spellInfo = aurEff->GetSpellInfo(); - // search our Blood Plague and Frost Fever on target - if (spellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && spellInfo->SpellFamilyFlags[2] & 0x2 && - aurEff->GetCasterGUID() == unitCaster->GetGUID()) - { - uint32 countMin = aurEff->GetBase()->GetMaxDuration(); - uint32 countMax = spellInfo->GetMaxDuration(); - - // this Glyph - countMax += 9000; - // talent Epidemic - if (AuraEffect const* epidemic = unitCaster->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, 234, EFFECT_0)) - countMax += epidemic->GetAmount(); - - if (countMin < countMax) - { - aurEff->GetBase()->SetDuration(aurEff->GetBase()->GetDuration() + 3000); - aurEff->GetBase()->SetMaxDuration(countMin + 3000); - } - } - } - return; - } case 55693: // Remove Collapsing Cave Aura if (!unitTarget) return; unitTarget->RemoveAurasDueToSpell(m_spellInfo->Effects[effIndex].CalcValue()); break; - // Bending Shinbone - case 8856: - { - if (!itemTarget && m_caster->GetTypeId() != TYPEID_PLAYER) - return; - - uint32 const spell_id = roll_chance_i(20) ? 8854 : 8855; - m_caster->CastSpell(m_caster, spell_id, true); - return; - } // Brittle Armor - need remove one 24575 Brittle Armor aura case 24590: unitTarget->RemoveAuraFromStack(24575); @@ -3569,33 +3526,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) m_caster->CastSpell(unitTarget, 22682, true); return; } - // Mirren's Drinking Hat - case 29830: - { - uint32 item = 0; - switch (urand(1, 6)) - { - case 1: - case 2: - case 3: - item = 23584; break; // Loch Modan Lager - case 4: - case 5: - item = 23585; break; // Stouthammer Lite - case 6: - item = 23586; break; // Aerie Peak Pale Ale - } - if (item) - DoCreateItem(effIndex, item); - break; - } - case 20589: // Escape artist - case 30918: // Improved Sprint - { - // Removes snares and roots. - unitTarget->RemoveMovementImpairingAuras(true); - break; - } // Mug Transformation case 41931: { @@ -3640,69 +3570,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) break; } - // Goblin Weather Machine - case 46203: - { - if (!unitTarget) - return; - - uint32 spellId = 0; - switch (rand32() % 4) - { - case 0: spellId = 46740; break; - case 1: spellId = 46739; break; - case 2: spellId = 46738; break; - case 3: spellId = 46736; break; - } - unitTarget->CastSpell(unitTarget, spellId, true); - break; - } - // 5,000 Gold - case 46642: - { - if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) - return; - - unitTarget->ToPlayer()->ModifyMoney(5000 * GOLD); - break; - } - // Death Knight Initiate Visual - case 51519: - { - if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) - return; - - uint32 iTmpSpellId = 0; - switch (unitTarget->GetDisplayId()) - { - case 25369: iTmpSpellId = 51552; break; // bloodelf female - case 25373: iTmpSpellId = 51551; break; // bloodelf male - case 25363: iTmpSpellId = 51542; break; // draenei female - case 25357: iTmpSpellId = 51541; break; // draenei male - case 25361: iTmpSpellId = 51537; break; // dwarf female - case 25356: iTmpSpellId = 51538; break; // dwarf male - case 25372: iTmpSpellId = 51550; break; // forsaken female - case 25367: iTmpSpellId = 51549; break; // forsaken male - case 25362: iTmpSpellId = 51540; break; // gnome female - case 25359: iTmpSpellId = 51539; break; // gnome male - case 25355: iTmpSpellId = 51534; break; // human female - case 25354: iTmpSpellId = 51520; break; // human male - case 25360: iTmpSpellId = 51536; break; // nightelf female - case 25358: iTmpSpellId = 51535; break; // nightelf male - case 25368: iTmpSpellId = 51544; break; // orc female - case 25364: iTmpSpellId = 51543; break; // orc male - case 25371: iTmpSpellId = 51548; break; // tauren female - case 25366: iTmpSpellId = 51547; break; // tauren male - case 25370: iTmpSpellId = 51545; break; // troll female - case 25365: iTmpSpellId = 51546; break; // troll male - default: return; - } - - unitTarget->CastSpell(unitTarget, iTmpSpellId, true); - Creature* npc = unitTarget->ToCreature(); - npc->LoadEquipment(); - return; - } // Deathbolt from Thalgran Blightbringer // reflected by Freya's Ward // Retribution by Sevenfold Retribution @@ -3841,41 +3708,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) return; } - // Stoneclaw Totem - case 55328: // Rank 1 - case 55329: // Rank 2 - case 55330: // Rank 3 - case 55332: // Rank 4 - case 55333: // Rank 5 - case 55335: // Rank 6 - case 55278: // Rank 7 - case 58589: // Rank 8 - case 58590: // Rank 9 - case 58591: // Rank 10 - { - // Cast Absorb on totems - for (uint8 slot = SUMMON_SLOT_TOTEM; slot < MAX_TOTEM_SLOT; ++slot) - { - if (!unitTarget->m_SummonSlot[slot]) - continue; - - Creature* totem = unitTarget->GetMap()->GetCreature(unitTarget->m_SummonSlot[slot]); - if (totem && totem->IsTotem()) - { - CastSpellExtraArgs args(TRIGGERED_FULL_MASK); - args.AddSpellMod(SPELLVALUE_BASE_POINT0, damage); - m_caster->CastSpell(totem, 55277, args); - } - } - // Glyph of Stoneclaw Totem - if (AuraEffect* aur = unitTarget->GetAuraEffect(63298, 0)) - { - CastSpellExtraArgs args(TRIGGERED_FULL_MASK); - args.AddSpellMod(SPELLVALUE_BASE_POINT0, damage * aur->GetAmount()); - m_caster->CastSpell(unitTarget, 55277, args); - } - break; - } case 45668: // Ultra-Advanced Proto-Typical Shortening Blaster { if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index 03997159001..832d4d46076 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -348,6 +348,52 @@ class go_acherus_soul_prison : public GameObjectScript } }; +class spell_death_knight_initiate_visual : public SpellScript +{ + PrepareSpellScript(spell_death_knight_initiate_visual); + + void HandleScriptEffect(SpellEffIndex /* effIndex */) + { + Creature* target = GetHitCreature(); + if (!target) + return; + + uint32 spellId; + switch (target->GetDisplayId()) + { + case 25369: spellId = 51552; break; // bloodelf female + case 25373: spellId = 51551; break; // bloodelf male + case 25363: spellId = 51542; break; // draenei female + case 25357: spellId = 51541; break; // draenei male + case 25361: spellId = 51537; break; // dwarf female + case 25356: spellId = 51538; break; // dwarf male + case 25372: spellId = 51550; break; // forsaken female + case 25367: spellId = 51549; break; // forsaken male + case 25362: spellId = 51540; break; // gnome female + case 25359: spellId = 51539; break; // gnome male + case 25355: spellId = 51534; break; // human female + case 25354: spellId = 51520; break; // human male + case 25360: spellId = 51536; break; // nightelf female + case 25358: spellId = 51535; break; // nightelf male + case 25368: spellId = 51544; break; // orc female + case 25364: spellId = 51543; break; // orc male + case 25371: spellId = 51548; break; // tauren female + case 25366: spellId = 51547; break; // tauren male + case 25370: spellId = 51545; break; // troll female + case 25365: spellId = 51546; break; // troll male + default: return; + } + + target->CastSpell(target, spellId, true); + target->LoadEquipment(); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_death_knight_initiate_visual::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + /*###### ## npc_eye_of_acherus ######*/ @@ -1243,6 +1289,7 @@ void AddSC_the_scarlet_enclave_c1() new npc_unworthy_initiate(); new npc_unworthy_initiate_anchor(); new go_acherus_soul_prison(); + RegisterSpellScript(spell_death_knight_initiate_visual); new npc_eye_of_acherus(); new npc_death_knight_initiate(); RegisterCreatureAI(npc_dark_rider_of_acherus); diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 5739c27ee33..118d8a0f327 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -1270,6 +1270,49 @@ class spell_dk_glyph_of_scourge_strike : public SpellScriptLoader } }; +// 69961 - Glyph of Scourge Strike +class spell_dk_glyph_of_scourge_strike_script : public SpellScript +{ + PrepareSpellScript(spell_dk_glyph_of_scourge_strike_script); + + void HandleScriptEffect(SpellEffIndex /* effIndex */) + { + Unit* caster = GetCaster(); + Unit* target = GetHitUnit(); + + Unit::AuraEffectList const& mPeriodic = target->GetAuraEffectsByType(SPELL_AURA_PERIODIC_DAMAGE); + for (Unit::AuraEffectList::const_iterator i = mPeriodic.begin(); i != mPeriodic.end(); ++i) + { + AuraEffect const* aurEff = *i; + SpellInfo const* spellInfo = aurEff->GetSpellInfo(); + // search our Blood Plague and Frost Fever on target + if (spellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && spellInfo->SpellFamilyFlags[2] & 0x2 && + aurEff->GetCasterGUID() == caster->GetGUID()) + { + uint32 countMin = aurEff->GetBase()->GetMaxDuration(); + uint32 countMax = spellInfo->GetMaxDuration(); + + // this Glyph + countMax += 9000; + // talent Epidemic + if (AuraEffect const* epidemic = caster->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, 234, EFFECT_0)) + countMax += epidemic->GetAmount(); + + if (countMin < countMax) + { + aurEff->GetBase()->SetDuration(aurEff->GetBase()->GetDuration() + 3000); + aurEff->GetBase()->SetMaxDuration(countMin + 3000); + } + } + } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_dk_glyph_of_scourge_strike_script::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + // 49016 - Hysteria class spell_dk_hysteria : public AuraScript { @@ -3029,6 +3072,7 @@ void AddSC_deathknight_spell_scripts() new spell_dk_ghoul_explode(); new spell_dk_glyph_of_death_grip(); new spell_dk_glyph_of_scourge_strike(); + RegisterSpellScript(spell_dk_glyph_of_scourge_strike_script); RegisterAuraScript(spell_dk_hysteria); new spell_dk_hungering_cold(); new spell_dk_icebound_fortitude(); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 861bf997a99..92218791e1f 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1767,6 +1767,23 @@ class spell_steal_essence_visual : public AuraScript } }; +// 46642 - 5,000 Gold +class spell_gen_5000_gold : public SpellScript +{ + PrepareSpellScript(spell_gen_5000_gold); + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Player* target = GetHitPlayer()) + target->ModifyMoney(5000 * GOLD); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_gen_5000_gold::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + enum TransporterBackfires { SPELL_TRANSPORTER_MALFUNCTION_POLYMORPH = 23444, @@ -2861,6 +2878,23 @@ class spell_gen_remove_flight_auras : public SpellScript } }; +// 20589 - Escape artist +// 30918 - Improved Sprint +class spell_gen_remove_impairing_auras : public SpellScript +{ + PrepareSpellScript(spell_gen_remove_impairing_auras); + + void HandleScriptEffect(SpellEffIndex /* effIndex */) + { + GetHitUnit()->RemoveMovementImpairingAuras(true); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_gen_remove_impairing_auras::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + // 23493 - Restoration // 24379 - Restoration class spell_gen_restoration : public AuraScript @@ -4259,6 +4293,7 @@ void AddSC_generic_spell_scripts() RegisterSpellScript(spell_ethereal_pet_onsummon); RegisterSpellScript(spell_ethereal_pet_aura_remove); RegisterAuraScript(spell_steal_essence_visual); + RegisterSpellScript(spell_gen_5000_gold); RegisterSpellScript(spell_gen_gadgetzan_transporter_backfire); RegisterAuraScript(spell_gen_gift_of_naaru); RegisterSpellScript(spell_gen_gnomish_transporter); @@ -4300,6 +4335,7 @@ void AddSC_generic_spell_scripts() RegisterSpellScript(spell_gen_pet_summoned); RegisterSpellScript(spell_gen_profession_research); RegisterSpellScript(spell_gen_remove_flight_auras); + RegisterSpellScript(spell_gen_remove_impairing_auras); RegisterAuraScript(spell_gen_restoration); RegisterSpellAndAuraScriptPair(spell_gen_replenishment, spell_gen_replenishment_aura); RegisterAuraScript(spell_gen_remove_on_health_pct); diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index f95f74ed6c5..69b81267db1 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -650,6 +650,34 @@ class spell_item_decahedral_dwarven_dice : public SpellScript } }; +enum GoblinWeatherMachine +{ + SPELL_PERSONALIZED_WEATHER1 = 46740, + SPELL_PERSONALIZED_WEATHER2 = 46739, + SPELL_PERSONALIZED_WEATHER3 = 46738, + SPELL_PERSONALIZED_WEATHER4 = 46736 +}; + +// 46203 - Goblin Weather Machine +class spell_item_goblin_weather_machine : public SpellScript +{ + PrepareSpellScript(spell_item_goblin_weather_machine); + + void HandleScript(SpellEffIndex /* effIndex */) + { + Unit* target = GetHitUnit(); + + uint32 spellId = RAND(SPELL_PERSONALIZED_WEATHER1, SPELL_PERSONALIZED_WEATHER2, SPELL_PERSONALIZED_WEATHER3, + SPELL_PERSONALIZED_WEATHER4); + target->CastSpell(target, spellId, true); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_goblin_weather_machine::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + // 8342 - Defibrillate (Goblin Jumper Cables) have 33% chance on success // 22999 - Defibrillate (Goblin Jumper Cables XL) have 50% chance on success // 54732 - Defibrillate (Gnomish Army Knife) have 67% chance on success @@ -3687,6 +3715,43 @@ class spell_item_taunt_flag_targeting : public SpellScript } }; +enum MirrensDrinkingHat +{ + ITEM_LOCH_MODAN_LAGER = 23584, + ITEM_STOUTHAMMER_LITE = 23585, + ITEM_AERIE_PEAK_PALE_ALE = 23586 +}; + +// 29830 - Mirren's Drinking Hat +class spell_item_mirrens_drinking_hat : public SpellScript +{ + PrepareSpellScript(spell_item_mirrens_drinking_hat); + + void HandleScriptEffect(SpellEffIndex effIndex) + { + uint32 itemId; + switch (urand(1, 6)) + { + case 1: + case 2: + case 3: + itemId = ITEM_LOCH_MODAN_LAGER; break; + case 4: + case 5: + itemId = ITEM_STOUTHAMMER_LITE; break; + case 6: + itemId = ITEM_AERIE_PEAK_PALE_ALE; break; + } + if (itemId) + CreateItem(effIndex, itemId); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_mirrens_drinking_hat::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + // 13180 - Gnomish Mind Control Cap enum MindControlCap { @@ -3972,6 +4037,7 @@ void AddSC_item_spell_scripts() new spell_item_deathbringers_will<SPELL_STRENGTH_OF_THE_TAUNKA, SPELL_AGILITY_OF_THE_VRYKUL, SPELL_POWER_OF_THE_TAUNKA, SPELL_AIM_OF_THE_IRON_DWARVES, SPELL_SPEED_OF_THE_VRYKUL>("spell_item_deathbringers_will_normal"); new spell_item_deathbringers_will<SPELL_STRENGTH_OF_THE_TAUNKA_HERO, SPELL_AGILITY_OF_THE_VRYKUL_HERO, SPELL_POWER_OF_THE_TAUNKA_HERO, SPELL_AIM_OF_THE_IRON_DWARVES_HERO, SPELL_SPEED_OF_THE_VRYKUL_HERO>("spell_item_deathbringers_will_heroic"); RegisterSpellScript(spell_item_decahedral_dwarven_dice); + RegisterSpellScript(spell_item_goblin_weather_machine); new spell_item_defibrillate("spell_item_goblin_jumper_cables", 67, SPELL_GOBLIN_JUMPER_CABLES_FAIL); new spell_item_defibrillate("spell_item_goblin_jumper_cables_xl", 50, SPELL_GOBLIN_JUMPER_CABLES_XL_FAIL); new spell_item_defibrillate("spell_item_gnomish_army_knife", 33); @@ -4060,6 +4126,7 @@ void AddSC_item_spell_scripts() RegisterAuraScript(spell_item_charm_witch_doctor); RegisterAuraScript(spell_item_mana_drain); RegisterSpellScript(spell_item_taunt_flag_targeting); + RegisterSpellScript(spell_item_mirrens_drinking_hat); RegisterSpellScript(spell_item_mind_control_cap); RegisterSpellScript(spell_item_universal_remote); diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index c5444a7735f..abad84b9876 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -87,6 +87,33 @@ class spell_q55_sacred_cleansing : public SpellScriptLoader } }; +enum BendingShinbone +{ + SPELL_BENDING_SHINBONE1 = 8854, + SPELL_BENDING_SHINBONE2 = 8855 +}; + +class spell_q1846_bending_shinbone : public SpellScript +{ + PrepareSpellScript(spell_q1846_bending_shinbone); + + void HandleScriptEffect(SpellEffIndex /* effIndex */) + { + Item* target = GetHitItem(); + Unit* caster = GetCaster(); + if (!target && caster->GetTypeId() != TYPEID_PLAYER) + return; + + uint32 const spellId = roll_chance_i(20) ? SPELL_BENDING_SHINBONE1 : SPELL_BENDING_SHINBONE2; + caster->CastSpell(caster, spellId, true); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_q1846_bending_shinbone::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + // 9712 - Thaumaturgy Channel enum ThaumaturgyChannel { @@ -2869,6 +2896,7 @@ public: void AddSC_quest_spell_scripts() { new spell_q55_sacred_cleansing(); + RegisterSpellScript(spell_q1846_bending_shinbone); new spell_q2203_thaumaturgy_channel(); new spell_q5206_test_fetid_skull(); new spell_q6124_6129_apply_salve(); diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 306be865ae4..e765b12e932 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -87,6 +87,8 @@ enum ShamanSpells SPELL_SHAMAN_CHAIN_LIGHTNING_OVERLOAD_R1 = 45297, SPELL_SHAMAN_LIGHTNING_SHIELD_DAMAGE_R1 = 26364, SPELL_SHAMAN_SHAMANISTIC_RAGE_PROC = 30824, + SPELL_SHAMAN_STONECLAW_TOTEM = 55277, + SPELL_SHAMAN_GLYPH_OF_STONECLAW_TOTEM = 63298, SPELL_SHAMAN_MAELSTROM_POWER = 70831, SPELL_SHAMAN_T10_ENHANCEMENT_4P_BONUS = 70832, SPELL_SHAMAN_BLESSING_OF_THE_ETERNALS_R1 = 51554, @@ -1780,6 +1782,44 @@ class spell_sha_shamanistic_rage : public SpellScriptLoader } }; +class spell_sha_stoneclaw_totem : public SpellScript +{ + PrepareSpellScript(spell_sha_stoneclaw_totem); + + void HandleScriptEffect(SpellEffIndex /* effIndex */) + { + Unit* target = GetHitUnit(); + + // Cast Absorb on totems + for (uint8 slot = SUMMON_SLOT_TOTEM; slot < MAX_TOTEM_SLOT; ++slot) + { + if (!target->m_SummonSlot[slot]) + continue; + + Creature* totem = target->GetMap()->GetCreature(target->m_SummonSlot[slot]); + if (totem && totem->IsTotem()) + { + CastSpellExtraArgs args(TRIGGERED_FULL_MASK); + args.AddSpellMod(SPELLVALUE_BASE_POINT0, GetEffectValue()); + GetCaster()->CastSpell(totem, SPELL_SHAMAN_STONECLAW_TOTEM, args); + } + } + + // Glyph of Stoneclaw Totem + if (AuraEffect* aur = target->GetAuraEffect(SPELL_SHAMAN_GLYPH_OF_STONECLAW_TOTEM, 0)) + { + CastSpellExtraArgs args(TRIGGERED_FULL_MASK); + args.AddSpellMod(SPELLVALUE_BASE_POINT0, GetEffectValue() * aur->GetAmount()); + GetCaster()->CastSpell(target, SPELL_SHAMAN_STONECLAW_TOTEM, args); + } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_sha_stoneclaw_totem::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + // 58877 - Spirit Hunt class spell_sha_spirit_hunt : public SpellScriptLoader { @@ -2385,6 +2425,7 @@ void AddSC_shaman_spell_scripts() new spell_sha_nature_guardian(); new spell_sha_sentry_totem(); new spell_sha_shamanistic_rage(); + RegisterSpellScript(spell_sha_stoneclaw_totem); new spell_sha_spirit_hunt(); new spell_sha_static_shock(); new spell_sha_tidal_force_dummy(); |