TeslaCoilGirl

FNV Character Creator

Apr 28th, 2020
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 19.51 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. #include <stdlib.h>
  4.  
  5. #include <math.h>
  6.  
  7. #include <string.h>
  8.  
  9. //Comparison function for bsearch
  10. int cmpfunc(const void * a,
  11.   const void * b) {
  12.   // return ( *(int*)a - *(int*)b );
  13.   return strcmp((char * ) a, (char * ) b);
  14. }
  15.  
  16. //SPECIAL is your character's base stats that affect your initial skill points, weapon handling, and other gameplay elements.
  17. struct Special {
  18.   int strength;
  19.   int perception;
  20.   int endurance;
  21.   int charisma;
  22.   int intelligence;
  23.   int agility;
  24.   int luck;
  25. };
  26.  
  27. //Skills affect weapon handling and gameplay elements.
  28. struct Skills {
  29.   int barter;
  30.   int enerWeap;
  31.   int explosives;
  32.   int guns;
  33.   int lockpick;
  34.   int medicine;
  35.   int meleeWeap;
  36.   int repair;
  37.   int science;
  38.   int sneak;
  39.   int speech;
  40.   int survival;
  41.   int unarmed;
  42. };
  43. struct Special c1;
  44. struct Skills s1;
  45.  
  46. //Skill list names in string
  47. char skillList[13][30] = {
  48.   "barter",
  49.   "energy weapons",
  50.   "explosives",
  51.   "guns",
  52.   "lockpick",
  53.   "medicine",
  54.   "melee weapons",
  55.   "repair",
  56.   "science",
  57.   "sneak",
  58.   "speech",
  59.   "survival",
  60.   "unarmed"
  61. };
  62.  
  63. int main() {
  64.   //Initialize SPECIAL
  65.   c1.strength = 1;
  66.   c1.perception = 1;
  67.   c1.endurance = 1;
  68.   c1.charisma = 1;
  69.   c1.intelligence = 1;
  70.   c1.agility = 1;
  71.   c1.luck = 1;
  72.  
  73.   int totSpec = 61; //Max possible SPECIAL for FNV
  74.   int minSpec = 40; //Min possible SPECIAL for FNV
  75.   int charSpec = 0; //Your character's SPECIAL
  76.  
  77.   while ((charSpec > totSpec) || (charSpec < minSpec)) {
  78.     //Get SPECIAL
  79.     //Note SPECIAL values are between 1 and 10
  80.  
  81.     //Strength
  82.     printf("Strength: ");
  83.     scanf("%d", & (c1.strength));
  84.     while ((c1.strength < 1) || (c1.strength > 10)) { //Boundary checker; repeat until within boundaries. Same for all SPECIAL values
  85.       printf("\nInvalid entry. Please enter a number between 1 and 10.\nStrength: ");
  86.       scanf("%d", & (c1.strength));
  87.     }
  88.     charSpec += c1.strength;
  89.  
  90.     //Perception
  91.     printf("\nPerception: ");
  92.     scanf("%d", & (c1.perception));
  93.     while ((c1.perception < 1) || (c1.perception > 10)) {
  94.       printf("\nInvalid entry. Please enter a number between 1 and 10.\nPerception: ");
  95.       scanf("%d", & (c1.perception));
  96.     }
  97.     charSpec += c1.perception;
  98.  
  99.     //Endurance
  100.     printf("\nEndurance: ");
  101.     scanf("%d", & (c1.endurance));
  102.     while ((c1.endurance < 1) || (c1.endurance > 10)) {
  103.       printf("\nInvalid entry. Please enter a number between 1 and 10.\nEndurance: ");
  104.       scanf("%d", & (c1.endurance));
  105.     }
  106.     charSpec += c1.endurance;
  107.  
  108.     //Charisma
  109.     printf("\nCharisma: ");
  110.     scanf("%d", & (c1.charisma));
  111.     while ((c1.charisma < 1) || (c1.charisma > 10)) {
  112.       printf("\nInvalid entry. Please enter a number between 1 and 10.\nCharisma: ");
  113.       scanf("%d", & (c1.charisma));
  114.     }
  115.     charSpec += c1.charisma;
  116.  
  117.     //Intelligence
  118.     printf("\nIntelligence: ");
  119.     scanf("%d", & (c1.intelligence));
  120.     while ((c1.intelligence < 1) || (c1.intelligence > 10)) {
  121.       printf("\nInvalid entry. Please enter a number between 1 and 10.\nIntelligence: ");
  122.       scanf("%d", & (c1.intelligence));
  123.     }
  124.     charSpec += c1.intelligence;
  125.  
  126.     //Agility
  127.     printf("\nAgility: ");
  128.     scanf("%d", & (c1.agility));
  129.     while ((c1.agility < 1) || (c1.agility > 10)) {
  130.       printf("\nInvalid entry. Please enter a number between 1 and 10.\nAgility: ");
  131.       scanf("%d", & (c1.agility));
  132.     }
  133.     charSpec += c1.agility;
  134.  
  135.     //Luck
  136.     printf("\nLuck: ");
  137.     scanf("%d", & (c1.luck));
  138.     while ((c1.luck < 1) || (c1.luck > 10)) {
  139.       printf("\nInvalid entry. Please enter a number between 1 and 10.\nPerception: ");
  140.       scanf("%d", & (c1.luck));
  141.     }
  142.     charSpec += c1.luck;
  143.  
  144.     while ((charSpec > totSpec) || (charSpec < minSpec)) { //If your character SPECIAL is out of bounds
  145.       char stat = 'S';
  146.  
  147.       printf("Please change one of the following so that the total is less than %d and greater than %d.\n\n", totSpec, minSpec);
  148.       printf("Strength: %d\nPerception: %d\nEndurance: %d\nCharisma: %d\nIntelligence: %d\nAgility: %d\nLuck %d\n\n", c1.strength, c1.perception, c1.endurance, c1.charisma, c1.intelligence, c1.agility, c1.luck);
  149.       if (charSpec < minSpec) {
  150.         printf("Total: %d, please add %d point(s) to the stats.\n", charSpec, minSpec - charSpec); //If under
  151.       }
  152.       if (charSpec > totSpec) {
  153.         printf("Total: %d, please remove %d point(s) to the stats.\n", charSpec, charSpec - totSpec); //If over
  154.       }
  155.       getchar(); //Absorbs newline
  156.       printf("Enter the stat you wish to change. (S, P, E, C, I, A, L): "); //Enter SPECIAL char to change it
  157.       stat = getchar();
  158.  
  159.       while ((stat != 'S') && (stat != 'P') && (stat != 'E') && (stat != 'C') && (stat != 'I') && (stat != 'A') && (stat != 'L')) { //If not one of the letters shown; should add lowercase.
  160.         printf("\nInvalid entry. Please enter one of the following letters: S, P, E, C, I, A, L\n");
  161.         getchar();
  162.         stat = getchar();
  163.       }
  164.  
  165.       if (stat == 'S') {
  166.         charSpec -= c1.strength; //Removes existing stat from total
  167.         printf("Strength: ");
  168.         scanf("%d", & (c1.strength));
  169.         charSpec += c1.strength; //Adds new stat value to total
  170.         printf("\n");
  171.       } else if (stat == 'P') {
  172.         charSpec -= c1.perception;
  173.         printf("Perception: ");
  174.         scanf("%d", & (c1.perception));
  175.         charSpec += c1.perception;
  176.         printf("\n");
  177.       } else if (stat == 'E') {
  178.         charSpec -= c1.endurance;
  179.         printf("Endurance: ");
  180.         scanf("%d", & (c1.endurance));
  181.         charSpec += c1.endurance;
  182.         printf("\n");
  183.       } else if (stat == 'C') {
  184.         charSpec -= c1.charisma;
  185.         printf("Charisma: ");
  186.         scanf("%d", & (c1.charisma));
  187.         charSpec += c1.charisma;
  188.         printf("\n");
  189.       } else if (stat == 'I') {
  190.         charSpec -= c1.intelligence;
  191.         printf("Intelligence: ");
  192.         scanf("%d", & (c1.intelligence));
  193.         charSpec += c1.intelligence;
  194.         printf("\n");
  195.       } else if (stat == 'A') {
  196.         charSpec -= c1.agility;
  197.         printf("Agility: ");
  198.         scanf("%d", & (c1.agility));
  199.         charSpec += c1.agility;
  200.         printf("\n");
  201.       } else if (stat == 'L') {
  202.         charSpec -= c1.luck;
  203.         printf("Luck: ");
  204.         scanf("%d", & (c1.luck));
  205.         charSpec += c1.luck;
  206.         printf("\n");
  207.       }
  208.       if ((charSpec >= minSpec) && (charSpec <= totSpec)) {
  209.         break; //If within bounds, break.
  210.       }
  211.     }
  212.  
  213.   }
  214.  
  215.   printf("\n");
  216.   int minLevel = 1 + (charSpec - 20) / 2; //Mostly unused code snippet, may reuse.
  217.   int tagSkills = 3; //Tag skills are initial skills you have that raise those skills by 15 points. You can have 3-4 Tag skills, 4 starting at level 5.
  218.   printf("Skills: Barter, Energy Weapons, Explosives, Guns, Lockpick, Medicine, Melee Weapons, Repair, Science, Sneak, Speech, Survival.\n\n");
  219.   if (minLevel >= 5) {
  220.     int response;
  221.     printf("Please choose whether you want 3 or 4 tag skills (as in, if your character has the Tag! perk or not).\n");
  222.     scanf("%d", & response);
  223.     while ((response != 3) && (response != 4)) {
  224.       printf("Invalid response. Please enter either 3 or 4. \n");
  225.       scanf("%d", & response);
  226.     }
  227.     if (response == 4) {
  228.       tagSkills++; //If your character DOES decide to take on the 4th tag skill, this adds one to the number of tag skills.
  229.     }
  230.   }
  231.   //Initializes skill points.
  232.   s1.barter = skillPoints(c1.charisma);
  233.   s1.enerWeap = skillPoints(c1.perception);
  234.   s1.explosives = skillPoints(c1.perception);
  235.   s1.guns = skillPoints(c1.agility);
  236.   s1.lockpick = skillPoints(c1.perception);
  237.   s1.medicine = skillPoints(c1.intelligence);
  238.   s1.meleeWeap = skillPoints(c1.strength);
  239.   s1.repair = skillPoints(c1.intelligence);
  240.   s1.science = skillPoints(c1.intelligence);
  241.   s1.sneak = skillPoints(c1.agility);
  242.   s1.speech = skillPoints(c1.charisma);
  243.   s1.survival = skillPoints(c1.endurance);
  244.   s1.unarmed = skillPoints(c1.endurance);
  245.  
  246.   getchar();
  247.   char ts1[30]; //Holders
  248.   char ts2[30];
  249.   char ts3[30];
  250.   char ts4[30];
  251.   int skill = 0;
  252.   while (skill != 1) {
  253.     printf("\nEnter first tag skill: ");
  254.     char skillName[30];
  255.     gets(skillName);
  256.     strcpy(ts1, skillName);
  257.     skill = cmpskill(skillName); //Checks to see if the typed skill is valid. If it isn't, it is set to 0, if it is, it's set to 1.
  258.     tagSkillInc(skillName, 15);
  259.     if (skill == 0) {
  260.       printf("Invalid response.");
  261.     }
  262.     if (skill == 1) {
  263.       break;
  264.     }
  265.  
  266.   }
  267.   skill = 0;
  268.   while (skill != 1) {
  269.     printf("\nEnter second tag skill: ");
  270.     char skillName[30];
  271.     gets(skillName);
  272.     int cmp = cmptag(skillName, ts1, ts2, ts3, ts4, 2); //Checks to see if it was already typed before it.
  273.     while (cmp == 0) { //It's 0 because one out of one will match before it.
  274.       printf("\nYou've already entered that skill. Please enter a different skill: ");
  275.       gets(skillName);
  276.       cmp = cmptag(skillName, ts1, ts2, ts3, ts4, 2);
  277.     }
  278.     strcpy(ts2, skillName);
  279.  
  280.     skill = cmpskill(skillName);
  281.     tagSkillInc(skillName, 15); //Adds 15 to the tag skill.
  282.     if (skill == 0) {
  283.       printf("Invalid response.");
  284.     }
  285.     if (skill == 1) {
  286.       break;
  287.     }
  288.  
  289.   }
  290.   skill = 0;
  291.   while (skill != 1) {
  292.     printf("\nEnter third tag skill: ");
  293.     char skillName[30];
  294.     gets(skillName);
  295.     int cmp = cmptag(skillName, ts1, ts2, ts3, ts4, 3);
  296.     while (cmp == 1) {
  297.       printf("\nYou've already entered that skill. Please enter a different skill: ");
  298.       gets(skillName);
  299.       cmp = cmptag(skillName, ts1, ts2, ts3, ts4, 3);
  300.     }
  301.     strcpy(ts3, skillName);
  302.     skill = cmpskill(skillName);
  303.     tagSkillInc(skillName, 15);
  304.     if (skill == 0) {
  305.       printf("Invalid response.");
  306.     }
  307.     if (skill == 1) {
  308.       break;
  309.     }
  310.  
  311.   }
  312.   if (tagSkills == 4) { //If 4 tag skills.
  313.     skill = 0;
  314.     while (skill != 1) {
  315.       printf("\nEnter fourth tag skill: ");
  316.       char skillName[30];
  317.       gets(skillName);
  318.       int cmp = cmptag(skillName, ts1, ts2, ts3, ts4, 4);
  319.       while (cmp == 2) {
  320.         printf("\nYou've already entered that skill. Please enter a different skill: ");
  321.         gets(skillName);
  322.         cmp = cmptag(skillName, ts1, ts2, ts3, ts4, 4);
  323.       }
  324.       strcpy(ts4, skillName);
  325.       skill = cmpskill(skillName);
  326.       tagSkillInc(skillName, 15);
  327.       if (skill == 0) {
  328.         printf("Invalid response.");
  329.       }
  330.       if (skill == 1) {
  331.         break;
  332.       }
  333.     }
  334.   }
  335.  
  336.   printf("\nEnter character level (make it make sense for your given SPECIAL): "); //Character level has to make sense for a given SPECIAL
  337.   int lvl;
  338.   scanf("%d", & lvl); //What level you want your character to be
  339.   int minLvl = minLvlCalc(lvl);
  340.   while ((lvl < 1) || (lvl > 50)) {
  341.     printf("Invalid entry. Please enter a number between 1 and 50."); //50 is the level cap in the game.
  342.     printf("\nLevel: ");
  343.     scanf("%d", & lvl);
  344.   }
  345.   while (minLvl > lvl) {
  346.     printf("Your SPECIAL doesn't make sense for your character level. Please enter something more realistic.");
  347.     printf("\nLevel: ");
  348.     scanf("%d", & lvl);
  349.   }
  350.  
  351.   int educ = 0;
  352.   if (minLvl >= 4) {
  353.     char yn;
  354.     while ((yn != 'Y') && (yn != 'y') && (yn != 'N') && (yn != 'n')) {
  355.       printf("\nWould you like to take the Educated perk? (Y/N) "); //Educated perk gives two extra skill points per level. May have minimum intelligence requirement I have to add in.
  356.       getchar();
  357.       scanf("%c", & yn);
  358.       getchar();
  359.  
  360.       if ((yn == 'Y') || (yn == 'y')) {
  361.         educ = 2;
  362.       } else if ((yn == 'N') || (yn == 'n')) {
  363.         educ = 0;
  364.       } else {
  365.         printf("\nInvalid response.\n");
  366.       }
  367.     }
  368.   }
  369.   printSkills(); //Prints your skills.
  370.   int totPoint = totPoints(educ, lvl); //Available skill points given your intelligence, luck, and level.
  371.   while (totPoint > 0) { //Until total points hit 0, keep looping this section
  372.     printf("\nYou have %d points remaining", totPoint);
  373.     printf("\nSelect how many points you want to add to a skill: "); //Backwards because it makes the code easier. This part breaks if you type a char in here on accident.
  374.     int pointSelect;
  375.     scanf("%d", & pointSelect);
  376.     while ((totPoint - pointSelect < 0) || (pointSelect < 0) || (pointSelect > 100)) { //Don't drop below 0, type a number above 100, or a negative number
  377.       printf("\nInvalid entry.\n");
  378.       printf("\nSelect how many points you want to add to a skill: ");
  379.       scanf("%d", & pointSelect);
  380.     }
  381.     char selectSkill[30];
  382.     printf("To which skill would you like to add this to? "); //Which skill do you want to add that many points to?
  383.     getchar();
  384.     gets(selectSkill);
  385.     while (cmpskill(selectSkill) != 1) {
  386.       printf("\nInvalid response.\n");
  387.       printf("To which skill would you like to add this to? ");
  388.       gets(selectSkill);
  389.     }
  390.     int inc = tagSkillInc(selectSkill, pointSelect);
  391.     totPoint -= pointSelect;
  392.     totPoint += inc;
  393.     printSkills();
  394.   }
  395.  
  396.   printf("\n\n       YOUR SPECIAL      \n"); //Prints your SPECIAL
  397.   printf("_________________________\n");
  398.   printf("STR: %d\n", c1.strength);
  399.   printf("PER: %d\n", c1.perception);
  400.   printf("END: %d\n", c1.endurance);
  401.   printf("CHA: %d\n", c1.charisma);
  402.   printf("INT: %d\n", c1.intelligence);
  403.   printf("AGL: %d\n", c1.agility);
  404.   printf("LCK: %d\n", c1.luck);
  405.   printSkills();
  406.  
  407. }
  408.  
  409. void printSkills(void) { //Prints your skills
  410.   printf("\n        YOUR SKILLS     \n");
  411.   printf("____________________________\n");
  412.   printf("Barter           |    %d\n", s1.barter);
  413.   printf("Energy Weapons   |    %d\n", s1.enerWeap);
  414.   printf("Explosives       |    %d\n", s1.explosives);
  415.   printf("Guns             |    %d\n", s1.guns);
  416.   printf("Lockpick         |    %d\n", s1.lockpick);
  417.   printf("Medicine         |    %d\n", s1.medicine);
  418.   printf("Melee Weapons    |    %d\n", s1.meleeWeap);
  419.   printf("Repair           |    %d\n", s1.repair);
  420.   printf("Science          |    %d\n", s1.science);
  421.   printf("Sneak            |    %d\n", s1.sneak);
  422.   printf("Speech           |    %d\n", s1.speech);
  423.   printf("Survival         |    %d\n", s1.survival);
  424.   printf("Unarmed          |    %d\n\n", s1.unarmed);
  425.  
  426. }
  427. int skillPoints(int stat) { //Skill equation
  428.   int skill = 2 + (2 * stat) + ceil((float) c1.luck / 2); //Each skill has an associated stat that determines its initial value.
  429.   return skill;
  430. }
  431.  
  432. int cmpskill(char skillName[30]) { //Checks to see if the typed skill is valid
  433.   char * item;
  434.   for (int i = 0; i < 30; i++) {
  435.     skillName[i] = tolower(skillName[i]);
  436.   }
  437.  
  438.   item = (char * ) bsearch(skillName, skillList, 13, sizeof(char) * 30, cmpfunc); //bsearch must be in ascending order bsearch(&key,values,sizeoflist,bytesperelement,comparisonfunction)
  439.   if (item != NULL) { //bsearch returns nullptr if it didn't find anything, and something if it does.
  440.     return 1;
  441.   }
  442.   if (item == NULL) {
  443.     return 0;
  444.   }
  445. }
  446.  
  447. int cmptag(char comparison[30], char ts1[30], char ts2[30], char ts3[30], char ts4[30], int index) {
  448.   int cmp = 0;
  449.   for (int i = 0; i < 30; i++) { //Checks to see if element has been typed before through strcmps.
  450.     comparison[i] = tolower(comparison[i]);
  451.   }
  452.  
  453.   if (index == 2) {
  454.     cmp += abs(strcmp(comparison, ts1));
  455.   }
  456.   if (index == 3) {
  457.     cmp += abs(strcmp(comparison, ts1));
  458.     cmp += abs(strcmp(comparison, ts2));
  459.   }
  460.   if (index == 4) {
  461.     cmp += abs(strcmp(comparison, ts1));
  462.     cmp += abs(strcmp(comparison, ts2));
  463.     cmp += abs(strcmp(comparison, ts3));
  464.   }
  465.   return cmp;
  466.  
  467. }
  468. int tagSkillInc(char skillName[30], int inc) { //Adds values to skills.
  469.  
  470.   for (int i = 0; i < 30; i++) {
  471.     skillName[i] = tolower(skillName[i]);
  472.   }
  473.   int placeHolder; //Placeholder, as name suggests.
  474.  
  475.   if (strcmp(skillName, "barter") == 0) {
  476.     s1.barter += inc;
  477.     if (s1.barter > 100) { //If your value is over 100, return the difference and set it equal to 100.
  478.       placeHolder = s1.barter;
  479.       s1.barter = 100;
  480.       return placeHolder - 100;
  481.     }
  482.   }
  483.   if (strcmp(skillName, "energy weapons") == 0) {
  484.     s1.enerWeap += inc;
  485.     if (s1.enerWeap > 100) {
  486.       placeHolder = s1.enerWeap;
  487.       s1.enerWeap = 100;
  488.       return placeHolder - 100;
  489.     }
  490.   }
  491.   if (strcmp(skillName, "explosives") == 0) {
  492.     s1.explosives += inc;
  493.     if (s1.explosives > 100) {
  494.       placeHolder = s1.explosives;
  495.       s1.explosives = 100;
  496.       return placeHolder - 100;
  497.     }
  498.   }
  499.   if (strcmp(skillName, "guns") == 0) {
  500.     s1.guns += inc;
  501.     if (s1.guns > 100) {
  502.       placeHolder = s1.guns;
  503.       s1.guns = 100;
  504.       return placeHolder - 100;
  505.     }
  506.   }
  507.   if (strcmp(skillName, "lockpick") == 0) {
  508.     s1.lockpick += inc;
  509.     if (s1.lockpick > 100) {
  510.       placeHolder = s1.lockpick;
  511.       s1.lockpick = 100;
  512.       return placeHolder - 100;
  513.     }
  514.   }
  515.   if (strcmp(skillName, "medicine") == 0) {
  516.     s1.medicine += inc;
  517.     if (s1.medicine > 100) {
  518.       placeHolder = s1.medicine;
  519.       s1.medicine = 100;
  520.       return placeHolder - 100;
  521.     }
  522.   }
  523.   if (strcmp(skillName, "melee weapons") == 0) {
  524.     s1.meleeWeap += inc;
  525.     if (s1.meleeWeap > 100) {
  526.       placeHolder = s1.meleeWeap;
  527.       s1.meleeWeap = 100;
  528.       return placeHolder - 100;
  529.     }
  530.   }
  531.   if (strcmp(skillName, "repair") == 0) {
  532.     s1.repair += inc;
  533.     if (s1.repair > 100) {
  534.       placeHolder = s1.repair;
  535.       s1.repair = 100;
  536.       return placeHolder - 100;
  537.     }
  538.   }
  539.   if (strcmp(skillName, "science") == 0) {
  540.     s1.science += inc;
  541.     if (s1.science > 100) {
  542.       placeHolder = s1.science;
  543.       s1.science = 100;
  544.       return placeHolder - 100;
  545.     }
  546.   }
  547.   if (strcmp(skillName, "sneak") == 0) {
  548.     s1.sneak += inc;
  549.     if (s1.sneak > 100) {
  550.       placeHolder = s1.sneak;
  551.       s1.sneak = 100;
  552.       return s1.sneak - 100;
  553.     }
  554.   }
  555.   if (strcmp(skillName, "speech") == 0) {
  556.     s1.speech += inc;
  557.     if (s1.speech > 100) {
  558.       placeHolder = s1.sneak;
  559.       s1.speech = 100;
  560.       return placeHolder - 100;
  561.     }
  562.   }
  563.   if (strcmp(skillName, "survival") == 0) {
  564.     s1.survival += inc;
  565.     if (s1.survival > 100) {
  566.       placeHolder = s1.survival;
  567.       s1.survival = 100;
  568.       return placeHolder - 100;
  569.     }
  570.   }
  571.   if (strcmp(skillName, "unarmed") == 0) {
  572.     s1.unarmed += inc;
  573.     if (s1.unarmed > 100) {
  574.       placeHolder = s1.unarmed;
  575.       s1.unarmed = 100;
  576.       return placeHolder - 100;
  577.     }
  578.   }
  579. }
  580.  
  581. int minLvlCalc(int lvl) {
  582.   int spec = c1.strength + c1.perception + c1.endurance + c1.charisma + c1.intelligence + c1.agility + c1.luck;
  583.   int minLvl;
  584.   if ((spec > 40) && (spec < 45)) { //Sensible level amounts for a given SPECIAL total.
  585.     minLvl = 10;
  586.   }
  587.   if ((spec >= 45) && (spec < 50)) {
  588.     minLvl = 20;
  589.   }
  590.   if ((spec >= 50) && (spec < 55)) {
  591.     minLvl = 30;
  592.   }
  593.   if ((spec >= 55) && (spec <= 61)) {
  594.     minLvl = 40;
  595.   }
  596.   return minLvl;
  597. }
  598.  
  599. int totPoints(int educ, int lvl) { //Total available skill points to add given your level and intelligence and whether or not you have the Educated perk.
  600.   int pointTotal = 0;
  601.   if (c1.intelligence % 2 == 0) {
  602.     pointTotal = lvl * (10 + c1.intelligence / 2 + educ);
  603.   }
  604.   if (c1.intelligence % 2 == 1) {
  605.     if (lvl % 2 == 0) {
  606.       pointTotal = (lvl / 2) * (10 + c1.intelligence / 2 + educ) + (lvl / 2) * (10 + c1.intelligence / 2 + 1 + educ);
  607.     }
  608.     if (lvl % 2 == 1) {
  609.       pointTotal = (lvl / 2) * (10 + c1.intelligence / 2 + educ) + (lvl / 2) * (10 + c1.intelligence / 2 + 1 + educ) + (10 + c1.intelligence / 2 + educ);
  610.     }
  611.   }
  612.   return pointTotal;
  613. }
  614.  
  615. //Add option for skill books (increases by 3 or 4, based on perks you take). Change SPECIAL mechancics to manually enter perks to manipulate.
Add Comment
Please, Sign In to add comment