Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
103
Scripts/Abilities/ColdWind.cs
Normal file
103
Scripts/Abilities/ColdWind.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
using Server.Network;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
/// <summary>
|
||||
/// Currently on EA, this is only available for Creatures
|
||||
/// </summary>
|
||||
public class ColdWind : WeaponAbility
|
||||
{
|
||||
private static readonly Dictionary<Mobile, ExpireTimer> m_Table = new Dictionary<Mobile, ExpireTimer>();
|
||||
|
||||
public ColdWind()
|
||||
{
|
||||
}
|
||||
|
||||
public override int BaseMana
|
||||
{
|
||||
get
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
}
|
||||
public override double DamageScalar
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1.5;
|
||||
}
|
||||
}
|
||||
public override void OnHit(Mobile attacker, Mobile defender, int damage)
|
||||
{
|
||||
if (!Validate(attacker) || !CheckMana(attacker, true))
|
||||
return;
|
||||
|
||||
if (attacker.Map == null || attacker.Map == Map.Internal)
|
||||
return;
|
||||
|
||||
ExpireTimer timer = null;
|
||||
|
||||
if (m_Table.ContainsKey(defender))
|
||||
timer = m_Table[defender];
|
||||
|
||||
if (timer != null)
|
||||
{
|
||||
timer.DoExpire();
|
||||
defender.SendLocalizedMessage(1070831); // The freezing wind continues to blow!
|
||||
}
|
||||
else
|
||||
defender.SendLocalizedMessage(1070832); // An icy wind surrounds you, freezing your lungs as you breathe!
|
||||
|
||||
timer = new ExpireTimer(defender, attacker);
|
||||
timer.Start();
|
||||
m_Table[defender] = timer;
|
||||
}
|
||||
|
||||
private class ExpireTimer : Timer
|
||||
{
|
||||
private readonly Mobile m_Mobile;
|
||||
private readonly Mobile m_From;
|
||||
private int m_Count;
|
||||
|
||||
public ExpireTimer(Mobile m, Mobile from)
|
||||
: base(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.0))
|
||||
{
|
||||
m_Mobile = m;
|
||||
m_From = from;
|
||||
Priority = TimerPriority.TwoFiftyMS;
|
||||
}
|
||||
|
||||
public void DoExpire()
|
||||
{
|
||||
Stop();
|
||||
m_Table.Remove(m_Mobile);
|
||||
}
|
||||
|
||||
public void DrainLife()
|
||||
{
|
||||
if (m_Mobile.Alive)
|
||||
{
|
||||
AOS.Damage(m_Mobile, m_From, 14, 0, 0, 100, 0, 0);
|
||||
Effects.SendPacket(m_Mobile.Location, m_Mobile.Map, new ParticleEffect(EffectType.FixedFrom, m_Mobile.Serial, Serial.Zero, 0x374A, m_Mobile.Location, m_Mobile.Location, 1, 15, false, false, 97, 0, 4, 9502, 1, m_Mobile.Serial, 163, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
DoExpire();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
DrainLife();
|
||||
|
||||
if (++m_Count >= 5)
|
||||
{
|
||||
DoExpire();
|
||||
m_Mobile.SendLocalizedMessage(1070830); // The icy wind dissipates.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user