SackWarrior.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using Server.MirDatabase;
  2. using Server.MirEnvir;
  3. using S = ServerPackets;
  4. namespace Server.MirObjects.Monsters
  5. {
  6. public class SackWarrior : MonsterObject
  7. {
  8. protected internal SackWarrior(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. ShockTime = 0;
  20. ActionTime = Envir.Time + 300;
  21. AttackTime = Envir.Time + AttackSpeed;
  22. Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation);
  23. if (Envir.Random.Next(3) > 0)
  24. {
  25. Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation });
  26. int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]);
  27. if (damage == 0) return;
  28. HalfmoonAttack(damage);
  29. }
  30. else
  31. {
  32. Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 });
  33. int damage = GetAttackPower(Stats[Stat.MinMC], Stats[Stat.MaxMC]);
  34. if (damage == 0) return;
  35. DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 500, Target, damage, DefenceType.ACAgility);
  36. ActionList.Add(action);
  37. }
  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. if (target == null || !target.IsAttackTarget(this) || target.CurrentMap != CurrentMap || target.Node == null) return;
  45. if (target.Attacked(this, damage, defence) <= 0) return;
  46. PoisonTarget(target, 3, 5, PoisonType.Bleeding, 1000);
  47. }
  48. }
  49. }