WhiteMammoth.cs 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using Server.MirDatabase;
  2. using S = ServerPackets;
  3. namespace Server.MirObjects.Monsters
  4. {
  5. public class WhiteMammoth : MonsterObject
  6. {
  7. protected internal WhiteMammoth(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. if (Envir.Random.Next(8) > 0)
  20. {
  21. if (Envir.Random.Next(6) > 0)
  22. {
  23. base.Attack();
  24. }
  25. else
  26. {
  27. Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 });
  28. int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC] * 2);
  29. if (damage == 0) return;
  30. DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 300, Target, damage, DefenceType.ACAgility, false);
  31. ActionList.Add(action);
  32. }
  33. }
  34. else
  35. {
  36. Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 2 });
  37. int damage = GetAttackPower(Stats[Stat.MinMC], Stats[Stat.MaxMC]);
  38. if (damage == 0) return;
  39. DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 300, Target, damage, DefenceType.ACAgility, true);
  40. ActionList.Add(action);
  41. }
  42. ShockTime = 0;
  43. ActionTime = Envir.Time + 300;
  44. AttackTime = Envir.Time + AttackSpeed;
  45. }
  46. protected override void CompleteAttack(IList<object> data)
  47. {
  48. int damage = (int)data[1];
  49. if (data.Count >= 4)
  50. {
  51. bool stomp = (bool)data[3];
  52. if (stomp)
  53. {
  54. List<MapObject> targets = FindAllTargets(1, CurrentLocation, false);
  55. for (int i = 0; i < targets.Count; i++)
  56. {
  57. var target = targets[i];
  58. if (target == null || !target.IsAttackTarget(this) || target.CurrentMap != CurrentMap || target.Node == null) continue;
  59. if (target.Attacked(this, damage) <= 0) continue;
  60. PoisonTarget(target, 0, 5, PoisonType.Dazed, 2000);
  61. }
  62. return;
  63. }
  64. }
  65. base.CompleteAttack(data);
  66. }
  67. }
  68. }