static void Main(string[] args) { bool inMenu = true; char keyPressed; DiceBag dice = new DiceBag(); Character c = new Character(); while (inMenu) { System.Console.WriteLine(); System.Console.WriteLine(HorizontalRule); System.Console.WriteLine("What would you like to do now?"); System.Console.WriteLine("1. Roll d20"); System.Console.WriteLine("2. Roll with advantage"); System.Console.WriteLine("3. Roll from dice bag"); System.Console.WriteLine("4. Character Creation"); System.Console.WriteLine("Q. Quit"); keyPressed = System.Console.ReadKey().KeyChar; System.Console.WriteLine(); switch (keyPressed) { case '1': dice.Roll_d20(false); break; case '2': dice.Roll_d20(true); break; case '3': RollFromDiceBag(); break; case '4': //c.RollCharacterCreation(); break; case '5': c.Strength.Score = 14; break; case 'Q': case 'q': inMenu = false; break; } } }
public void TestRollWithAdvantage() { DiceBag dice = new DiceBag(); int result = dice.Roll_d20(true); Assert.IsTrue(Enumerable.Range(1, 20).Contains(result)); }
public int SavingThrow(int proficiencyBonus) { DiceBag dice = new DiceBag(); int roll = dice.Roll_d20(false); roll += Modifier(); if (SavingThrowProficiency) { roll += proficiencyBonus; } return(roll); }
public int Check(int modifier, int proficiencyBonus) { DiceBag dice = new DiceBag(); int roll = dice.Roll_d20(false); roll += modifier; if (Proficiency) { roll += proficiencyBonus; } return(roll); }