Implement basic functional diceroll command

This commit is contained in:
2022-12-19 01:36:43 +01:00
parent b0a1381589
commit 1a8409994c
3 changed files with 174 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
package wtf.beatrice.hidekobot.objects;
import wtf.beatrice.hidekobot.util.RandomUtil;
import java.util.UUID;
public class Dice
{
private final int sides;
private int value = 0;
private final UUID uuid;
public Dice(int sides)
{
this.sides = sides;
this.uuid = UUID.randomUUID();
}
public Dice(Dice old)
{
this.sides = old.sides;
this.value = old.value;
this.uuid = UUID.randomUUID();
}
public int getValue()
{
return value;
}
public int getSides()
{
return sides;
}
public void roll()
{
value = RandomUtil.getRandomNumber(1, sides);
}
public UUID getUUID()
{
return uuid;
}
}