Merge branch 'development2' of https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-01 into development2
This commit is contained in:
@@ -31,6 +31,7 @@ public class TurnState extends GameStates {
|
||||
private final PlayPowerCardState playPowerCardState = new PlayPowerCardState(this, logic);
|
||||
private final PowerCardState powerCardState = new PowerCardState(this, logic);
|
||||
private final RollDiceState rollDiceState = new RollDiceState(this, logic);
|
||||
private boolean canChangeTurbo = false;
|
||||
|
||||
public TurnState(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
@@ -39,13 +40,14 @@ public TurnState(ClientState parent, ClientGameLogic logic) {
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
this.setState(this.powerCardState);
|
||||
for (Piece piece : logic.getGame().getPlayerByColor(logic.getGame().getActiveColor()).getPieces()) {
|
||||
if (piece.isShielded() || piece.isSuppressed()){
|
||||
piece.setShield(ShieldState.NONE);
|
||||
logic.addNotification(new RemoveShieldNotification(piece.getUuid()));
|
||||
}
|
||||
}
|
||||
logic.getGame().setTurboFlag(false);
|
||||
this.setState(this.powerCardState);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -189,4 +191,12 @@ public GameState getParent(){
|
||||
public TurnStates getState(){
|
||||
return state;
|
||||
}
|
||||
|
||||
public boolean isCanChangeTurbo() {
|
||||
return canChangeTurbo;
|
||||
}
|
||||
|
||||
public void setCanChangeTurbo(boolean canChangeTurbo) {
|
||||
this.canChangeTurbo = canChangeTurbo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,13 @@ public RollDiceState(ClientState parent, ClientGameLogic logic) {
|
||||
@Override
|
||||
public void enter() {
|
||||
logic.addNotification(new DiceNowNotification());
|
||||
if (logic.getGame().getTurboFlag()){
|
||||
if (parent.isCanChangeTurbo()){
|
||||
logic.getGame().setTurboFlag(false);
|
||||
} else {
|
||||
parent.setCanChangeTurbo(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -89,6 +89,7 @@ public void received(PlayCardMessage msg){
|
||||
if(msg.getCard().getCard().equals(BonusCard.TURBO)){
|
||||
logic.getGame().setDiceModifier(msg.getDiceModifier());
|
||||
parent.getParent().getPlayPowerCard().setPlayCard(msg);
|
||||
logic.getGame().setTurboFlag(true);
|
||||
parent.getParent().setState(parent.getParent().getPlayPowerCard());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,8 @@ public class Game {
|
||||
*/
|
||||
private int diceEyes;
|
||||
|
||||
private boolean turboFlag = false;
|
||||
|
||||
/**
|
||||
* This constructor creates a new Game object.
|
||||
*/
|
||||
@@ -300,6 +302,14 @@ public boolean isHost() {
|
||||
return this.host != -1;
|
||||
}
|
||||
|
||||
public void setTurboFlag(boolean flag) {
|
||||
this.turboFlag = flag;
|
||||
}
|
||||
|
||||
public boolean getTurboFlag() {
|
||||
return this.turboFlag;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the players.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user