FlameAssassin.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using Server.MirDatabase;
  2. namespace Server.MirObjects.Monsters
  3. {
  4. public class FlameAssassin : RightGuard
  5. {
  6. public long FearTime;
  7. protected internal FlameAssassin(MonsterInfo info)
  8. : base(info)
  9. {
  10. }
  11. protected override void CompleteRangeAttack(IList<object> data)
  12. {
  13. MapObject target = (MapObject)data[0];
  14. int damage = (int)data[1];
  15. DefenceType defence = (DefenceType)data[2];
  16. if (target == null || !target.IsAttackTarget(this) || target.CurrentMap != CurrentMap || target.Node == null) return;
  17. if (target.Attacked(this, damage, defence) <= 0) return;
  18. PoisonTarget(target, 1, GetAttackPower(Stats[Stat.MinMC], Stats[Stat.MaxMC]), PoisonType.Slow, 1000);
  19. }
  20. protected override void ProcessTarget()
  21. {
  22. if (Target == null || !CanAttack) return;
  23. if (InAttackRange() && Envir.Time < FearTime)
  24. {
  25. Attack();
  26. return;
  27. }
  28. FearTime = Envir.Time + 5000;
  29. if (Envir.Time < ShockTime)
  30. {
  31. Target = null;
  32. return;
  33. }
  34. int dist = Functions.MaxDistance(CurrentLocation, Target.CurrentLocation);
  35. if (dist >= AttackRange)
  36. MoveTo(Target.CurrentLocation);
  37. else
  38. {
  39. MirDirection dir = Functions.DirectionFromPoint(Target.CurrentLocation, CurrentLocation);
  40. if (Walk(dir)) return;
  41. switch (Envir.Random.Next(2)) //No favour
  42. {
  43. case 0:
  44. for (int i = 0; i < 7; i++)
  45. {
  46. dir = Functions.NextDir(dir);
  47. if (Walk(dir))
  48. return;
  49. }
  50. break;
  51. default:
  52. for (int i = 0; i < 7; i++)
  53. {
  54. dir = Functions.PreviousDir(dir);
  55. if (Walk(dir))
  56. return;
  57. }
  58. break;
  59. }
  60. }
  61. }
  62. }
  63. }