mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 17:05:44 +01:00
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
This commit is contained in:
committed by
Giacomo Pozzoni
parent
50d32fe493
commit
2cfaeb1400
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user