WereTiger.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using Server.MirDatabase;
  2. using Server.MirEnvir;
  3. using S = ServerPackets;
  4. namespace Server.MirObjects.Monsters
  5. {
  6. public class WereTiger : MonsterObject
  7. {
  8. protected internal WereTiger(MonsterInfo info)
  9. : base(info)
  10. {
  11. }
  12. protected override void Attack()
  13. {
  14. ShockTime = 0;
  15. if (!Target.IsAttackTarget(this))
  16. {
  17. Target = null;
  18. return;
  19. }
  20. Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation);
  21. bool ranged = CurrentLocation == Target.CurrentLocation || !Functions.InRange(CurrentLocation, Target.CurrentLocation, 1);
  22. int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]);
  23. if (damage == 0) return;
  24. ActionTime = Envir.Time + 300;
  25. AttackTime = Envir.Time + AttackSpeed;
  26. if (Envir.Random.Next(6) != 0)
  27. {
  28. Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation });
  29. DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 500, Target, damage, DefenceType.ACAgility);
  30. ActionList.Add(action);
  31. }
  32. else
  33. {
  34. Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 });
  35. SinglePushAttack(damage, DefenceType.AC);
  36. }
  37. }
  38. protected override void ProcessTarget()
  39. {
  40. if (Target == null) return;
  41. if (InAttackRange() && CanAttack)
  42. {
  43. Attack();
  44. return;
  45. }
  46. if (Envir.Time < ShockTime)
  47. {
  48. Target = null;
  49. return;
  50. }
  51. MoveTo(Target.CurrentLocation);
  52. }
  53. }
  54. }