From ce2033dcceca37e2219a99c96bf32c590f7b109c Mon Sep 17 00:00:00 2001 From: hondacrx Date: Wed, 17 Mar 2021 16:28:12 -0400 Subject: [PATCH] Core/Auras: periodics refactor part 4: ported periodic dummy auras to scripts Port From (https://github.com/TrinityCore/TrinityCore/commit/d9b145615dd2bafe1ae74e6dc11c9b86a0fb6f28) --- Source/Game/Spells/Auras/AuraEffect.cs | 140 +----------------- ...03_07_03_world_2017_12_15_02_world_335.sql | 16 ++ 2 files changed, 17 insertions(+), 139 deletions(-) create mode 100644 sql/updates/world/master/2021_03_07_03_world_2017_12_15_02_world_335.sql diff --git a/Source/Game/Spells/Auras/AuraEffect.cs b/Source/Game/Spells/Auras/AuraEffect.cs index 1e401cbea..84d27b64a 100644 --- a/Source/Game/Spells/Auras/AuraEffect.cs +++ b/Source/Game/Spells/Auras/AuraEffect.cs @@ -453,7 +453,7 @@ namespace Game.Spells switch (GetAuraType()) { case AuraType.PeriodicDummy: - HandlePeriodicDummyAuraTick(target, caster); + // handled via scripts break; case AuraType.PeriodicTriggerSpell: HandlePeriodicTriggerSpellAuraTick(target, caster); @@ -4788,144 +4788,6 @@ namespace Game.Spells target.UpdateMastery(); } - void HandlePeriodicDummyAuraTick(Unit target, Unit caster) - { - switch (GetSpellInfo().SpellFamilyName) - { - case SpellFamilyNames.Generic: - switch (GetId()) - { - case 66149: // Bullet Controller Periodic - 10 Man - case 68396: // Bullet Controller Periodic - 25 Man - { - if (caster == null) - break; - - caster.CastCustomSpell(66152, SpellValueMod.MaxTargets, RandomHelper.IRand(1, 6), target, true); - caster.CastCustomSpell(66153, SpellValueMod.MaxTargets, RandomHelper.IRand(1, 6), target, true); - break; - } - case 62292: // Blaze (Pool of Tar) - // should we use custom damage? - target.CastSpell((Unit)null, GetSpellEffectInfo().TriggerSpell, true); - break; - case 62399: // Overload Circuit - if (target.GetMap().IsDungeon() && target.GetAppliedAuras().Count(p => p.Key == 62399) >= (target.GetMap().IsHeroic() ? 4 : 2)) - { - target.CastSpell(target, 62475, true); // System Shutdown - Unit veh = target.GetVehicleBase(); - if (veh != null) - veh.CastSpell(target, 62475, true); - } - break; - case 64821: // Fuse Armor (Razorscale) - if (GetBase().GetStackAmount() == GetSpellInfo().StackAmount) - { - target.CastSpell(target, 64774, true, null, null, GetCasterGUID()); - target.RemoveAura(64821); - } - break; - } - break; - case SpellFamilyNames.Mage: - { - // Mirror Image - if (GetId() == 55342) - // Set name of summons to name of caster - target.CastSpell((Unit)null, GetSpellEffectInfo().TriggerSpell, true); - break; - } - case SpellFamilyNames.Druid: - { - switch (GetSpellInfo().Id) - { - // Frenzied Regeneration - case 22842: - { - // Converts up to 10 rage per second into health for $d. Each point of rage is converted into ${$m2/10}.1% of max health. - // Should be manauser - if (target.GetPowerType() != PowerType.Rage) - break; - int rage = target.GetPower(PowerType.Rage); - // Nothing todo - if (rage == 0) - break; - int mod = (rage < 100) ? rage : 100; - int points = target.CalculateSpellDamage(target, GetSpellInfo(), 1); - int regen = (int)((long)target.GetMaxHealth() * (mod * points / 10) / 1000); - target.CastCustomSpell(target, 22845, regen, 0, 0, true, null, this); - target.SetPower(PowerType.Rage, (rage - mod)); - break; - } - } - break; - } - case SpellFamilyNames.Rogue: - { - switch (GetSpellInfo().Id) - { - // Master of Subtlety - case 31666: - if (!target.HasAuraType(AuraType.ModStealth)) - target.RemoveAurasDueToSpell(31665); - break; - // Overkill - case 58428: - if (!target.HasAuraType(AuraType.ModStealth)) - target.RemoveAurasDueToSpell(58427); - break; - } - break; - } - case SpellFamilyNames.Hunter: - { - // Explosive Shot - if (GetSpellInfo().SpellFamilyFlags[1].HasAnyFlag(0x80000000)) - { - if (caster != null) - caster.CastCustomSpell(53352, SpellValueMod.BasePoint0, m_amount, target, true, null, this); - break; - } - switch (GetSpellInfo().Id) - { - // Feeding Frenzy Rank 1 - case 53511: - if (target.GetVictim() != null && target.GetVictim().HealthBelowPct(35)) - target.CastSpell(target, 60096, true, null, this); - return; - // Feeding Frenzy Rank 2 - case 53512: - if (target.GetVictim() != null && target.GetVictim().HealthBelowPct(35)) - target.CastSpell(target, 60097, true, null, this); - return; - default: - break; - } - break; - } - case SpellFamilyNames.Shaman: - if (GetId() == 52179) // Astral Shift - { - // Periodic need for remove visual on stun/fear/silence lost - if (!target.HasUnitFlag(UnitFlags.Stunned | UnitFlags.Fleeing | UnitFlags.Silenced)) - target.RemoveAurasDueToSpell(52179); - break; - } - break; - case SpellFamilyNames.Deathknight: - switch (GetId()) - { - case 49016: // Hysteria - uint damage = (uint)target.CountPctFromMaxHealth(1); - target.DealDamage(target, damage, null, DamageEffectType.NoDamage, SpellSchoolMask.Normal, null, false); - break; - } - break; - default: - break; - } - } - void HandlePeriodicTriggerSpellAuraTick(Unit target, Unit caster) { // generic casting code with custom spells and target/caster customs diff --git a/sql/updates/world/master/2021_03_07_03_world_2017_12_15_02_world_335.sql b/sql/updates/world/master/2021_03_07_03_world_2017_12_15_02_world_335.sql new file mode 100644 index 000000000..29e2e6edb --- /dev/null +++ b/sql/updates/world/master/2021_03_07_03_world_2017_12_15_02_world_335.sql @@ -0,0 +1,16 @@ +-- DELETE FROM `spell_ranks` WHERE `first_spell_id`=60096; +DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_bullet_controller','spell_tar_blaze','spell_overload_circuit','spell_razorscale_fuse_armor'/*,'spell_mage_mirror_image','spell_dru_frenzied_regeneration','spell_rog_overkill','spell_rog_master_of_subtlety','spell_hun_explosive_shot','spell_hun_feeding_frenzy','spell_sha_astral_shift_visual_dummy','spell_dk_hysteria'*/); +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(66149, 'spell_bullet_controller'), +-- (68396, 'spell_bullet_controller'), +(62292, 'spell_tar_blaze'), +(62399, 'spell_overload_circuit'), +(64821, 'spell_razorscale_fuse_armor'); +-- 55342, 'spell_mage_mirror_image'), +-- 22842, 'spell_dru_frenzied_regeneration'), +-- (31666, 'spell_rog_master_of_subtlety'), +-- (58428, 'spell_rog_overkill'), +-- (-53301,'spell_hun_explosive_shot'), +-- (-53511,'spell_hun_feeding_frenzy'), +-- (52179, 'spell_sha_astral_shift_visual_dummy'), +-- (49016, 'spell_dk_hysteria');