FlameQueen.cs 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using Server.MirDatabase;
  2. using Server.MirEnvir;
  3. using S = ServerPackets;
  4. namespace Server.MirObjects.Monsters
  5. {
  6. public class FlameQueen : MonsterObject
  7. {
  8. public long FearTime;
  9. public byte AttackRange = 3;
  10. private long MassAttackTime;
  11. protected internal FlameQueen(MonsterInfo info)
  12. : base(info)
  13. {
  14. }
  15. protected override bool InAttackRange()
  16. {
  17. return CurrentMap == Target.CurrentMap && Functions.InRange(CurrentLocation, Target.CurrentLocation, AttackRange);
  18. }
  19. protected override void Attack()
  20. {
  21. if (!Target.IsAttackTarget(this))
  22. {
  23. Target = null;
  24. return;
  25. }
  26. Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation);
  27. if ((HP * 100 / Stats[Stat.HP]) < 20 && MassAttackTime < Envir.Time)
  28. {
  29. ShockTime = 0;
  30. ActionTime = Envir.Time + 500;
  31. AttackTime = Envir.Time + (AttackSpeed);
  32. Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 0 });
  33. List<MapObject> targets = FindAllTargets(7, CurrentLocation, false);
  34. if (targets.Count == 0) return;
  35. int damage = GetAttackPower(Stats[Stat.MinMC], Stats[Stat.MaxMC]);
  36. for (int i = 0; i < targets.Count; i++)
  37. {
  38. int delay = Functions.MaxDistance(CurrentLocation, targets[i].CurrentLocation) * 50 + 750; //50 MS per Step
  39. DelayedAction action = new DelayedAction(DelayedType.RangeDamage, Envir.Time + delay, Target, damage, DefenceType.ACAgility);
  40. ActionList.Add(action);
  41. }
  42. MassAttackTime = Envir.Time + 2000 + (Envir.Random.Next(5) * 1000);
  43. ActionTime = Envir.Time + 800;
  44. AttackTime = Envir.Time + (AttackSpeed);
  45. return;
  46. }
  47. if (!Functions.InRange(CurrentLocation, Target.CurrentLocation, 1) || Envir.Random.Next(3) == 0)
  48. {
  49. Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 });
  50. int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]);
  51. DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 300, Target, damage, DefenceType.ACAgility);
  52. ActionList.Add(action);
  53. }
  54. else
  55. {
  56. Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 0 });
  57. int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]);
  58. DelayedAction action = new DelayedAction(DelayedType.RangeDamage, Envir.Time + 300, Target, damage, DefenceType.ACAgility);
  59. ActionList.Add(action);
  60. }
  61. ShockTime = 0;
  62. ActionTime = Envir.Time + 500;
  63. AttackTime = Envir.Time + (AttackSpeed);
  64. }
  65. }
  66. }