SnowWolf.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using Server.MirDatabase;
  2. using Server.MirEnvir;
  3. using S = ServerPackets;
  4. namespace Server.MirObjects.Monsters
  5. {
  6. public class SnowWolf : MonsterObject
  7. {
  8. protected internal SnowWolf(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. Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation);
  21. ActionTime = Envir.Time + 300;
  22. AttackTime = Envir.Time + AttackSpeed;
  23. if (Envir.Random.Next(5) > 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. DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 350, 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. int damage = GetAttackPower(Stats[Stat.MinMC], Stats[Stat.MaxMC]);
  35. if (damage == 0) return;
  36. DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 450, Target, damage, DefenceType.ACAgility, true);
  37. ActionList.Add(action);
  38. }
  39. }
  40. protected override void CompleteAttack(IList<object> data)
  41. {
  42. MapObject target = (MapObject)data[0];
  43. int damage = (int)data[1];
  44. DefenceType defence = (DefenceType)data[2];
  45. bool magicAttack = (bool)data[3];
  46. if (target == null || !target.IsAttackTarget(this) || target.CurrentMap != CurrentMap || target.Node == null) return;
  47. List<MapObject> targets = FindAllTargets(2, CurrentLocation);
  48. if (targets.Count == 0) return;
  49. for (int i = 0; i < targets.Count; i++)
  50. {
  51. if (targets[i].Attacked(this, damage, defence) <= 0) continue;
  52. if (magicAttack)
  53. {
  54. PoisonTarget(targets[i], 4, 5, PoisonType.Slow, 2000);
  55. PoisonTarget(targets[i], 8, 5, PoisonType.Frozen, 2000);
  56. }
  57. }
  58. }
  59. }
  60. }