LightTurtle.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using Server.MirDatabase;
  2. using S = ServerPackets;
  3. namespace Server.MirObjects.Monsters
  4. {
  5. public class LightTurtle : MonsterObject
  6. {
  7. protected internal LightTurtle(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. Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation);
  19. ShockTime = 0;
  20. if (Envir.Random.Next(3) > 0)
  21. {
  22. base.Attack();
  23. }
  24. else
  25. {
  26. Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 });
  27. ActionTime = Envir.Time + 300;
  28. AttackTime = Envir.Time + AttackSpeed;
  29. int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]);
  30. if (damage == 0) return;
  31. DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 300, Target, damage, DefenceType.ACAgility);
  32. ActionList.Add(action);
  33. }
  34. }
  35. protected override void CompleteAttack(IList<object> data)
  36. {
  37. MapObject target = (MapObject)data[0];
  38. int damage = (int)data[1];
  39. DefenceType defence = (DefenceType)data[2];
  40. if (target == null || !target.IsAttackTarget(this) || target.CurrentMap != CurrentMap || target.Node == null) return;
  41. if (target.Attacked(this, damage, defence) <= 0) return;
  42. PoisonTarget(target, 4, GetAttackPower(Stats[Stat.MinSC], Stats[Stat.MaxSC]), PoisonType.Green, 1000);
  43. }
  44. }
  45. }