RootSpider.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System.Drawing;
  2. using Server.MirDatabase;
  3. using S = ServerPackets;
  4. namespace Server.MirObjects.Monsters
  5. {
  6. public class RootSpider : BugBagMaggot
  7. {
  8. protected internal RootSpider(MonsterInfo info)
  9. : base(info)
  10. {
  11. byte randomdirection = (byte)Envir.Random.Next(3);
  12. Direction = (MirDirection)randomdirection;
  13. }
  14. protected override void Attack()
  15. {
  16. ShockTime = 0;
  17. if (!Target.IsAttackTarget(this))
  18. {
  19. Target = null;
  20. return;
  21. }
  22. if (SlaveList.Count >= 20) return;
  23. MonsterObject spawn = GetMonster(Envir.GetMonsterInfo(Settings.BombSpiderName));
  24. if (spawn == null) return;
  25. Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation });
  26. ActionTime = Envir.Time + 300;
  27. AttackTime = Envir.Time + 3000;
  28. spawn.Target = Target;
  29. spawn.ActionTime = Envir.Time + 1000;
  30. Point spawnlocation = Point.Empty;
  31. switch (Direction)
  32. {
  33. case MirDirection.Up:
  34. spawnlocation = Back;
  35. break;
  36. case MirDirection.UpRight:
  37. spawnlocation = Functions.PointMove(CurrentLocation, MirDirection.DownRight, 1);
  38. break;
  39. case MirDirection.Right:
  40. spawnlocation = Functions.PointMove(CurrentLocation, MirDirection.DownLeft, 1);
  41. break;
  42. }
  43. CurrentMap.ActionList.Add(new DelayedAction(DelayedType.Spawn, Envir.Time + 500, spawn, spawnlocation, this));
  44. }
  45. }
  46. }