Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 KB | None | 0 0
  1. int numBoss = new Range(0, 1).Random(rand);
  2. int numMinion = new Range(3, 5).Random(rand);
  3. int numBlood = new Range(4, 7).Random(rand);
  4. int numCandle = new Range(1, 3).Random(rand);
  5.  
  6.  
  7. var buf = rasterizer.Bitmap;
  8. var bounds = Bounds;
  9. while (numBoss > 0 || numMinion > 0 || numBlood > 0 || numCandle > 0 )
  10. {
  11. int x = rand.Next(bounds.X, bounds.MaxX);
  12. int y = rand.Next(bounds.Y, bounds.MaxY);
  13. if (buf[x, y].Object != null)
  14. continue;
  15.  
  16. switch (rand.Next(4))
  17. {
  18. case 0:
  19. if (numBoss > 0)
  20. {
  21. buf[x, y].Object = new DungeonObject
  22. {
  23. ObjectType = UndeadLairTemplate.Big[rand.Next(UndeadLairTemplate.Big.Length)]
  24. };
  25. numBoss--;
  26. }
  27. break;
  28. case 1:
  29. if (numMinion > 0)
  30. {
  31. buf[x, y].Object = new DungeonObject
  32. {
  33. ObjectType = UndeadLairTemplate.Small[rand.Next(UndeadLairTemplate.Small.Length)]
  34. };
  35. numMinion--;
  36. }
  37. break;
  38. case 2:
  39. if (numBlood > 0)
  40. {
  41. buf[x, y].Object = new DungeonObject
  42. {
  43. ObjectType = UndeadLairTemplate.Blood[rand.Next(UndeadLairTemplate.Blood.Length)]
  44. };
  45. numBlood--;
  46. }
  47. break;
  48. case 3:
  49. if (numCandle > 0)
  50. {
  51. buf[x, y].Object = new DungeonObject
  52. {
  53. ObjectType = UndeadLairTemplate.Candel[rand.Next(UndeadLairTemplate.Candel.Length)]
  54. };
  55. numCandle--;
  56. }
  57. break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement