public void SetUp() { _mockDice = Fixture.Mock <IDice>(); _mockDice.Setup(d => d.Roll()).Callback(() => _lastDecoratedDieRoll = Fixture.Create <IRoll>()).Returns(() => _lastDecoratedDieRoll); _diceWithCache = new DiceWithCacheDecorator(_mockDice.Object); }
public IRoll Roll() { var roll = _decoratedDice.Roll(); _lastRoll = roll; return(roll); }
public string RollOnRoll(IRoll roll) { string rollOnRollResult = string.Empty; using (var utility = new RandomUtility()) { if (roll.TypeOfRoll == GmDashboardTypes.StandardRoll || roll.TypeOfRoll == GmDashboardTypes.RangeRoll || roll.TypeOfRoll == GmDashboardTypes.TextRoll) { var chartRoll = (StandardRoll)roll; //TODO THIS SHOULD BE USEING THE DICE NUMBER TO PICK THE ROLL... //THE REASON WE ARE NOT IS BECAUSE WE HAVE NOT FULL GOTTEN THE PRECENT ROLL var diceOutcome = utility.RollDice(((StandardRoll)roll).Outcomes.Count) - 1; var resultOfRoll = chartRoll.Outcomes.ElementAt(diceOutcome); if (resultOfRoll.TypeOfRoll == GmDashboardTypes.StandardRoll) { chartRoll.Outcome += chartRoll.Description + RollOnRoll(resultOfRoll); } else { var outcome = chartRoll.Description + " " + resultOfRoll.GetDescription; chartRoll.Outcome = outcome; return(outcome); } } return(""); } }
public void Register(IRoll roll) { _bonusMultiplier.Register(roll.Type); var rollScore = _bonusMultiplier.Current * roll.PinsKnocked; Score += rollScore; }
private IEnumerable <RollResult> TestRoll(IRoll rolls) { foreach (var roll in rolls.Results) { RollResultDisposition result = roll.Value + Modifier >= TargetValue ? RollResultDisposition.Pass : RollResultDisposition.Fail; yield return(new RollResult(roll.Value, result)); } }
public void no_possible_success_if_AP_too_strong() { Save save = new Save(1); var allPossibleDices = new IRoll[] { new OnlyRollOne(), new OnlyRollTwo(), new OnlyRollThree(), new OnlyRollFour(), new OnlyRollFive(), new OnlyRollSix() }; var rolls = allPossibleDices.Select(d => save.Roll(d, 6)); Assert.IsTrue(rolls.All(r => r.Missed)); }
private static bool IsEmpty(IRoll next) { return !(next.IsHit || next.IsSpare || next.IsStrike); }
public Roll(char roll, IRoll next = null) { _roll = roll; Next = next ?? new NullRoll(); }
public TestedRoll(int targetValue, int modifier, IRoll roll) { TargetValue = targetValue; Modifier = modifier; Results = TestRoll(roll); }
public void Register(IRoll roll) { _bonusMultiplier.Register(roll.Type); var rollScore = _bonusMultiplier.Current * roll.PinsKnocked; Score += rollScore; }