CaveMaggot.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using Server.MirDatabase;
  2. using S = ServerPackets;
  3. namespace Server.MirObjects.Monsters
  4. {
  5. public class CaveMaggot : HarvestMonster
  6. {
  7. protected internal CaveMaggot(MonsterInfo info)
  8. : base(info)
  9. {
  10. }
  11. protected override void Attack()
  12. {
  13. if (!Target.IsAttackTarget(this))
  14. {
  15. Target = null;
  16. return;
  17. }
  18. ShockTime = 0;
  19. Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation);
  20. Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation });
  21. ActionTime = Envir.Time + 300;
  22. AttackTime = Envir.Time + AttackSpeed;
  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.MACAgility);
  26. ActionList.Add(action);
  27. }
  28. protected override void CompleteAttack(IList<object> data)
  29. {
  30. MapObject target = (MapObject)data[0];
  31. int damage = (int)data[1];
  32. DefenceType defence = (DefenceType)data[2];
  33. if (target == null || !target.IsAttackTarget(this) || target.CurrentMap != CurrentMap || target.Node == null) return;
  34. if (target.Attacked(this, damage, defence) <= 0) return;
  35. PoisonTarget(target, 20, 5, PoisonType.Paralysis, 1000);
  36. }
  37. }
  38. }