fix: Cleans up more spells (#1121)

This commit is contained in:
Kamron Batman 2022-07-16 22:32:51 -07:00 • committed by GitHub
parent fa3515f930
commit 068bafd9b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 339 additions and 439 deletions

View file

@ -38,7 +38,7 @@ namespace Server.Spells.Chivalry
{
Caster.SendLocalizedMessage(1060178); // You are too far away to perform that action!
}
else if (m is BaseCreature creature && creature.IsAnimatedDead)
else if (m is BaseCreature { IsAnimatedDead: true })
{
Caster.SendLocalizedMessage(1061654); // You cannot heal that which is not alive.
}
@ -72,10 +72,8 @@ namespace Server.Spells.Chivalry
SpellHelper.Heal(toHeal, m, Caster, false);
m.SendLocalizedMessage(
1060203,
toHeal.ToString()
); // You have had ~1_HEALED_AMOUNT~ hit points of damage healed.
// You have had ~1_HEALED_AMOUNT~ hit points of damage healed.
m.SendLocalizedMessage(1060203, toHeal.ToString());
m.PlaySound(0x202);
m.FixedParticles(0x376A, 1, 62, 9923, 3, 3, EffectLayer.Waist);

View file

@ -46,17 +46,23 @@ namespace Server.Spells.Chivalry
switch (weapon.Skill)
{
case SkillName.Macing:
itemID = 0xFB4;
soundID = 0x232;
break;
{
itemID = 0xFB4;
soundID = 0x232;
break;
}
case SkillName.Archery:
itemID = 0x13B1;
soundID = 0x145;
break;
{
itemID = 0x13B1;
soundID = 0x145;
break;
}
default:
itemID = 0xF5F;
soundID = 0x56;
break;
{
itemID = 0xF5F;
soundID = 0x56;
break;
}
}
Caster.PlaySound(0x20C);
@ -101,18 +107,15 @@ namespace Server.Spells.Chivalry
private class ExpireTimer : Timer
{
private readonly BaseWeapon m_Weapon;
private BaseWeapon _weapon;
public ExpireTimer(BaseWeapon weapon, TimeSpan delay) : base(delay)
{
m_Weapon = weapon;
}
public ExpireTimer(BaseWeapon weapon, TimeSpan delay) : base(delay) => _weapon = weapon;
protected override void OnTick()
{
m_Weapon.Consecrated = false;
Effects.PlaySound(m_Weapon.GetWorldLocation(), m_Weapon.Map, 0x1F8);
_table.Remove(m_Weapon);
_weapon.Consecrated = false;
Effects.PlaySound(_weapon.GetWorldLocation(), _weapon.Map, 0x1F8);
_table.Remove(_weapon);
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using Server.Collections;
using Server.Gumps;
using Server.Items;
using Server.Mobiles;
@ -34,21 +35,20 @@ namespace Server.Spells.Chivalry
{
if (CheckSequence())
{
var targets = new List<Mobile>();
var eable = Caster.GetMobilesInRange(3);
using var pool = PooledRefQueue<Mobile>.Create();
foreach (var m in Caster.GetMobilesInRange(3)) // TODO: Validate range
foreach (var m in eable)
{
if (m is BaseCreature creature && creature.IsAnimatedDead)
if (m is not BaseCreature { IsAnimatedDead: true } && Caster != m && m.InLOS(Caster) &&
Caster.CanBeBeneficial(m, false, true) && m is not Golem)
{
continue;
}
if (Caster != m && m.InLOS(Caster) && Caster.CanBeBeneficial(m, false, true) && m is not Golem)
{
targets.Add(m);
pool.Enqueue(m);
}
}
eable.Free();
Caster.PlaySound(0x244);
Caster.FixedParticles(0x3709, 1, 30, 9965, 5, 7, EffectLayer.Waist);
Caster.FixedParticles(0x376A, 1, 30, 9502, 5, 3, EffectLayer.Waist);
@ -62,19 +62,18 @@ namespace Server.Spells.Chivalry
var sacrifice = false;
// TODO: Is there really a resurrection chance?
var resChance = 0.1 + 0.9 * Caster.Karma / 10000.0d;
var resChance = 0.1 + 0.9 * Caster.Karma / 10000;
for (var i = 0; i < targets.Count; ++i)
while (pool.Count > 0)
{
var m = targets[i];
var m = pool.Dequeue();
if (!m.Alive)
{
if (m.Region?.IsPartOf("Khaldun") == true)
{
Caster.SendLocalizedMessage(
1010395
); // The veil of death in this area is too strong and resists thy efforts to restore life.
// The veil of death in this area is too strong and resists thy efforts to restore life.
Caster.SendLocalizedMessage(1010395);
}
else if (resChance > Utility.RandomDouble())
{

View file

@ -54,7 +54,7 @@ namespace Server.Spells.Chivalry
else if (!SpellHelper.CheckTravel(Caster, map, loc, TravelCheckType.RecallTo))
{
}
else if (map == Map.Felucca && Caster is PlayerMobile mobile && mobile.Young)
else if (map == Map.Felucca && Caster is PlayerMobile { Young: true } mobile)
{
mobile.SendLocalizedMessage(1049543); // You decide against traveling to Felucca while you are still young.
}