Advertisement
Chronos_Ouroboros

Challenges selection code for DoomKrakken

Dec 19th, 2018
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.04 KB | None | 0 0
  1. Array<string> unselectedChallenges;
  2.  
  3. void PopulateUnselectedChallenges () {
  4. unselectedChallenges.Clear ();
  5.  
  6. if (TwoFer ) unselectedChallenges.Push ("TwoFer" );
  7. if (VarietyIsTheSpiceOfDeathI ) unselectedChallenges.Push ("VarietyIsTheSpiceOfDeathI" );
  8. if (QuiteTheExplorer ) unselectedChallenges.Push ("QuiteTheExplorer" );
  9. if (ThreeZombiesOneBarrel ) unselectedChallenges.Push ("ThreeZombiesOneBarrel" );
  10. if (CurbStomp ) unselectedChallenges.Push ("CurbStomp" );
  11. if (QuiteTheCollector ) unselectedChallenges.Push ("QuiteTheCollector" );
  12. if (WalkThePath ) unselectedChallenges.Push ("WalkThePath" );
  13. if (BirdsEyeView ) unselectedChallenges.Push ("BirdsEyeView" );
  14. if (ToBeKnighted ) unselectedChallenges.Push ("ToBeKnighted" );
  15. if (Chiropractor ) unselectedChallenges.Push ("Chiropractor" );
  16. if (SearchingHighAndLow ) unselectedChallenges.Push ("SearchingHighAndLow" );
  17. if (Overkiller ) unselectedChallenges.Push ("Overkiller" );
  18. if (DeadManStalking ) unselectedChallenges.Push ("DeadManStalking" );
  19. if (MomentumSwing ) unselectedChallenges.Push ("MomentumSwing" );
  20. if (CloseEncounters ) unselectedChallenges.Push ("CloseEncounters" );
  21. if (DoubleTake ) unselectedChallenges.Push ("DoubleTake" );
  22. if (HideAndSeek ) unselectedChallenges.Push ("HideAndSeek" );
  23. if (VarietyIsTheSpiceOfDeathII ) unselectedChallenges.Push ("VarietyIsTheSpiceOfDeathII" );
  24. if (ThreadTheNeedle ) unselectedChallenges.Push ("ThreadTheNeedle" );
  25. if (AtopTheMountain ) unselectedChallenges.Push ("AtopTheMountain" );
  26. if (Dominator ) unselectedChallenges.Push ("Dominator" );
  27. if (APinPopsABalloon ) unselectedChallenges.Push ("APinPopsABalloon" );
  28. if (TwoMouthsToFeed ) unselectedChallenges.Push ("TwoMouthsToFeed" );
  29. if (WaitForIt ) unselectedChallenges.Push ("WaitForIt" );
  30. if (VarietyIsTheSpiceOfDeathIII) unselectedChallenges.Push ("VarietyIsTheSpiceOfDeathIII");
  31. if (GorePinata ) unselectedChallenges.Push ("GorePinata" );
  32. if (MyTeethAreSharper ) unselectedChallenges.Push ("MyTeethAreSharper" );
  33. if (HoldStill ) unselectedChallenges.Push ("HoldStill" );
  34. if (BigREDACTEDGun ) unselectedChallenges.Push ("BigREDACTEDGun" );
  35. }
  36.  
  37. string SelectNewChallenge () {
  38. if (unselectedChallenges.Size () < 1)
  39. return "";
  40.  
  41. int idx = random [EOA_ChallengeSelection] (0, unselectedChallenges.Size () - 1);
  42. string ret = unselectedChallenges [idx];
  43. unselectedChallenges.Delete (idx, 1);
  44.  
  45. return ret;
  46. }
  47.  
  48. int RollNewChallenges () {
  49. PopulateUnselectedChallenges ();
  50.  
  51. int challengesCount = 0;
  52. for (int i = 0; i < 3; i++) {
  53. string selectedChallenge = SelectNewChallenge ();
  54.  
  55. // If selectedChallenge is an empty string, there's no challenges to be selected.
  56. if (selectedChallenge ~== "")
  57. break;
  58.  
  59. for (int j = 0; j < MAXPLAYERS; j++) {
  60. PlayerInfo player = players [j];
  61.  
  62. if (player && player.mo && playeringame [j])
  63. player.mo.GiveInventory (String.Format ("%sChallenge", selectedChallenge), 1);
  64. }
  65.  
  66. challengesCount++
  67. }
  68.  
  69. return challengesCount;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement