///////////////////////////////////////////////////////////
//  Dice.cs
//  Implementation of the Class Dice
//  Generated by Enterprise Architect
//  Created on:      28-Apr-2014 10:13:36 PM
//  Original author: Gsimmons
///////////////////////////////////////////////////////////


using System;
using System.Linq;

namespace Mazegame.Entity
{
    public class Dice
    {
        public Dice(int rolls, int sides)
        {
            Rolls = rolls;
            Sides = sides;
        }

        public int Rolls { get; private set; }
        public int Sides { get; private set; }

        private Random random = new Random();
        public int GetRollResult()
        {
            return Enumerable.Range(1, Rolls).Sum(r => random.Next(1, Sides + 1));
        }

        public override string ToString()
        {
            return $"{Rolls}d{Sides}";
        }
    } //end Dice
} //end namespace Entity