jig487

Barotrauma Optional Traitor Objectives C++ version

Jun 24th, 2021 (edited)
830
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <string>
  3. #include <array>
  4. #include <random>
  5. using namespace std;
  6.  
  7. int main() {
  8.     array<string, 17> obj = {
  9.         "Flood the cargo bay and destroy the cargo if possible.", //0
  10.         "Dump all wrenches and screwdrivers you can find. Then Sabotage the ballast pumps",
  11.         "Dump all non inventory stored oxygen tanks on the sub.",
  12.         "Ensure the guns of the sub are unusable.",
  13.         "Cause a reactor meltdown.",
  14.         "Set and detonate 2 explosives simultaneously in the sub.",
  15.         "killX",
  16.         "Steal 3 weapons from the armory.",
  17.         "Spray paint in 4 non ballast rooms.",
  18.         //"Find and wear the clown costume.",
  19.         "Sabotage at least 8 lights.",
  20.         "Sabotage at least 4 doors.",
  21.         "Dump all bandages, blood, and saline in the sub.",
  22.         "Plasma cut the outer airlock doors.",
  23.         "Dump all diving suits in the sub.",
  24.         "Ensure the crew have no way of leaving.",
  25.         "Cause the sub to crash.",
  26.         "Ensure the crew do not complete their main objective", //16
  27.     };
  28.  
  29.     array<string, 4> role = {
  30.         "Captain",
  31.         "Engineer",
  32.         "Mechanic",
  33.         "Doctor",
  34.     };
  35.  
  36.     random_device rd; //real randomness thingy for seeding
  37.     default_random_engine generator(rd()); //seed the generator with real randomness
  38.     uniform_int_distribution<int> distribution(0,role.size() - 1); //Setting distribution to role array size
  39.  
  40.     array<int, 3> rdm;
  41.     rdm[2] = distribution(generator);
  42.  
  43.     distribution.param(uniform_int_distribution<int>::param_type{0,obj.size() - 1}); //Setting distribution to obj array size
  44.     rdm[0] = distribution(generator);
  45.     rdm[1] = distribution(generator);
  46.  
  47.     while (rdm[0] == rdm[1]) {
  48.         rdm[1] = distribution(generator);
  49.     }
  50.     cout << "Your other traitor objectives are:\n\n";
  51.     for (int i = 0; i < 2; i++) {
  52.         if (obj[rdm[i]] == "killX") {
  53.             if (rdm[2] == 1) {
  54.                 cout << i + 1 << ": Ensure the Captains death.";
  55.             }
  56.             else {
  57.                 cout << i + 1 << ": Ensure a " << role[rdm[3]] << " dies.";
  58.             }
  59.         }
  60.         else {
  61.             cout << i + 1 << ": " << obj[rdm[i]];
  62.         }
  63.     cout << "\n\n";
  64.     }
  65.     cout << "Good luck.";
  66.     return 0;
  67. }
RAW Paste Data