Merge branch 'development2' of https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-01 into development2
This commit is contained in:
@@ -3,8 +3,14 @@
|
||||
import pp.mdga.client.gamestate.*;
|
||||
import pp.mdga.game.BonusCard;
|
||||
import pp.mdga.game.Piece;
|
||||
import pp.mdga.game.card.HiddenCard;
|
||||
import pp.mdga.game.card.ShieldCard;
|
||||
import pp.mdga.game.card.SwapCard;
|
||||
import pp.mdga.game.card.TurboCard;
|
||||
import pp.mdga.message.client.LeaveGameMessage;
|
||||
import pp.mdga.message.server.*;
|
||||
import pp.mdga.notification.AcquireCardNotification;
|
||||
import pp.mdga.notification.DrawCardNotification;
|
||||
import pp.mdga.notification.InterruptNotification;
|
||||
import pp.mdga.notification.StartDialogNotification;
|
||||
|
||||
@@ -288,7 +294,17 @@ public void received(ChoosePieceStateMessage msg){
|
||||
|
||||
@Override
|
||||
public void received(DrawCardMessage msg){
|
||||
state.received(msg);
|
||||
if(msg.getCard() instanceof HiddenCard){
|
||||
logic.addNotification(new DrawCardNotification(logic.getGame().getActiveColor(), BonusCard.HIDDEN));
|
||||
} else if(msg.getCard() instanceof TurboCard) {
|
||||
logic.addNotification(new AcquireCardNotification(BonusCard.TURBO));
|
||||
} else if(msg.getCard() instanceof ShieldCard) {
|
||||
logic.addNotification(new AcquireCardNotification(BonusCard.SHIELD));
|
||||
} else if(msg.getCard() instanceof SwapCard) {
|
||||
logic.addNotification(new AcquireCardNotification(BonusCard.SWAP));
|
||||
} else {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,7 +11,15 @@
|
||||
import pp.mdga.client.gamestate.turnstate.TurnStates;
|
||||
import pp.mdga.game.BonusCard;
|
||||
import pp.mdga.game.Piece;
|
||||
import pp.mdga.game.ShieldState;
|
||||
import pp.mdga.game.card.HiddenCard;
|
||||
import pp.mdga.game.card.ShieldCard;
|
||||
import pp.mdga.game.card.SwapCard;
|
||||
import pp.mdga.game.card.TurboCard;
|
||||
import pp.mdga.message.server.*;
|
||||
import pp.mdga.notification.RemoveShieldNotification;
|
||||
import pp.mdga.notification.AcquireCardNotification;
|
||||
import pp.mdga.notification.DrawCardNotification;
|
||||
|
||||
public class TurnState extends GameStates {
|
||||
|
||||
@@ -32,6 +40,12 @@ 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()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -145,7 +159,7 @@ public void received(ChoosePieceStateMessage msg){
|
||||
|
||||
@Override
|
||||
public void received(DrawCardMessage msg){
|
||||
state.received(msg);
|
||||
|
||||
}
|
||||
|
||||
public ChoosePieceState getChoosePiece() {
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package pp.mdga.notification;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class RemoveShieldNotification extends Notification {
|
||||
private final UUID pieceUuid;
|
||||
|
||||
public RemoveShieldNotification(UUID pieceUuid) {
|
||||
this.pieceUuid = pieceUuid;
|
||||
}
|
||||
|
||||
public UUID getPieceUuid() {
|
||||
return pieceUuid;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package pp.mdga.server.automaton.game;
|
||||
|
||||
import pp.mdga.game.Piece;
|
||||
import pp.mdga.game.Player;
|
||||
import pp.mdga.game.ShieldState;
|
||||
import pp.mdga.message.client.*;
|
||||
import pp.mdga.server.ServerGameLogic;
|
||||
import pp.mdga.server.automaton.GameState;
|
||||
@@ -52,6 +54,9 @@ public TurnState(GameState gameAutomaton, ServerGameLogic logic) {
|
||||
public void enter() {
|
||||
LOGGER.log(Level.INFO, "Entered TurnState state.");
|
||||
this.player = this.logic.getGame().getPlayerById(this.logic.getGame().getActivePlayerId());
|
||||
for (Piece piece : this.player.getPieces()) {
|
||||
piece.setShield(ShieldState.NONE);
|
||||
}
|
||||
this.setCurrentState(this.powerCardState);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ public PlayPowerCardState(TurnState turnAutomaton, ServerGameLogic logic) {
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
LOGGER.log(System.Logger.Level.DEBUG, "Entered PlayPowerCardState state.");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user