fixed shield state for waiting state

This commit is contained in:
Fleischer Hanno
2024-12-09 19:43:50 +01:00
parent 0fce2fb5d2
commit e95f0866d5

View File

@@ -6,6 +6,7 @@
import pp.mdga.game.Node;
import pp.mdga.game.Piece;
import pp.mdga.game.PieceState;
import pp.mdga.game.ShieldState;
import pp.mdga.message.server.*;
import pp.mdga.notification.*;
@@ -34,12 +35,6 @@ public void received(CeremonyMessage msg) {
logic.setState(logic.getCeremony());
}
@Override
public void received(DiceNowMessage msg) {
logic.addNotification(new DiceNowNotification());
parent.setState(parent.getTurn());
}
@Override
public void received(DieMessage msg) {
logic.getGame().setDiceEyes(msg.getDiceEye());
@@ -72,6 +67,13 @@ public void received(ActivePlayerMessage msg) {
logic.getGame().setActiveColor(msg.getColor());
if(msg.getColor() == logic.getGame().getPlayers().get(logic.getOwnPlayerId()).getColor()) {
parent.setState(parent.getTurn());
} else {
for (Piece piece : logic.getGame().getActivePlayer().getPieces()){
if (piece.isShielded() || piece.isSuppressed()){
logic.addNotification(new RemoveShieldNotification(piece.getUuid()));
piece.setShield(ShieldState.NONE);
}
}
}
}
@@ -139,6 +141,15 @@ public void received(MoveMessage msg) {
}
//set new node
logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].setOccupant(piece);
if (logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].isStart()){
if (piece.isShielded()){
piece.setShield(ShieldState.SUPPRESSED);
logic.addNotification(new ShieldSuppressedNotification(piece.getUuid()));
}
} else if (piece.isSuppressed()){
piece.setShield(ShieldState.ACTIVE);
logic.addNotification(new ShieldActiveNotification(piece.getUuid()));
}
}
System.out.println("send AnimationEndMessage");
logic.getGame().setTurboFlag(false);