using Server.MirDatabase; using Server.MirEnvir; using S = ServerPackets; namespace Server.MirObjects.Monsters { public class ElephantMan : MonsterObject { protected internal ElephantMan(MonsterInfo info) : base(info) { } protected override void Attack() { if (!Target.IsAttackTarget(this)) { Target = null; return; } ShockTime = 0; Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation); ActionTime = Envir.Time + 300; AttackTime = Envir.Time + AttackSpeed; if (Envir.Random.Next(5) > 0) { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 0 }); int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]); if (damage == 0) return; DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 300, Target, damage, DefenceType.ACAgility, false); ActionList.Add(action); } else { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 }); int damage = GetAttackPower(Stats[Stat.MinMC], Stats[Stat.MaxMC]); if (damage == 0) return; DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 300, Target, damage, DefenceType.AC, true); ActionList.Add(action); } } protected override void CompleteAttack(IList data) { MapObject target = (MapObject)data[0]; int damage = (int)data[1]; DefenceType defence = (DefenceType)data[2]; bool aoe = (bool)data[3]; if (!aoe) { if (target == null || !target.IsAttackTarget(this) || target.CurrentMap != CurrentMap || target.Node == null) return; target.Attacked(this, damage, defence); } else { List targets = FindAllTargets(1, CurrentLocation); if (targets.Count == 0) return; for (int i = 0; i < targets.Count; i++) { if (targets[i].Attacked(this, damage, defence) <= 0) continue; } } } } }