using Server.MirDatabase; using Server.MirEnvir; using S = ServerPackets; namespace Server.MirObjects.Monsters { public class Jar2 : Jar1 { protected override byte AttackRange { get { return 6; } } protected internal Jar2(MonsterInfo info) : base(info) { } protected override void Attack() { if (!Target.IsAttackTarget(this)) { Target = null; return; } ShockTime = 0; Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation); bool ranged = CurrentLocation == Target.CurrentLocation || !Functions.InRange(CurrentLocation, Target.CurrentLocation, 1); ActionTime = Envir.Time + 300; AttackTime = Envir.Time + AttackSpeed; if (!ranged && Envir.Random.Next(3) == 0) { int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]); Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation }); if (damage == 0) return; DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 300, Target, damage, DefenceType.MACAgility); ActionList.Add(action); } else { int damage = GetAttackPower(Stats[Stat.MinMC], Stats[Stat.MaxMC]); Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, TargetID = Target.ObjectID }); AttackTime = Envir.Time + AttackSpeed + 500; if (damage == 0) return; DelayedAction action = new DelayedAction(DelayedType.RangeDamage, Envir.Time + 500, Target, damage, DefenceType.MAC); ActionList.Add(action); } } protected override void CompleteRangeAttack(IList data) { MapObject target = (MapObject)data[0]; int damage = (int)data[1]; DefenceType defence = (DefenceType)data[2]; if (target == null || !target.IsAttackTarget(this) || target.CurrentMap != CurrentMap || target.Node == null) return; if (target.Attacked(this, damage, defence) <= 0) return; PoisonTarget(target, 5, 5, PoisonType.Frozen, 1000); } } }