using Server.MirDatabase; using Server.MirEnvir; using S = ServerPackets; namespace Server.MirObjects.Monsters { public class CreeperPlant : CannibalPlant { protected virtual byte AttackRange { get { return 5; } } protected internal CreeperPlant(MonsterInfo info) : base(info) { } protected override void ProcessAI() { if (!Dead && Envir.Time > VisibleTime) { VisibleTime = Envir.Time + 2000; bool playersInRange = FindNearby(4); if (!Visible && playersInRange) { Visible = true; CellTime = Envir.Time + 500; Broadcast(GetInfo()); Broadcast(new S.ObjectShow { ObjectID = ObjectID }); ActionTime = Envir.Time + 1000; } if (Visible && !playersInRange) { Visible = false; VisibleTime = Envir.Time + 3000; Broadcast(new S.ObjectHide { ObjectID = ObjectID }); SetHP(Stats[Stat.HP]); } } base.ProcessAI(); } protected override bool InAttackRange() { return CurrentMap == Target.CurrentMap && Functions.InRange(CurrentLocation, Target.CurrentLocation, AttackRange); } 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) { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation }); 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); ActionList.Add(action); } else { Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, TargetID = Target.ObjectID, Type = 0 }); int damage = GetAttackPower(Stats[Stat.MinMC], Stats[Stat.MaxMC]); if (damage == 0) return; DelayedAction action = new DelayedAction(DelayedType.RangeDamage, Envir.Time + 500, Target, damage, DefenceType.MACAgility); ActionList.Add(action); } } } }