Core/Auras: periodics refactor part 3: move more switch hacks to scripts
Port From (https://github.com/TrinityCore/TrinityCore/commit/97e869e8b36afd9e7f0452b9001287f6b4a02ef2)
This commit is contained in:
@@ -5246,40 +5246,6 @@ namespace Game.Spells
|
|||||||
caster.SpellHitResult(target, GetSpellInfo(), false) != SpellMissInfo.None)
|
caster.SpellHitResult(target, GetSpellInfo(), false) != SpellMissInfo.None)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// some auras remove at specific health level or more
|
|
||||||
if (GetAuraType() == AuraType.PeriodicDamage)
|
|
||||||
{
|
|
||||||
switch (GetSpellInfo().Id)
|
|
||||||
{
|
|
||||||
case 43093:
|
|
||||||
case 31956:
|
|
||||||
case 38801: // Grievous Wound
|
|
||||||
case 35321:
|
|
||||||
case 38363:
|
|
||||||
case 39215: // Gushing Wound
|
|
||||||
if (target.IsFullHealth())
|
|
||||||
{
|
|
||||||
target.RemoveAurasDueToSpell(GetSpellInfo().Id);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 38772: // Grievous Wound
|
|
||||||
{
|
|
||||||
SpellEffectInfo effect = GetSpellInfo().GetEffect(1);
|
|
||||||
if (effect != null)
|
|
||||||
{
|
|
||||||
int percent = effect.CalcValue(caster);
|
|
||||||
if (!target.HealthBelowPct(percent))
|
|
||||||
{
|
|
||||||
target.RemoveAurasDueToSpell(GetSpellInfo().Id);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CleanDamage cleanDamage = new CleanDamage(0, 0, WeaponAttackType.BaseAttack, MeleeHitOutcome.Normal);
|
CleanDamage cleanDamage = new CleanDamage(0, 0, WeaponAttackType.BaseAttack, MeleeHitOutcome.Normal);
|
||||||
|
|
||||||
// AOE spells are not affected by the new periodic system.
|
// AOE spells are not affected by the new periodic system.
|
||||||
|
|||||||
@@ -2076,6 +2076,77 @@ namespace Scripts.Spells.Generic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 38772 Grievous Wound
|
||||||
|
// 43937 Grievous Wound
|
||||||
|
// 62331 Impale
|
||||||
|
[Script] // 62418 Impale
|
||||||
|
class spell_gen_remove_on_health_pct : AuraScript
|
||||||
|
{
|
||||||
|
void PeriodicTick(AuraEffect aurEff)
|
||||||
|
{
|
||||||
|
// they apply damage so no need to check for ticks here
|
||||||
|
|
||||||
|
if (GetTarget().HealthAbovePct(GetSpellInfo().GetEffect(1).CalcValue()))
|
||||||
|
{
|
||||||
|
Remove(AuraRemoveMode.EnemySpell);
|
||||||
|
PreventDefaultAction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Register()
|
||||||
|
{
|
||||||
|
OnEffectPeriodic.Add(new EffectPeriodicHandler(PeriodicTick, 0, AuraType.PeriodicDamage));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 31956 Grievous Wound
|
||||||
|
// 38801 Grievous Wound
|
||||||
|
// 43093 Grievous Throw
|
||||||
|
// 58517 Grievous Wound
|
||||||
|
[Script] // 59262 Grievous Wound
|
||||||
|
class spell_gen_remove_on_full_health : AuraScript
|
||||||
|
{
|
||||||
|
void PeriodicTick(AuraEffect aurEff)
|
||||||
|
{
|
||||||
|
// if it has only periodic effect, allow 1 tick
|
||||||
|
bool onlyEffect = GetSpellInfo().GetEffects().Length == 1;
|
||||||
|
if (onlyEffect && aurEff.GetTickNumber() <= 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (GetTarget().IsFullHealth())
|
||||||
|
{
|
||||||
|
Remove(AuraRemoveMode.EnemySpell);
|
||||||
|
PreventDefaultAction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Register()
|
||||||
|
{
|
||||||
|
OnEffectPeriodic .Add(new EffectPeriodicHandler(PeriodicTick, 0, AuraType.PeriodicDamage));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 70292 - Glacial Strike
|
||||||
|
[Script] // 71316 - Glacial Strike
|
||||||
|
class spell_gen_remove_on_full_health_pct : AuraScript
|
||||||
|
{
|
||||||
|
void PeriodicTick(AuraEffect aurEff)
|
||||||
|
{
|
||||||
|
// they apply damage so no need to check for ticks here
|
||||||
|
|
||||||
|
if (GetTarget().IsFullHealth())
|
||||||
|
{
|
||||||
|
Remove(AuraRemoveMode.EnemySpell);
|
||||||
|
PreventDefaultAction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Register()
|
||||||
|
{
|
||||||
|
OnEffectPeriodic .Add(new EffectPeriodicHandler(PeriodicTick, 2, AuraType.PeriodicDamagePercent));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Script]
|
[Script]
|
||||||
class spell_gen_replenishment : SpellScript
|
class spell_gen_replenishment : SpellScript
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
DELETE FROM `spell_proc` WHERE `SpellId` IN (35321, 38363, 39215);
|
||||||
|
INSERT INTO `spell_proc` (`SpellId`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `ProcFlags`, `SpellTypeMask`, `SpellPhaseMask`, `HitMask`, `AttributesMask`, `ProcsPerMinute`, `Chance`, `Cooldown`, `Charges`) VALUES
|
||||||
|
(35321, 0x0, 0, 0x00000000, 0x00000000, 0x00000000, 0x0, 0x2, 0x0, 0x0, 0x0, 0, 0, 0, 0),
|
||||||
|
(38363, 0x0, 0, 0x00000000, 0x00000000, 0x00000000, 0x0, 0x2, 0x0, 0x0, 0x0, 0, 0, 0, 0),
|
||||||
|
(39215, 0x0, 0, 0x00000000, 0x00000000, 0x00000000, 0x0, 0x2, 0x0, 0x0, 0x0, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_gen_remove_on_health_pct','spell_gen_remove_on_full_health','spell_gen_remove_on_full_health_pct','spell_trash_npc_glacial_strike','spell_iron_ring_guard_impale');
|
||||||
|
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||||
|
(38772, 'spell_gen_remove_on_health_pct'),
|
||||||
|
(43937, 'spell_gen_remove_on_health_pct'),
|
||||||
|
(62331, 'spell_gen_remove_on_health_pct'),
|
||||||
|
(62418, 'spell_gen_remove_on_health_pct'),
|
||||||
|
(31956, 'spell_gen_remove_on_full_health'),
|
||||||
|
(38801, 'spell_gen_remove_on_full_health'),
|
||||||
|
(43093, 'spell_gen_remove_on_full_health'),
|
||||||
|
(58517, 'spell_gen_remove_on_full_health'),
|
||||||
|
(59262, 'spell_gen_remove_on_full_health'),
|
||||||
|
(70292, 'spell_gen_remove_on_full_health_pct'),
|
||||||
|
(71316, 'spell_gen_remove_on_full_health_pct');
|
||||||
|
-- (71317, 'spell_gen_remove_on_full_health_pct');
|
||||||
Reference in New Issue
Block a user