package domain;

import java.lang.Math;

public class Dice {

    private int diceNumber;
    private String savedGamemode;

    public Dice(String gamemode) {
        this.savedGamemode = gamemode;
        if (gamemode.equalsIgnoreCase("Normal"))
            this.diceNumber = ((int) (Math.random() * 6)) + 1;
        else if (gamemode.equalsIgnoreCase("Special8"))
            this.diceNumber = ((int) (Math.random() * 8)) + 1;
    }

    public Dice(String gamemode, int diceNumber) {
        this.savedGamemode = gamemode;
        this.diceNumber = diceNumber;
    }

    public void rerollDice() {

        if (this.savedGamemode.equalsIgnoreCase("Normal"))
            this.diceNumber = ((int) (Math.random() * 6)) + 1;
        else if (this.savedGamemode.equalsIgnoreCase("Special8"))
            this.diceNumber = ((int) (Math.random() * 8)) + 1;

    }

    public int getDiceNumber() {

        return this.diceNumber;

    }

}
