Move receive DrawCardMessage to GameState

This commit is contained in:
Felix Koppe
2024-12-09 02:43:02 +01:00
parent f10df60ad3
commit de592cfa48
2 changed files with 13 additions and 8 deletions

View File

@@ -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,13 @@ public void received(ChoosePieceStateMessage msg){
@Override
public void received(DrawCardMessage msg){
state.received(msg);
switch (msg.getCard()) {
case HiddenCard hiddenCard -> logic.addNotification(new DrawCardNotification(logic.getGame().getActiveColor(), BonusCard.HIDDEN));
case TurboCard turboCard -> logic.addNotification(new AcquireCardNotification(BonusCard.TURBO));
case ShieldCard shieldCard -> logic.addNotification(new AcquireCardNotification(BonusCard.SHIELD));
case SwapCard swapCard -> logic.addNotification(new AcquireCardNotification(BonusCard.SWAP));
case null, default -> throw new RuntimeException();
}
}
/**

View File

@@ -151,13 +151,6 @@ public void received(ChoosePieceStateMessage msg){
@Override
public void received(DrawCardMessage msg){
switch (msg.getCard()) {
case HiddenCard hiddenCard -> logic.addNotification(new DrawCardNotification(logic.getGame().getActiveColor(), BonusCard.HIDDEN));
case TurboCard turboCard -> logic.addNotification(new AcquireCardNotification(BonusCard.TURBO));
case ShieldCard shieldCard -> logic.addNotification(new AcquireCardNotification(BonusCard.SHIELD));
case SwapCard swapCard -> logic.addNotification(new AcquireCardNotification(BonusCard.SWAP));
case null, default -> throw new RuntimeException();
}
}
public ChoosePieceState getChoosePiece() {