aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Spells
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2017-12-14 12:43:32 -0300
committerariel- <ariel-@users.noreply.github.com>2017-12-15 00:35:28 -0300
commit0510bf7afe9fa5ded572cda00f5a5a989a887146 (patch)
treebf09a70a587e7fb8a7d055a3210d0a996ec08f75 /src/server/scripts/Spells
parent5d91beb1dbc795382a12ec05f6e72c76b195b141 (diff)
Core/Auras: periodics refactor part 2: Move UpdatePeriodic to AuraScripts
Diffstat (limited to 'src/server/scripts/Spells')
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp132
1 files changed, 132 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 4a95c19c628..05fbc6b3423 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -201,6 +201,96 @@ class spell_gen_animal_blood : public AuraScript
}
};
+// 430 Drink
+// 431 Drink
+// 432 Drink
+// 1133 Drink
+// 1135 Drink
+// 1137 Drink
+// 10250 Drink
+// 22734 Drink
+// 27089 Drink
+// 34291 Drink
+// 43182 Drink
+// 43183 Drink
+// 46755 Drink
+// 49472 Drink Coffee
+// 57073 Drink
+// 61830 Drink
+// 72623 Drink
+class spell_gen_arena_drink : public AuraScript
+{
+ PrepareAuraScript(spell_gen_arena_drink);
+
+ bool Load() override
+ {
+ return GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER;
+ }
+
+ void CalcPeriodic(AuraEffect const* aurEff, bool& isPeriodic, int32& amplitude)
+ {
+ // Get SPELL_AURA_MOD_POWER_REGEN aura from spell
+ AuraEffect* regen = GetAura()->GetEffect(EFFECT_0);
+ if (!regen)
+ return;
+
+ if (regen->GetAuraType() != SPELL_AURA_MOD_POWER_REGEN)
+ {
+ isPeriodic = false;
+ TC_LOG_ERROR("spells", "Aura %d structure has been changed - first aura is no longer SPELL_AURA_MOD_POWER_REGEN", GetId());
+ }
+ else
+ {
+ // default case - not in arena
+ if (!GetCaster()->ToPlayer()->InArena())
+ {
+ regen->ChangeAmount(aurEff->GetAmount());
+ isPeriodic = false;
+ }
+ }
+ }
+
+ void UpdatePeriodic(AuraEffect* aurEff)
+ {
+ AuraEffect* regen = GetAura()->GetEffect(EFFECT_0);
+ if (!regen)
+ return;
+
+ // **********************************************
+ // This feature used only in arenas
+ // **********************************************
+ // Here need increase mana regen per tick (6 second rule)
+ // on 0 tick - 0 (handled in 2 second)
+ // on 1 tick - 166% (handled in 4 second)
+ // on 2 tick - 133% (handled in 6 second)
+
+ // Apply bonus for 1 - 4 tick
+ switch (aurEff->GetTickNumber())
+ {
+ case 1: // 0%
+ regen->ChangeAmount(0);
+ break;
+ case 2: // 166%
+ regen->ChangeAmount(aurEff->GetAmount() * 5 / 3);
+ break;
+ case 3: // 133%
+ regen->ChangeAmount(aurEff->GetAmount() * 4 / 3);
+ break;
+ default: // 100% - normal regen
+ regen->ChangeAmount(aurEff->GetAmount());
+ // No need to update after 4th tick
+ aurEff->SetPeriodic(false);
+ break;
+ }
+ }
+
+ void Register() override
+ {
+ DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_gen_arena_drink::CalcPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY);
+ OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_gen_arena_drink::UpdatePeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY);
+ }
+};
+
// 41337 Aura of Anger
class spell_gen_aura_of_anger : public AuraScript
{
@@ -643,6 +733,29 @@ class spell_gen_cannibalize : public SpellScript
}
};
+// 45524 Chains of Ice
+// 66020 Chains of Ice
+class spell_gen_chains_of_ice : public AuraScript
+{
+ PrepareAuraScript(spell_gen_chains_of_ice);
+
+ void UpdatePeriodic(AuraEffect* aurEff)
+ {
+ // Get 0 effect aura
+ AuraEffect* slow = GetAura()->GetEffect(EFFECT_0);
+ if (!slow)
+ return;
+
+ int32 newAmount = std::min<int32>(slow->GetAmount() + aurEff->GetAmount(), 0);
+ slow->ChangeAmount(newAmount);
+ }
+
+ void Register() override
+ {
+ OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_gen_chains_of_ice::UpdatePeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY);
+ }
+};
+
enum ChaosBlast
{
SPELL_CHAOS_BLAST = 37675
@@ -2026,6 +2139,22 @@ class spell_gen_obsidian_armor : public AuraScript
}
};
+// 55342 Mirror Image
+class spell_gen_one_tick_dummy : public AuraScript
+{
+ PrepareAuraScript(spell_gen_one_tick_dummy);
+
+ void DisablePeriodic(AuraEffect* aurEff)
+ {
+ aurEff->SetPeriodic(false);
+ }
+
+ void Register() override
+ {
+ OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_gen_one_tick_dummy::DisablePeriodic, EFFECT_FIRST_FOUND, SPELL_AURA_PERIODIC_DUMMY);
+ }
+};
+
class spell_gen_oracle_wolvar_reputation : public SpellScript
{
PrepareSpellScript(spell_gen_oracle_wolvar_reputation);
@@ -3448,6 +3577,7 @@ void AddSC_generic_spell_scripts()
RegisterAuraScript(spell_gen_adaptive_warding);
RegisterSpellScript(spell_gen_allow_cast_from_item_only);
RegisterAuraScript(spell_gen_animal_blood);
+ RegisterAuraScript(spell_gen_arena_drink);
RegisterAuraScript(spell_gen_aura_of_anger);
RegisterAuraScript(spell_gen_aura_service_uniform);
RegisterAuraScript(spell_gen_av_drekthar_presence);
@@ -3460,6 +3590,7 @@ void AddSC_generic_spell_scripts()
RegisterAuraScript(spell_gen_burn_brutallus);
RegisterAuraScript(spell_gen_burning_depths_necrolyte_image);
RegisterSpellScript(spell_gen_cannibalize);
+ RegisterAuraScript(spell_gen_chains_of_ice);
RegisterSpellScript(spell_gen_chaos_blast);
RegisterSpellScript(spell_gen_clone);
RegisterSpellScript(spell_gen_clone_weapon);
@@ -3501,6 +3632,7 @@ void AddSC_generic_spell_scripts()
RegisterSpellScript(spell_gen_netherbloom);
RegisterSpellScript(spell_gen_nightmare_vine);
RegisterAuraScript(spell_gen_obsidian_armor);
+ RegisterAuraScript(spell_gen_one_tick_dummy);
RegisterSpellScript(spell_gen_oracle_wolvar_reputation);
RegisterSpellScript(spell_gen_orc_disguise);
RegisterAuraScript(spell_gen_paralytic_poison);