Add DrawCardMessage logic

This commit is contained in:
Felix Koppe
2024-12-09 02:40:45 +01:00
parent 3f93d6e569
commit 1c87b566e9

View File

@@ -11,7 +11,13 @@
import pp.mdga.client.gamestate.turnstate.TurnStates;
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.server.*;
import pp.mdga.notification.AcquireCardNotification;
import pp.mdga.notification.DrawCardNotification;
public class TurnState extends GameStates {
@@ -145,7 +151,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();
}
}
public ChoosePieceState getChoosePiece() {