You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
975 B
47 lines
975 B
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Models.Game
|
|
{
|
|
public class De
|
|
{
|
|
public int NbMin { get; private set; }
|
|
|
|
public int NbMax { get; private set; }
|
|
|
|
public int Nb { get; private set; }
|
|
|
|
public De(int nbmin)
|
|
{
|
|
if (nbmin < 0) nbmin = 0;
|
|
if (nbmin > 1) nbmin = 1;
|
|
NbMin = nbmin;
|
|
NbMax = nbmin + 5;
|
|
}
|
|
|
|
public De()
|
|
{
|
|
NbMin = 0;
|
|
NbMax = 5;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return $"Ce dé a pour valeur {Nb} et est entre {NbMin} et {NbMax}";
|
|
}
|
|
|
|
public void Lancer()
|
|
{
|
|
Nb = new Random().Next(NbMin, NbMax + 1);
|
|
}
|
|
|
|
public bool IsLower(De de1)
|
|
{
|
|
if (de1.Nb > this.Nb) return true;
|
|
else return false;
|
|
}
|
|
}
|
|
} |