OmaBlest.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using Server.MirDatabase;
  2. using Server.MirEnvir;
  3. using S = ServerPackets;
  4. namespace Server.MirObjects.Monsters
  5. {
  6. public class OmaBlest : MonsterObject
  7. {
  8. protected internal OmaBlest(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. Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation);
  20. ActionTime = Envir.Time + 300;
  21. AttackTime = Envir.Time + AttackSpeed;
  22. ShockTime = 0;
  23. int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]);
  24. if (damage == 0) return;
  25. if (Envir.Random.Next(2) > 0)
  26. {
  27. Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation });
  28. DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 600, Target, damage, DefenceType.ACAgility, false);
  29. ActionList.Add(action);
  30. }
  31. else
  32. {
  33. Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 });
  34. DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 600, Target, damage, DefenceType.AC, true);
  35. ActionList.Add(action);
  36. }
  37. }
  38. protected override void CompleteAttack(IList<object> data)
  39. {
  40. MapObject target = (MapObject)data[0];
  41. int damage = (int)data[1];
  42. DefenceType defence = (DefenceType)data[2];
  43. bool aoe = (bool)data[3];
  44. if (target == null || !target.IsAttackTarget(this) || target.CurrentMap != CurrentMap || target.Node == null) return;
  45. if (aoe)
  46. {
  47. List<MapObject> targets = FindAllTargets(1, target.CurrentLocation);
  48. if (targets.Count == 0) return;
  49. for (int i = 0; i < targets.Count; i++)
  50. {
  51. if (targets[i].IsAttackTarget(this))
  52. targets[i].Attacked(this, damage, defence);
  53. }
  54. }
  55. else
  56. {
  57. target.Attacked(this, damage, defence);
  58. }
  59. }
  60. }
  61. }