FrozenMiner.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using Server.MirDatabase;
  2. using Server.MirEnvir;
  3. using S = ServerPackets;
  4. namespace Server.MirObjects.Monsters
  5. {
  6. class FrozenMiner : MonsterObject
  7. {
  8. protected internal FrozenMiner(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. MirDirection dir = Functions.PreviousDir(Direction);
  21. int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]);
  22. if (damage == 0) return;
  23. List<MapObject> targets = FindAllTargets(1, CurrentLocation);
  24. if ((targets.Count > 1 && Envir.Random.Next(2) == 0) || Envir.Random.Next(8) == 0)
  25. {
  26. Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 });
  27. for (int i = 0; i < targets.Count; i++)
  28. {
  29. DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 1000, targets[i], (int)(damage * 0.8), DefenceType.ACAgility);
  30. ActionList.Add(action);
  31. }
  32. }
  33. else
  34. {
  35. Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 0 });
  36. DelayedAction action = new DelayedAction(DelayedType.RangeDamage, Envir.Time + 600, Target, damage, DefenceType.ACAgility);
  37. ActionList.Add(action);
  38. }
  39. ShockTime = 0;
  40. ActionTime = Envir.Time + 300;
  41. AttackTime = Envir.Time + AttackSpeed;
  42. if (Target.Dead)
  43. FindTarget();
  44. }
  45. }
  46. }