Code cleanup (#188)

This commit is contained in:
Kamron Batman 2020-08-01 08:40:06 -07:00 committed by GitHub
parent df53c16620
commit 010fd9402a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
185 changed files with 1052 additions and 1271 deletions

View file

@ -163,8 +163,8 @@ namespace Server.Spells.Necromancy
if (c.Owner != null) type = c.Owner.GetType();
if (c.ItemID != 0x2006 || c.Animated || type == typeof(PlayerMobile) || type == null ||
(c.Owner != null && c.Owner.Fame < 100) ||
(c.Owner is BaseCreature creature && (creature.Summoned || creature.IsBonded)))
c.Owner != null && c.Owner.Fame < 100 ||
c.Owner is BaseCreature creature && (creature.Summoned || creature.IsBonded))
{
Caster.SendLocalizedMessage(1061085); // There's not enough life force there to animate.
}
@ -236,7 +236,7 @@ namespace Server.Spells.Necromancy
list.Add(summoned);
if (list.Count > 3)
Timer.DelayCall(TimeSpan.Zero, list[0].Kill);
Timer.DelayCall(list[0].Kill);
Timer.DelayCall(TimeSpan.FromSeconds(2.0), TimeSpan.FromSeconds(2.0), Summoned_Damage, summoned);
}
@ -262,18 +262,8 @@ namespace Server.Spells.Necromancy
double necromancy = caster.Skills.Necromancy.Value;
double spiritSpeak = caster.Skills.SpiritSpeak.Value;
int casterAbility = 0;
casterAbility += (int)(necromancy * 30);
casterAbility += (int)(spiritSpeak * 70);
casterAbility /= 10;
casterAbility *= 18;
if (casterAbility > owner.Fame)
casterAbility = owner.Fame;
if (casterAbility < 0)
casterAbility = 0;
int casterAbility = (int)(necromancy * 30) + (int)(spiritSpeak * 70);
casterAbility = Math.Clamp(casterAbility / 10 * 18, 0, owner.Fame);
Type toSummon = null;
SummonEntry[] entries = group.m_Entries;
@ -287,8 +277,7 @@ namespace Server.Spells.Necromancy
Type[] animates = entry.m_ToSummon;
if (animates.Length >= 0)
toSummon = animates[Utility.Random(animates.Length)];
toSummon = animates[Utility.Random(animates.Length)];
}
if (toSummon == null)

View file

@ -41,17 +41,8 @@ namespace Server.Spells.Necromancy
max = Scroll != null ? min : RequiredSkill + 40.0;
}
public override bool ConsumeReagents()
{
if (base.ConsumeReagents())
return true;
if (ArcaneGem.ConsumeCharges(Caster, 1))
return true;
return false;
}
public override bool ConsumeReagents() => base.ConsumeReagents() || ArcaneGem.ConsumeCharges(Caster, 1);
public override int GetMana() => RequiredMana;
}
}
}

View file

@ -52,12 +52,9 @@ namespace Server.Spells.Necromancy
m.FixedParticles(0x37C4, 1, 8, 9502, 39, 4, EffectLayer.Head);
m.PlaySound(0x210);
double damage = (GetDamageSkill(Caster) - GetResistSkill(m)) / 10 + (m.Player ? 18 : 30);
double damage = Math.Max((GetDamageSkill(Caster) - GetResistSkill(m)) / 10 + (m.Player ? 18 : 30), 1);
m.CheckSkill(SkillName.MagicResist, 0.0, 120.0); // Skill check for gain
if (damage < 1)
damage = 1;
TimeSpan buffTime = TimeSpan.FromSeconds(10.0);
if (!m_Table.TryGetValue(m, out InternalTimer timer))

View file

@ -30,13 +30,7 @@ namespace Server.Spells.Necromancy
{
}
public override bool CheckCast()
{
if (!TransformationSpellHelper.CheckCast(Caster, this))
return false;
return base.CheckCast();
}
public override bool CheckCast() => TransformationSpellHelper.CheckCast(Caster, this) && base.CheckCast();
public override void OnCast()
{
@ -45,4 +39,4 @@ namespace Server.Spells.Necromancy
FinishSequence();
}
}
}
}