using Server.MirDatabase; using S = ServerPackets; namespace Server.MirObjects.Monsters { public class DarkDevourer : MonsterObject { protected internal DarkDevourer(MonsterInfo info) : base(info) { } protected override bool InAttackRange() { return CurrentMap == Target.CurrentMap && Functions.InRange(CurrentLocation, Target.CurrentLocation, Info.ViewRange); } protected override void Attack() { if (!Target.IsAttackTarget(this)) { Target = null; return; } Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation); bool ranged = CurrentLocation == Target.CurrentLocation || !Functions.InRange(CurrentLocation, Target.CurrentLocation, 1); if (!ranged) { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation }); ActionTime = Envir.Time + AttackSpeed + 300; int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]); DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 300, Target, damage, DefenceType.AC); ActionList.Add(action); } else { Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, TargetID = Target.ObjectID }); AttackTime = Envir.Time + AttackSpeed + 500; int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]); DelayedAction action = new DelayedAction(DelayedType.RangeDamage, Envir.Time + 500, Target, damage, DefenceType.MACAgility); ActionList.Add(action); } ShockTime = 0; AttackTime = Envir.Time + AttackSpeed; } 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; if (Info.Effect == 1) { PoisonTarget(target, 1, 5, PoisonType.Green, 1000); } } protected override void ProcessTarget() { if (Target == null) return; if (InAttackRange() && CanAttack) { Attack(); return; } if (Envir.Time < ShockTime) { Target = null; return; } MoveTo(Target.CurrentLocation); } } }