Ejemplo n.º 1
0
        public RollResult(IRollTarget target, SingleRollResult initialRollResult, SingleRollResult rerollResult, int modifierValue, int final)
        {
            Guard.Against.Null(target, nameof(target));
            Guard.Against.Null(initialRollResult, nameof(initialRollResult));

            InitialRollResult = initialRollResult;
            Target            = target;
            RerollResult      = rerollResult;
            ModifierValue     = modifierValue;
            Final             = final;
            IsSuccessful      = target.GetSuccessfulSides(initialRollResult.Die.TotalSides).Contains(final);
        }
Ejemplo n.º 2
0
        public RollResult Simulate()
        {
            var initial = _die.Simulate(_numberGenerator);
            SingleRollResult rerollResult = null;
            var final = initial;

            if (_rerollOptions.RequiresReroll(initial, _target))
            {
                rerollResult = _die.Simulate(_numberGenerator);
                final        = rerollResult;
            }

            var modifiedValue = _modifier.ModifyRoll(final.SideRolled);

            return(new RollResult(_target, initial, rerollResult, _modifier.ModifierValue, modifiedValue));
        }
Ejemplo n.º 3
0
 public bool RequiresReroll(SingleRollResult initial, IRollTarget target)
 {
     return(initial.SideRolled == 1);
 }
Ejemplo n.º 4
0
 public bool RequiresReroll(SingleRollResult initial, IRollTarget target)
 {
     return(!target.GetSuccessfulSides(initial.Die.TotalSides).Contains(initial.SideRolled));
 }
Ejemplo n.º 5
0
 public bool RequiresReroll(SingleRollResult initial, IRollTarget target)
 {
     return(false);
 }