Fixes dictionary uses (#7)
This commit is contained in:
parent
d4a52344f2
commit
916d404c51
161 changed files with 1211 additions and 1722 deletions
|
|
@ -73,22 +73,22 @@ namespace Server.Mobiles
|
|||
{
|
||||
base.OnGaveMeleeAttack(defender);
|
||||
|
||||
if (Utility.RandomDouble() < 0.1)
|
||||
{
|
||||
if (m_Table.TryGetValue(defender, out ExpireTimer timer))
|
||||
timer.DoExpire();
|
||||
if (Utility.RandomDouble() >= 0.1)
|
||||
return;
|
||||
|
||||
defender.FixedParticles(0x3709, 10, 30, 5052, EffectLayer.LeftFoot);
|
||||
defender.PlaySound(0x208);
|
||||
defender.SendLocalizedMessage(
|
||||
1070833); // The creature fans you with fire, reducing your resistance to fire attacks.
|
||||
if (m_Table.TryGetValue(defender, out ExpireTimer timer))
|
||||
timer.DoExpire();
|
||||
|
||||
ResistanceMod mod = new ResistanceMod(ResistanceType.Fire, -10);
|
||||
defender.AddResistanceMod(mod);
|
||||
defender.FixedParticles(0x3709, 10, 30, 5052, EffectLayer.LeftFoot);
|
||||
defender.PlaySound(0x208);
|
||||
defender.SendLocalizedMessage(
|
||||
1070833); // The creature fans you with fire, reducing your resistance to fire attacks.
|
||||
|
||||
m_Table[defender] = timer = new ExpireTimer(defender, mod);
|
||||
timer.Start();
|
||||
}
|
||||
ResistanceMod mod = new ResistanceMod(ResistanceType.Fire, -10);
|
||||
defender.AddResistanceMod(mod);
|
||||
|
||||
m_Table[defender] = timer = new ExpireTimer(defender, mod);
|
||||
timer.Start();
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
|
|
@ -133,4 +133,4 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,7 +140,10 @@ namespace Server.Mobiles
|
|||
|
||||
public static void SuppressRemove(Mobile target)
|
||||
{
|
||||
if (target != null && m_Suppressed[target] is Timer t)
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
if (m_Suppressed.TryGetValue(target, out Timer t))
|
||||
{
|
||||
if (t.Running)
|
||||
t.Stop();
|
||||
|
|
@ -199,7 +202,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
Item item = m.FindItemOnLayer(layer);
|
||||
|
||||
if (item != null && item.Movable)
|
||||
if (item?.Movable == true)
|
||||
m.PlaceInBackpack(item);
|
||||
}
|
||||
|
||||
|
|
@ -235,4 +238,4 @@ namespace Server.Mobiles
|
|||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
public class Ilhenir : BaseChampion
|
||||
{
|
||||
private static Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
|
||||
private static HashSet<Mobile> m_Table = new HashSet<Mobile>();
|
||||
|
||||
[Constructible]
|
||||
public Ilhenir()
|
||||
|
|
@ -230,13 +230,14 @@ namespace Server.Mobiles
|
|||
|
||||
public virtual void CacophonicAttack(Mobile to)
|
||||
{
|
||||
if (to.Alive && to.Player && !m_Table.ContainsKey(to))
|
||||
if (to.Alive && to.Player && !UnderCacophonicAttack(to))
|
||||
{
|
||||
to.Send(SpeedControl.WalkSpeed);
|
||||
to.SendLocalizedMessage(1072069); // A cacophonic sound lambastes you, suppressing your ability to move.
|
||||
to.PlaySound(0x584);
|
||||
|
||||
m_Table[to] = Timer.DelayCall(TimeSpan.FromSeconds(30), CacophonicEnd, to);
|
||||
m_Table.Add(to);
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(30), CacophonicEnd, to);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -248,7 +249,7 @@ namespace Server.Mobiles
|
|||
|
||||
public static bool UnderCacophonicAttack(Mobile from)
|
||||
{
|
||||
return m_Table.ContainsKey(from);
|
||||
return m_Table.Contains(from);
|
||||
}
|
||||
|
||||
public virtual void DropOoze()
|
||||
|
|
|
|||
|
|
@ -101,32 +101,30 @@ namespace Server.Mobiles
|
|||
{
|
||||
base.OnGaveMeleeAttack(defender);
|
||||
|
||||
if (0.1 > Utility.RandomDouble())
|
||||
if (0.1 <= Utility.RandomDouble())
|
||||
return;
|
||||
|
||||
if (m_Table.TryGetValue(defender, out ExpireTimer timer))
|
||||
{
|
||||
ExpireTimer timer = m_Table[defender];
|
||||
|
||||
if (timer != null)
|
||||
{
|
||||
timer.DoExpire();
|
||||
defender.SendLocalizedMessage(1070837); // The creature lands another blow in your weakened state.
|
||||
}
|
||||
else
|
||||
{
|
||||
defender.SendLocalizedMessage(
|
||||
1070836); // The blow from the creature's claws has made you more susceptible to physical attacks.
|
||||
}
|
||||
|
||||
int effect = -(defender.PhysicalResistance * 15 / 100);
|
||||
|
||||
ResistanceMod mod = new ResistanceMod(ResistanceType.Physical, effect);
|
||||
|
||||
defender.FixedEffect(0x37B9, 10, 5);
|
||||
defender.AddResistanceMod(mod);
|
||||
|
||||
timer = new ExpireTimer(defender, mod, TimeSpan.FromSeconds(5.0));
|
||||
timer.Start();
|
||||
m_Table[defender] = timer;
|
||||
timer.DoExpire();
|
||||
defender.SendLocalizedMessage(1070837); // The creature lands another blow in your weakened state.
|
||||
}
|
||||
else
|
||||
{
|
||||
defender.SendLocalizedMessage(
|
||||
1070836); // The blow from the creature's claws has made you more susceptible to physical attacks.
|
||||
}
|
||||
|
||||
int effect = -(defender.PhysicalResistance * 15 / 100);
|
||||
|
||||
ResistanceMod mod = new ResistanceMod(ResistanceType.Physical, effect);
|
||||
|
||||
defender.FixedEffect(0x37B9, 10, 5);
|
||||
defender.AddResistanceMod(mod);
|
||||
|
||||
timer = new ExpireTimer(defender, mod, TimeSpan.FromSeconds(5.0));
|
||||
timer.Start();
|
||||
m_Table[defender] = timer;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue