public void CanBeSetToAllowsRollTheMaximumValue() { var cup = new Cup(); cup.AddDice(Die.GetDice(DiceSides.d6, 10)); cup.MaximizeAmount = true; Assert.Equal(60, cup.Roll()); Assert.Equal(60, cup.Roll()); Assert.Equal(60, cup.Roll()); }
/// <summary> /// Roll4d6 To get ability Score /// </summary> /// <returns>Top 3 dice summed</returns> private int Roll4d6() { var diceCup = new Cup(Die.GetDice(DiceSides.d6, 4)); diceCup.Roll(); return(diceCup.SumTop(3)); }
public void CupCanHaveABaseValueForTheRoll() { var cup = new Cup(); cup.AddDie(Die.D4()); cup.Modifier = 20; Assert.True(cup.Roll() >= 20); }
public void CupCanHaveABaseValueForTheRoll() { var cup = new Cup(); cup.AddDie(Die.D4()); cup.Modifier = 20; Assert.GreaterOrEqual(cup.Roll(), 20); }
/// <summary> /// Rolls the level up hit points /// </summary> /// <returns>The level up hitpoint amount.</returns> /// <param name="character">Character to roll hit points for.</param> public int RollLevelUp(CharacterSheet character) { var cup = new Cup(); cup.AddDie(new Die(character.Class.HitDice)); cup.Modifier = character.AbilityScores.GetModifier(AbilityScoreTypes.Constitution); return(cup.Roll()); }
public void ItRollsAllTheDiceWhenRollingTheCup() { var cup = new Cup(); cup.AddDie(Die.D6()); cup.AddDie(Die.D6()); cup.Roll(); Assert.True(cup.Dice.All(x => x.LastRoll > 0)); }
public void ResultIsTheSumOfAllDiceRolled() { var cup = new Cup(); cup.AddDie(Die.D6()); cup.AddDie(Die.D6()); var result = cup.Roll(); Assert.Equal(result, cup.Dice.Sum(x => x.LastRoll)); }
public List <int> GetScores() { List <int> scores = new List <int>(); var diceCup = new Cup(Die.GetDice(DiceSides.d6, 3)); for (int i = 0; i < 6; i++) { scores.Add(diceCup.Roll()); } return(scores); }
public void ExecuteStep(CharacterSheet character) { var cup = new Cup(); cup.AddDie(new Die(character.Class.HitDice)); var roll = cup.Roll(); var modifier = new ValueStatModifier(roll); var hitpoints = character.FindStat(StatNames.HitPoints); hitpoints.AddModifier(modifier); hitpoints.AddModifier(character.AbilityScores.GetAbility(AbilityScoreTypes.Constitution).UniversalStatModifier); }
public void ResultsCanBeFilteredByTakingTheHighestNumberOfDice() { //For stats we frequently roll 4d6 and want the top 3... var cup = new Cup(Die.GetDice(DiceSides.d6, 4)); cup.Roll(); var sumTop3 = cup.SumTop(3); var manualSum = 0; var lowest = 100; foreach (var d in cup.Dice) { manualSum += d.LastRoll; if (d.LastRoll < lowest) { lowest = d.LastRoll; } } Assert.Equal(manualSum - lowest, sumTop3); }
static void Main(string[] args) { var cup = new Cup(); while (true) { var answer = MainMenu(); switch (answer) { case 1: Console.WriteLine(cup.Roll()); break; case 2: DieMenu(cup); break; case 3: cup.Empty(); break; } } }
public void ShouldProduceTheCorrectNumberOfDieRolls() { cup.Roll(); randomizer.Received(2).GetRandomNumber(1, 6); }