HellSlasher.cs 2.2 KB

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