Scripts/Spells: Small cleanup for gen/item spell scripts (#27311)

This commit is contained in:
offl
2021-11-24 17:05:01 +02:00
committed by GitHub
parent eb812bf3d5
commit ef4c878d26
6 changed files with 71 additions and 102 deletions

View File

@@ -0,0 +1,5 @@
--
DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_item_shimmering_vessel', 'spell_gen_arcane_charge');
UPDATE `spell_script_names` SET `ScriptName` = 'spell_muru_negative_energy_periodic' WHERE `ScriptName` = 'spell_gen_negative_energy_periodic';
UPDATE `spell_script_names` SET `ScriptName` = 'spell_reliquary_of_souls_aura_of_anger' WHERE `ScriptName` = 'spell_gen_aura_of_anger';
UPDATE `spell_script_names` SET `ScriptName` = 'spell_brutallus_burn' WHERE `ScriptName` = 'spell_gen_burn_brutallus';

View File

@@ -25,6 +25,8 @@ EndScriptData */
#include "InstanceScript.h"
#include "Log.h"
#include "ScriptedCreature.h"
#include "SpellAuraEffects.h"
#include "SpellScript.h"
#include "sunwell_plateau.h"
enum Quotes
@@ -343,7 +345,25 @@ public:
}
};
// 46394 - Burn
class spell_brutallus_burn : public AuraScript
{
PrepareAuraScript(spell_brutallus_burn);
void HandleEffectPeriodicUpdate(AuraEffect* aurEff)
{
if (aurEff->GetTickNumber() % 11 == 0)
aurEff->SetAmount(aurEff->GetAmount() * 2);
}
void Register() override
{
OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_brutallus_burn::HandleEffectPeriodicUpdate, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
}
};
void AddSC_boss_brutallus()
{
new boss_brutallus();
RegisterSpellScript(spell_brutallus_burn);
}

View File

@@ -19,6 +19,7 @@
#include "InstanceScript.h"
#include "ObjectAccessor.h"
#include "ScriptedCreature.h"
#include "SpellAuraEffects.h"
#include "SpellAuras.h"
#include "SpellScript.h"
#include "sunwell_plateau.h"
@@ -608,6 +609,31 @@ class spell_summon_blood_elves_periodic : public AuraScript
}
};
// 46284 - Negative Energy Periodic
class spell_muru_negative_energy_periodic : public AuraScript
{
PrepareAuraScript(spell_muru_negative_energy_periodic);
bool Validate(SpellInfo const* spellInfo) override
{
return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell });
}
void PeriodicTick(AuraEffect const* aurEff)
{
PreventDefaultAction();
CastSpellExtraArgs args(aurEff);
args.AddSpellMod(SPELLVALUE_MAX_TARGETS, aurEff->GetTickNumber() / 10 + 1);
GetTarget()->CastSpell(nullptr, aurEff->GetSpellEffectInfo().TriggerSpell, args);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_muru_negative_energy_periodic::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
void AddSC_boss_muru()
{
RegisterSunwellPlateauCreatureAI(boss_muru);
@@ -621,4 +647,5 @@ void AddSC_boss_muru()
RegisterSpellScript(spell_dark_fiend_skin);
RegisterSpellScript(spell_transform_visual_missile_periodic);
RegisterSpellScript(spell_summon_blood_elves_periodic);
RegisterSpellScript(spell_muru_negative_energy_periodic);
}

View File

@@ -745,6 +745,24 @@ class spell_reliquary_of_souls_aura_of_desire : public AuraScript
}
};
// 41337 - Aura of Anger
class spell_reliquary_of_souls_aura_of_anger : public AuraScript
{
PrepareAuraScript(spell_reliquary_of_souls_aura_of_anger);
void HandleEffectPeriodicUpdate(AuraEffect* aurEff)
{
if (AuraEffect* aurEff1 = aurEff->GetBase()->GetEffect(EFFECT_1))
aurEff1->ChangeAmount(aurEff1->GetAmount() + 5);
aurEff->SetAmount(100 * aurEff->GetTickNumber());
}
void Register() override
{
OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_reliquary_of_souls_aura_of_anger::HandleEffectPeriodicUpdate, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
}
};
// 28819 - Submerge Visual
class spell_reliquary_of_souls_submerge : public AuraScript
{
@@ -815,6 +833,7 @@ void AddSC_boss_reliquary_of_souls()
RegisterBlackTempleCreatureAI(npc_enslaved_soul);
RegisterBlackTempleCreatureAI(npc_reliquary_combat_trigger);
RegisterSpellScript(spell_reliquary_of_souls_aura_of_desire);
RegisterSpellScript(spell_reliquary_of_souls_aura_of_anger);
RegisterSpellScript(spell_reliquary_of_souls_submerge);
RegisterSpellScript(spell_reliquary_of_souls_spite);
RegisterSpellScript(spell_reliquary_of_souls_frenzy);

View File

@@ -222,27 +222,6 @@ class spell_spawn_blood_pool : public SpellScript
}
};
class spell_gen_arcane_charge : public SpellScript
{
PrepareSpellScript(spell_gen_arcane_charge);
SpellCastResult CheckRequirement()
{
if (Unit* target = GetExplTargetUnit())
{
if (!(target->GetCreatureTypeMask() & CREATURE_TYPEMASK_DEMON_OR_UNDEAD))
return SPELL_FAILED_DONT_REPORT;
}
return SPELL_CAST_OK;
}
void Register() override
{
OnCheckCast += SpellCheckCastFn(spell_gen_arcane_charge::CheckRequirement);
}
};
// 430 Drink
// 431 Drink
// 432 Drink
@@ -345,24 +324,6 @@ class spell_gen_arena_drink : public AuraScript
}
};
// 41337 Aura of Anger
class spell_gen_aura_of_anger : public AuraScript
{
PrepareAuraScript(spell_gen_aura_of_anger);
void HandleEffectPeriodicUpdate(AuraEffect* aurEff)
{
if (AuraEffect* aurEff1 = aurEff->GetBase()->GetEffect(EFFECT_1))
aurEff1->ChangeAmount(aurEff1->GetAmount() + 5);
aurEff->SetAmount(100 * aurEff->GetTickNumber());
}
void Register() override
{
OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_gen_aura_of_anger::HandleEffectPeriodicUpdate, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
}
};
// 28313 - Aura of Fear
class spell_gen_aura_of_fear : public AuraScript
{
@@ -757,23 +718,6 @@ class spell_gen_break_shield: public SpellScript
}
};
// 46394 Brutallus Burn
class spell_gen_burn_brutallus : public AuraScript
{
PrepareAuraScript(spell_gen_burn_brutallus);
void HandleEffectPeriodicUpdate(AuraEffect* aurEff)
{
if (aurEff->GetTickNumber() % 11 == 0)
aurEff->SetAmount(aurEff->GetAmount() * 2);
}
void Register() override
{
OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_gen_burn_brutallus::HandleEffectPeriodicUpdate, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
}
};
// 48750 - Burning Depths Necrolyte Image
class spell_gen_burning_depths_necrolyte_image : public AuraScript
{
@@ -2424,31 +2368,6 @@ class spell_gen_moss_covered_feet : public AuraScript
}
};
// 46284 - Negative Energy Periodic
class spell_gen_negative_energy_periodic : public AuraScript
{
PrepareAuraScript(spell_gen_negative_energy_periodic);
bool Validate(SpellInfo const* spellInfo) override
{
return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell });
}
void PeriodicTick(AuraEffect const* aurEff)
{
PreventDefaultAction();
CastSpellExtraArgs args(aurEff);
args.AddSpellMod(SPELLVALUE_MAX_TARGETS, aurEff->GetTickNumber() / 10 + 1);
GetTarget()->CastSpell(nullptr, aurEff->GetSpellEffectInfo().TriggerSpell, args);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_negative_energy_periodic::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
enum Netherbloom : uint32
{
SPELL_NETHERBLOOM_POLLEN_1 = 28703
@@ -4496,9 +4415,7 @@ void AddSC_generic_spell_scripts()
RegisterSpellScript(spell_gen_allow_cast_from_item_only);
RegisterSpellScript(spell_gen_animal_blood);
RegisterSpellScript(spell_spawn_blood_pool);
RegisterSpellScript(spell_gen_arcane_charge);
RegisterSpellScript(spell_gen_arena_drink);
RegisterSpellScript(spell_gen_aura_of_anger);
RegisterSpellScript(spell_gen_aura_of_fear);
RegisterSpellScript(spell_gen_aura_service_uniform);
RegisterSpellScript(spell_gen_av_drekthar_presence);
@@ -4509,7 +4426,6 @@ void AddSC_generic_spell_scripts()
RegisterSpellScript(spell_gen_bonked);
RegisterSpellScriptWithArgs(spell_gen_break_shield, "spell_gen_break_shield");
RegisterSpellScriptWithArgs(spell_gen_break_shield, "spell_gen_tournament_counterattack");
RegisterSpellScript(spell_gen_burn_brutallus);
RegisterSpellScript(spell_gen_burning_depths_necrolyte_image);
RegisterSpellScript(spell_gen_cannibalize);
RegisterSpellScript(spell_gen_chains_of_ice);
@@ -4567,7 +4483,6 @@ void AddSC_generic_spell_scripts()
RegisterSpellScriptWithArgs(spell_gen_mount, "spell_x53_touring_rocket", 0, 0, 0, SPELL_X53_TOURING_ROCKET_150, SPELL_X53_TOURING_ROCKET_280, SPELL_X53_TOURING_ROCKET_310);
RegisterSpellScript(spell_gen_mounted_charge);
RegisterSpellScript(spell_gen_moss_covered_feet);
RegisterSpellScript(spell_gen_negative_energy_periodic);
RegisterSpellScript(spell_gen_netherbloom);
RegisterSpellScript(spell_gen_nightmare_vine);
RegisterSpellScript(spell_gen_nitrous_boost);

View File

@@ -2659,22 +2659,6 @@ class spell_magic_eater_food : public AuraScript
}
};
class spell_item_shimmering_vessel : public SpellScript
{
PrepareSpellScript(spell_item_shimmering_vessel);
void HandleDummy(SpellEffIndex /* effIndex */)
{
if (Creature* target = GetHitCreature())
target->setDeathState(JUST_RESPAWNED);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_item_shimmering_vessel::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
enum PurifyHelboarMeat
{
SPELL_SUMMON_PURIFIED_HELBOAR_MEAT = 29277,
@@ -4268,7 +4252,6 @@ void AddSC_item_spell_scripts()
RegisterSpellScript(spell_item_ashbringer);
RegisterSpellScript(spell_magic_eater_food);
RegisterSpellScript(spell_item_shimmering_vessel);
RegisterSpellScript(spell_item_purify_helboar_meat);
RegisterSpellScript(spell_item_crystal_prison_dummy_dnd);
RegisterSpellScript(spell_item_nigh_invulnerability);