working on turbo not

This commit is contained in:
Cedric Beck
2024-12-09 03:23:02 +01:00
parent 3ae9028b82
commit 5bccee96a2
3 changed files with 22 additions and 4 deletions

View File

@@ -42,7 +42,16 @@ public void received(DiceNowMessage msg) {
@Override @Override
public void received(DieMessage msg) { public void received(DieMessage msg) {
logic.getGame().setDiceEyes(msg.getDiceEye()); logic.getGame().setDiceEyes(msg.getDiceEye());
logic.addNotification(new RollDiceNotification(logic.getGame().getActiveColor(), logic.getGame().getDiceEyes())); if(logic.getGame()){
logic.addNotification(new RollDiceNotification(logic.getGame().getPlayerById(logic.getOwnPlayerId()).getColor(), msg.getDiceEye()));
}
else {
logic.addNotification(new RollDiceNotification(logic.getGame().getPlayerById(logic.getOwnPlayerId()).getColor(), msg.getDiceEye(), logic.getGame().getDiceModifier()));
}
// logic.addNotification(new RollDiceNotification(logic.getGame().getActiveColor(), logic.getGame().getDiceEyes()));
//stats
if (msg.getDiceEye() == 6) { if (msg.getDiceEye() == 6) {
logic.getGame().getPlayerByColor(logic.getGame().getActiveColor()).getPlayerStatistic().increaseDiced6(); logic.getGame().getPlayerByColor(logic.getGame().getActiveColor()).getPlayerStatistic().increaseDiced6();
logic.getGame().getGameStatistics().increaseDiced6(); logic.getGame().getGameStatistics().increaseDiced6();

View File

@@ -43,7 +43,13 @@ public void selectDice(){
@Override @Override
public void received(DieMessage msg){ public void received(DieMessage msg){
logic.getGame().setDiceEyes(msg.getDiceEye()); logic.getGame().setDiceEyes(msg.getDiceEye());
logic.addNotification(new RollDiceNotification(logic.getGame().getPlayerById(logic.getOwnPlayerId()).getColor(), msg.getDiceEye(),false));
if(logic.getGame()){
logic.addNotification(new RollDiceNotification(logic.getGame().getPlayerById(logic.getOwnPlayerId()).getColor(), msg.getDiceEye()));
}
else {
logic.addNotification(new RollDiceNotification(logic.getGame().getPlayerById(logic.getOwnPlayerId()).getColor(), msg.getDiceEye(), logic.getGame().getDiceModifier()));
}
} }
@Override @Override

View File

@@ -13,6 +13,7 @@ public class RollDiceNotification extends Notification{
private int multiplier; private int multiplier;
private boolean isRanking; private boolean isRanking;
//normal
/** /**
* Constructor. * Constructor.
* @param color the color of the player that rolled the die. * @param color the color of the player that rolled the die.
@@ -26,6 +27,7 @@ public RollDiceNotification(Color color, int eyes) {
this.isRanking = false; this.isRanking = false;
} }
//ranking
public RollDiceNotification(Color color, int eyes, boolean isRanking) { public RollDiceNotification(Color color, int eyes, boolean isRanking) {
this.color = color; this.color = color;
this.eyes = eyes; this.eyes = eyes;
@@ -34,10 +36,11 @@ public RollDiceNotification(Color color, int eyes, boolean isRanking) {
this.isRanking = isRanking; this.isRanking = isRanking;
} }
public RollDiceNotification(Color color, int eyes, boolean turbo, int multiplier) { //turbo
public RollDiceNotification(Color color, int eyes, int multiplier) {
this.color = color; this.color = color;
this.eyes = eyes; this.eyes = eyes;
this.turbo = turbo; this.turbo = true;
this.multiplier = multiplier; this.multiplier = multiplier;
this.isRanking = false; this.isRanking = false;
} }