added presentation die results and powercards as well as fixed a bug where when a piece was thrown with a suppressed shield it wouldnt be cleared

This commit is contained in:
Hanno Fleischer
2024-12-10 15:06:35 +01:00
parent bda1a40cdb
commit f0f4e0eb5e
7 changed files with 30 additions and 3 deletions

View File

@@ -6,6 +6,7 @@
import pp.mdga.game.BonusCard;
import pp.mdga.game.Piece;
import pp.mdga.game.PieceState;
import pp.mdga.game.ShieldState;
import pp.mdga.game.card.HiddenCard;
import pp.mdga.message.server.*;
import pp.mdga.notification.*;
@@ -86,6 +87,10 @@ public void received(MoveMessage msg) {
if (occ != null) {
//TODO: MoveThrowNotification
logic.addNotification(new ThrowPieceNotification(occ.getUuid(), piece.getColor()));
if (occ.isSuppressed()){
logic.addNotification(new RemoveShieldNotification(occ.getUuid()));
occ.setShield(ShieldState.NONE);
}
//set occ to waiting
logic.getGame().getPlayerByColor(occ.getColor()).addWaitingPiece(occ);
}

View File

@@ -127,6 +127,10 @@ public void received(MoveMessage msg) {
if (occ != null) {
//TODO: MoveThrowNotification
logic.addNotification(new ThrowPieceNotification(occ.getUuid(), piece.getColor()));
if (occ.isSuppressed()){
logic.addNotification(new RemoveShieldNotification(occ.getUuid()));
occ.setShield(ShieldState.NONE);
}
//set occ to waiting
logic.getGame().getPlayerByColor(occ.getColor()).addWaitingPiece(occ);
}

View File

@@ -11,6 +11,7 @@
import pp.mdga.message.server.MoveMessage;
import pp.mdga.notification.HomeMoveNotification;
import pp.mdga.notification.MovePieceNotification;
import pp.mdga.notification.RemoveShieldNotification;
import pp.mdga.notification.ShieldActiveNotification;
import pp.mdga.notification.ShieldSuppressedNotification;
import pp.mdga.notification.ThrowPieceNotification;
@@ -92,6 +93,10 @@ public void received(MoveMessage msg) {
if (occ != null) {
//TODO: MoveThrowNotification
logic.addNotification(new ThrowPieceNotification(occ.getUuid(), piece.getColor()));
if (occ.isSuppressed()){
logic.addNotification(new RemoveShieldNotification(occ.getUuid()));
occ.setShield(ShieldState.NONE);
}
//set occ to waiting
logic.getGame().getPlayerByColor(occ.getColor()).addWaitingPiece(occ);
}

View File

@@ -64,6 +64,10 @@ public void received(MoveMessage msg){
Piece occ = targetNode.getOccupant();
if (occ != null){
logic.getGame().getPlayerByColor(occ.getColor()).addWaitingPiece(occ);
if (occ.isSuppressed()){
logic.addNotification(new RemoveShieldNotification(occ.getUuid()));
occ.setShield(ShieldState.NONE);
}
logic.addNotification(new ThrowPieceNotification(occ.getUuid(), piece.getColor()));
}

View File

@@ -5,10 +5,12 @@
import pp.mdga.client.gamestate.turnstate.ChoosePieceState;
import pp.mdga.game.Piece;
import pp.mdga.game.PieceState;
import pp.mdga.game.ShieldState;
import pp.mdga.message.client.RequestMoveMessage;
import pp.mdga.message.client.SelectedPiecesMessage;
import pp.mdga.message.server.MoveMessage;
import pp.mdga.notification.MovePieceNotification;
import pp.mdga.notification.RemoveShieldNotification;
import pp.mdga.notification.ThrowPieceNotification;
import java.util.ArrayList;
@@ -44,6 +46,10 @@ public void received(MoveMessage msg){
Piece occ = logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].getOccupant();
if (occ != null){
logic.getGame().getPlayerByColor(occ.getColor()).addWaitingPiece(occ);
if (occ.isSuppressed()){
logic.addNotification(new RemoveShieldNotification(occ.getUuid()));
occ.setShield(ShieldState.NONE);
}
logic.addNotification(new ThrowPieceNotification(occ.getUuid(), msg.getPiece().getColor()));
}

View File

@@ -87,9 +87,7 @@ public Game() {
gameStatistics = new Statistic();
initializeDrawPile();
board = new Board();
die = new Die(
//TODO
);
die = new Die(1,2,4,4,1,5,5,5,4,6,1,5,6,4,3,4,6,4,1,1,2,5,1,6,5,6,1,4,2,5,1,3,2,2,4,6,6,5);
}
/**

View File

@@ -56,6 +56,11 @@ public void initializeGame() {
for (var player : this.logic.getGame().getPlayers().values()) {
player.initialize();
player.addHandCard(this.logic.getGame().draw());
//TODO
player.addHandCard(new TurboCard());
player.addHandCard(new ShieldCard());
player.addHandCard(new SwapCard());
Piece piece = player.getPieces()[0];
player.getWaitingArea()[0] = null;