private static void IncreaseBy2D6(List <int> stats, int statMax) { DieRoll d6 = new DieRoll(6); int totalRoll = d6.RollDie() + d6.RollDie(); Console.WriteLine($"You rolled: {totalRoll} on your 2D6.\n "); var statsDisplay = new Stats(); while (totalRoll != 0) { statsDisplay.PrintStatsToAssign(stats); Console.WriteLine("Pick a stat to increase by entering the number next to it."); int pickedStat = CLIHelper.GetNumberInRange(1, stats.Count); Console.WriteLine($"Enter the amount of points you'd like to spend. You have {totalRoll} points remaining."); int pointsToSpend = CLIHelper.GetNumberInRange(0, totalRoll); int newTotal = stats[pickedStat - 1] + pointsToSpend; if (newTotal <= statMax) { stats[pickedStat - 1] = newTotal; totalRoll = totalRoll - pointsToSpend; } else { Console.WriteLine($"Your stat cannot exceed the max of: {statMax}. Try spending less points."); } } Console.Clear(); }
public static int BackgroundPrompts(string backgroundPiece, string[] backgroundProperty) { Console.Clear(); Console.WriteLine($"If you'd like to pick your {backgroundPiece} enter '1'." + $"\nIf you want to roll it randomly enter '2'."); int answer = CLIHelper.GetNumberInRange(1, 2); int index = 0; if (answer == 1) { Console.WriteLine($"Enter the number next to the {backgroundPiece} you want."); index = CLIHelper.PrintChoices(backgroundProperty); } else { bool gettingPiece = true; while (gettingPiece) { DieRoll dx = new DieRoll(backgroundProperty.Length); int dieRoll = dx.RollDie() - 1; if (index == dieRoll) { dieRoll = dx.RollDie() - 1; } index = dieRoll; Console.WriteLine($"Your {backgroundPiece} is: {backgroundProperty[index]}"); Console.WriteLine($"If you'd like to keep that {backgroundPiece} enter '1', if not hit enter." + $"\nIf you'd like to pick from the list instead, enter '2'."); int input = CLIHelper.GetNumberInRange(1, 2); if (input == 1) { gettingPiece = false; } if (input == 2) { Console.WriteLine($"Enter the number next to the {backgroundPiece} you want."); index = CLIHelper.PrintChoices(backgroundProperty); gettingPiece = false; } } } return(index); }
public static void Roll(List <int> allStats) { int[] rolls = new int[4]; DieRoll d6 = new DieRoll(6); for (int i = 0; i < 6; i++) { int totalRoll = 0; for (int j = 0; j < rolls.Length; j++) { rolls[j] = d6.RollDie(); //reroll ones and twos while (rolls[j] < 3) { rolls[j] = d6.RollDie(); } totalRoll += rolls[j]; } totalRoll -= rolls.Min(); allStats.Add(totalRoll); } }