| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- using Server.MirDatabase;
- using Server.MirEnvir;
- using S = ServerPackets;
- namespace Server.MirObjects.Monsters
- {
- public class EvilCentipede : MonsterObject
- {
- public bool Visible;
- public long VisibleTime;
- protected override bool CanAttack
- {
- get
- {
- return Visible && base.CanAttack;
- }
- }
- protected override bool CanMove { get { return false; } }
- public override bool Blocking
- {
- get
- {
- return Visible && base.Blocking;
- }
- }
- protected internal EvilCentipede(MonsterInfo info)
- : base(info)
- {
- Visible = false;
- }
- protected override void ProcessAI()
- {
- if (!Visible)
- SetHP(Stats[Stat.HP]);
- if (!Dead && Envir.Time > VisibleTime)
- {
- VisibleTime = Envir.Time + 2000;
- bool visible = FindNearby(Visible ? 7 : 3);
- if (!Visible && visible)
- {
- Visible = true;
- CellTime = Envir.Time + 500;
- Broadcast(GetInfo());
- Broadcast(new S.ObjectShow { ObjectID = ObjectID });
- ActionTime = Envir.Time + 2000;
- }
- if (Visible && !visible)
- {
- Visible = false;
- VisibleTime = Envir.Time + 3000;
- Broadcast(new S.ObjectHide { ObjectID = ObjectID });
- SetHP(Stats[Stat.HP]);
- }
- }
- base.ProcessAI();
- }
- public override void Turn(MirDirection dir)
- {
- }
- public override bool Walk(MirDirection dir) { return false; }
- public override bool IsAttackTarget(MonsterObject attacker)
- {
- return Visible && base.IsAttackTarget(attacker);
- }
- public override bool IsAttackTarget(HumanObject attacker)
- {
- return Visible && base.IsAttackTarget(attacker);
- }
- protected override void ProcessRoam() { }
- protected override void ProcessSearch()
- {
- if (Visible)
- base.ProcessSearch();
- }
- protected override void CompleteAttack(IList<object> data)
- {
- List<MapObject> targets = FindAllTargets(7, CurrentLocation, false);
- if (targets.Count == 0) return;
- for (int i = 0; i < targets.Count; i++)
- {
- Target = targets[i];
- Attack();
- }
- }
- protected override void ProcessTarget()
- {
- if (!CanAttack) return;
- if (!FindNearby(7)) return;
- ShockTime = 0;
- Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation });
- ActionList.Add(new DelayedAction(DelayedType.Damage, Envir.Time + 500));
- ActionTime = Envir.Time + 300;
- AttackTime = Envir.Time + AttackSpeed;
- }
- protected override void Attack()
- {
- int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]);
- if (damage == 0) return;
- if (Target.Attacked(this, damage, DefenceType.MAC) <= 0) return;
- PoisonTarget(Target, 5, 15, PoisonType.Green, 2000);
- PoisonTarget(Target, 15, 5, PoisonType.Paralysis, 2000);
- }
- public override Packet GetInfo()
- {
- return !Visible ? null : base.GetInfo();
- }
- }
- }
|