CrazyManworm.cs 1.6 KB

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