Core/Auras: periodics refactor part 4: ported periodic dummy auras to scripts

Port From (https://github.com/TrinityCore/TrinityCore/commit/d9b145615dd2bafe1ae74e6dc11c9b86a0fb6f28)
This commit is contained in:
hondacrx
2021-03-17 16:28:12 -04:00
parent ff36626d12
commit ce2033dcce
2 changed files with 17 additions and 139 deletions
+1 -139
View File
@@ -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