Mantis.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using Server.MirDatabase;
  2. using Server.MirEnvir;
  3. using S = ServerPackets;
  4. namespace Server.MirObjects.Monsters
  5. {
  6. public class Mantis : MonsterObject
  7. {
  8. protected internal Mantis(MonsterInfo info)
  9. : base(info)
  10. {
  11. }
  12. protected override void Attack()
  13. {
  14. if (!Target.IsAttackTarget(this))
  15. {
  16. Target = null;
  17. return;
  18. }
  19. ActionTime = Envir.Time + 300;
  20. AttackTime = Envir.Time + AttackSpeed;
  21. Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation);
  22. if (Envir.Random.Next(5) > 0)
  23. {
  24. Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 0 });
  25. int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]);
  26. if (damage == 0) return;
  27. DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 300, Target, damage, DefenceType.ACAgility);
  28. ActionList.Add(action);
  29. }
  30. else
  31. {
  32. Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 });
  33. int damage = GetAttackPower(Stats[Stat.MinMC], Stats[Stat.MaxMC]);
  34. if (damage == 0) return;
  35. DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 300, Target, damage, DefenceType.ACAgility);
  36. ActionList.Add(action);
  37. PoisonTarget(Target, 8, 6, PoisonType.Dazed, 1000);
  38. }
  39. ShockTime = 0;
  40. }
  41. }
  42. }