public static RollResult operator+(RollResult a, RollResult r) { RollResult nr = new RollResult(); nr.Total = a.Total + r.Total; nr.Rolls.AddRange(a.Rolls); nr.Rolls.AddRange(r.Rolls); nr.Mod = a.Mod + r.Mod; return(nr); }
public RollResult Roll() { RollResult roll = new RollResult(); roll.Mod = mod; roll.Total = mod; foreach (DieStep step in AllRolls) { for (int i = 0; i < step.Count; i++) { DieResult res = new DieResult(); res.Die = step.Die; res.Result += rand.Next(1, step.Die + 1); roll.Total += res.Result; roll.Rolls.Add(res); } } return(roll); }