public static int[] RollStats(ROLLS roll)//This will roll the Str, Dex, Wis... stats { int iNextStat; int[] Stats = new int[6]; LinkedList <int> Rolls = new LinkedList <int>(); if (roll == ROLL4D6) // runs code for if you are doing 4d6 Minus the lowest { for (int i = 0; i <= 5; i++) //runs the code 6 times(1 for each stat) { for (int i2 = 1; i2 <= 4; i2++) //Does the rolls and adds them to a list { Rolls.AddLast(RollD(6)); } iNextStat = Rolls.Sum(); // adds the numbers of the list iNextStat = iNextStat - Rolls.Min(); // sub tracts the Lowest one Stats[i] = iNextStat; // adds The stat to the list while (Rolls.First != null) //Removes all numbers from List Rolls { Rolls.RemoveFirst(); } } } else if (roll == ROLL3D6) { for (int i = 1; i <= 6; i++) //runs the code 6 times(1 for each stat) { for (int i2 = 1; i2 <= 3; i2++) //Does the rolls and adds them to a list { Rolls.AddLast(RollD(6)); } iNextStat = Rolls.Sum(); // adds the numbers of the list Stats[i] = iNextStat; // adds The stat to the list while (Rolls.First != null) //Removes all numbers from List Rolls { Rolls.RemoveFirst(); } } } return(Stats);//gives you a list of 6 numbers }
public Character(GAME G, int L, ROLLS R) { game = G; level = L; rollType = R; Stats = Rolling.RollStats(rollType); Mods = Rolling.findMods(Stats); CClass = Class.RollClass(game); CRace = race.RollRace(game); HP = HPGold.RollHP(game, CClass, level); Gold = HPGold.RollGold(game, CClass); if (game == DND5e) { background = Background.RollBackground(game); } }