Merge branch 'development2' of https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-01 into development2
This commit is contained in:
		@@ -722,6 +722,8 @@ public void clearSelectable(){
 | 
			
		||||
            p.unHighlight();
 | 
			
		||||
            p.setSelectable(false);
 | 
			
		||||
            p.setHoverable(false);
 | 
			
		||||
            selectedPieceNodeMap.get(p).unSelect();
 | 
			
		||||
            selectedPieceNodeMap.get(p).unHighlight();
 | 
			
		||||
        }
 | 
			
		||||
        for(PieceControl p : selectableOwnPieces) {
 | 
			
		||||
            p.unSelect();
 | 
			
		||||
 
 | 
			
		||||
@@ -49,8 +49,6 @@ public void received(DieMessage msg) {
 | 
			
		||||
        else {
 | 
			
		||||
            logic.addNotification(new RollDiceNotification(logic.getGame().getActiveColor(), msg.getDiceEye()));
 | 
			
		||||
        }
 | 
			
		||||
//        logic.addNotification(new RollDiceNotification(logic.getGame().getActiveColor(), logic.getGame().getDiceEyes()));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        //stats
 | 
			
		||||
        if (msg.getDiceEye() == 6) {
 | 
			
		||||
@@ -77,13 +75,6 @@ public void received(ActivePlayerMessage msg) {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
//    @Override
 | 
			
		||||
//    public void received(DrawCardMessage msg){
 | 
			
		||||
//        logic.addNotification(new DrawCardNotification(logic.getGame().getActiveColor(), msg.getCard().getCard()));
 | 
			
		||||
//        logic.getGame().getPlayerByColor(logic.getGame().getActiveColor()).getPlayerStatistic().increaseActivatedBonusNodes();
 | 
			
		||||
//        logic.getGame().getGameStatistics().increaseActivatedBonusNodes();
 | 
			
		||||
//    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(MoveMessage msg) {
 | 
			
		||||
        Piece piece = logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid());
 | 
			
		||||
@@ -149,6 +140,7 @@ public void received(MoveMessage msg) {
 | 
			
		||||
            //set new node
 | 
			
		||||
            logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].setOccupant(piece);
 | 
			
		||||
        }
 | 
			
		||||
        System.out.println("send AnimationEndMessage");
 | 
			
		||||
        logic.getGame().setTurboFlag(false);
 | 
			
		||||
        parent.setState(parent.getAnimation());
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,7 @@
 | 
			
		||||
import pp.mdga.client.ClientState;
 | 
			
		||||
import pp.mdga.client.gamestate.DetermineStartPlayerState;
 | 
			
		||||
import pp.mdga.game.Player;
 | 
			
		||||
import pp.mdga.game.card.PowerCard;
 | 
			
		||||
import pp.mdga.message.client.AnimationEndMessage;
 | 
			
		||||
import pp.mdga.notification.AcquireCardNotification;
 | 
			
		||||
import pp.mdga.notification.ActivePlayerNotification;
 | 
			
		||||
@@ -48,10 +49,12 @@ public void enter() {
 | 
			
		||||
            logic.getGame().getBoard().getInfield()[entry.getValue().getStartNodeIndex()].setOccupant(entry.getValue().getPieces()[0]);
 | 
			
		||||
            entry.getValue().getWaitingArea()[0] = null;
 | 
			
		||||
            animationCounter++;
 | 
			
		||||
            if(entry.getKey() == logic.getOwnPlayerId()){
 | 
			
		||||
                logic.addNotification(new AcquireCardNotification(entry.getValue().getHandCards().get(0).getCard()));
 | 
			
		||||
            } else {
 | 
			
		||||
                logic.addNotification(new DrawCardNotification(entry.getValue().getColor(), entry.getValue().getHandCards().get(0).getCard()));
 | 
			
		||||
            for (PowerCard card : entry.getValue().getHandCards()){
 | 
			
		||||
                if(entry.getKey() == logic.getOwnPlayerId()){
 | 
			
		||||
                    logic.addNotification(new AcquireCardNotification(card.getCard()));
 | 
			
		||||
                } else {
 | 
			
		||||
                    logic.addNotification(new DrawCardNotification(entry.getValue().getColor(), card.getCard()));
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -24,12 +24,12 @@ public PlayPowerCardState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
        if(playCardMessage.getCard() instanceof SwapCard) {
 | 
			
		||||
        if(playCardMessage.getCard().getCard().equals(BonusCard.SWAP)) {
 | 
			
		||||
            extraAnimationCounter++;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        logic.addNotification(new PlayCardNotification(logic.getGame().getActiveColor() , playCardMessage.getCard().getCard()));
 | 
			
		||||
 | 
			
		||||
        logic.getGame().getActivePlayer().removeHandCard(playCardMessage.getCard());
 | 
			
		||||
        handlePowerCard(playCardMessage);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -18,17 +18,17 @@ public class Die {
 | 
			
		||||
    /**
 | 
			
		||||
     * The probability of rolling a zero eye.
 | 
			
		||||
     */
 | 
			
		||||
    public static final double ZERO_EYE = 0.2;
 | 
			
		||||
    public static final double ZERO_EYE = 0;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The probability of rolling a normal eye.
 | 
			
		||||
     */
 | 
			
		||||
    public static final double NORMAL_EYE = 0.2;
 | 
			
		||||
    public static final double NORMAL_EYE = 0;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The probability of rolling a double eye.
 | 
			
		||||
     */
 | 
			
		||||
    public static final double DOUBLE_EYE = 0.6;
 | 
			
		||||
    public static final double DOUBLE_EYE = 1;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The modifier applied to the die roll.
 | 
			
		||||
 
 | 
			
		||||
@@ -87,7 +87,7 @@ public Game() {
 | 
			
		||||
        gameStatistics = new Statistic();
 | 
			
		||||
        initializeDrawPile();
 | 
			
		||||
        board = new Board();
 | 
			
		||||
        die = new Die();
 | 
			
		||||
        die = new Die(1,2,3,4,5);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -95,8 +95,8 @@ public Game() {
 | 
			
		||||
     */
 | 
			
		||||
    private void initializeDrawPile() {
 | 
			
		||||
        this.addBonusCards(new TurboCard(), AMOUNT_OF_TURBO_CARDS);
 | 
			
		||||
        this.addBonusCards(new SwapCard(), AMOUNT_OF_SWAP_CARDS);
 | 
			
		||||
        this.addBonusCards(new ShieldCard(), AMOUNT_OF_SHIELD_CARDS);
 | 
			
		||||
//        this.addBonusCards(new SwapCard(), AMOUNT_OF_SWAP_CARDS);
 | 
			
		||||
//        this.addBonusCards(new ShieldCard(), AMOUNT_OF_SHIELD_CARDS);
 | 
			
		||||
        Collections.shuffle(this.drawPile);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,10 @@
 | 
			
		||||
import pp.mdga.game.Piece;
 | 
			
		||||
import pp.mdga.game.PieceState;
 | 
			
		||||
import pp.mdga.game.Player;
 | 
			
		||||
import pp.mdga.game.card.PowerCard;
 | 
			
		||||
import pp.mdga.game.card.ShieldCard;
 | 
			
		||||
import pp.mdga.game.card.SwapCard;
 | 
			
		||||
import pp.mdga.game.card.TurboCard;
 | 
			
		||||
import pp.mdga.message.client.*;
 | 
			
		||||
import pp.mdga.message.server.*;
 | 
			
		||||
import pp.mdga.server.ServerGameLogic;
 | 
			
		||||
@@ -52,6 +56,15 @@ public void initializeGame() {
 | 
			
		||||
        for (var player : this.logic.getGame().getPlayers().values()) {
 | 
			
		||||
            player.initialize();
 | 
			
		||||
            player.addHandCard(this.logic.getGame().draw());
 | 
			
		||||
            //TODO
 | 
			
		||||
            player.addHandCard(new ShieldCard());
 | 
			
		||||
            player.addHandCard(new ShieldCard());
 | 
			
		||||
            player.addHandCard(new TurboCard());
 | 
			
		||||
            player.addHandCard(new TurboCard());
 | 
			
		||||
            player.addHandCard(new SwapCard());
 | 
			
		||||
            player.addHandCard(new SwapCard());
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            Piece piece = player.getPieces()[0];
 | 
			
		||||
            player.getWaitingArea()[0] = null;
 | 
			
		||||
            piece.setState(PieceState.ACTIVE);
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,8 @@
 | 
			
		||||
package pp.mdga.server.automaton.game.turn.powercard;
 | 
			
		||||
 | 
			
		||||
import pp.mdga.game.BonusCard;
 | 
			
		||||
import pp.mdga.game.card.HiddenCard;
 | 
			
		||||
import pp.mdga.game.card.PowerCard;
 | 
			
		||||
import pp.mdga.game.card.ShieldCard;
 | 
			
		||||
import pp.mdga.game.card.SwapCard;
 | 
			
		||||
import pp.mdga.game.card.TurboCard;
 | 
			
		||||
@@ -12,6 +14,8 @@
 | 
			
		||||
import pp.mdga.server.automaton.game.turn.PowerCardState;
 | 
			
		||||
import pp.mdga.visitor.Visitor;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
public class ChoosePowerCardState extends PowerCardAutomatonState implements Visitor {
 | 
			
		||||
 | 
			
		||||
    private static final System.Logger LOGGER = System.getLogger(ChoosePowerCardState.class.getName());
 | 
			
		||||
@@ -44,7 +48,10 @@ public void exit() {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(SelectCardMessage msg, int from) {
 | 
			
		||||
        if (this.powerCardAutomaton.getVisitor().getCards().contains(msg.getCard())) {
 | 
			
		||||
        BonusCard receivedCard = msg.getCard().getCard();
 | 
			
		||||
        List<BonusCard> acceptedCards = powerCardAutomaton.getVisitor().getCards().stream().map(PowerCard::getCard).toList();
 | 
			
		||||
 | 
			
		||||
        if (acceptedCards.contains(receivedCard)) {
 | 
			
		||||
            this.powerCardAutomaton.setSelectedCard(msg.getCard());
 | 
			
		||||
            msg.getCard().accept(this);
 | 
			
		||||
        } else {
 | 
			
		||||
 
 | 
			
		||||
@@ -43,7 +43,7 @@ public ServerCardVisitor(ServerGameLogic logic) {
 | 
			
		||||
    public void visit(TurboCard card) {
 | 
			
		||||
        for (Piece piece : this.logic.getGame().getActivePlayer().getPieces()) {
 | 
			
		||||
            if (piece.getState() == PieceState.ACTIVE) {
 | 
			
		||||
                if (!this.cards.contains(card)) {
 | 
			
		||||
                if (!this.cards.stream().map(PowerCard::getCard).toList().contains(card.getCard())) {
 | 
			
		||||
                    this.cards.add(card);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
@@ -82,7 +82,7 @@ public void visit(SwapCard card) {
 | 
			
		||||
        if (!possibleOtherPieces.isEmpty() && !possibleOwnPieces.isEmpty()) {
 | 
			
		||||
            this.swapOwnPieces.addAll(possibleOwnPieces);
 | 
			
		||||
            this.swapOtherPieces.addAll(possibleOtherPieces);
 | 
			
		||||
            if (!this.cards.contains(card)) {
 | 
			
		||||
            if (!this.cards.stream().map(PowerCard::getCard).toList().contains(card.getCard())) {
 | 
			
		||||
                this.cards.add(card);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@@ -100,7 +100,7 @@ public void visit(ShieldCard card) {
 | 
			
		||||
                if (!this.shieldPieces.contains(piece)) {
 | 
			
		||||
                    this.shieldPieces.add(piece);
 | 
			
		||||
                }
 | 
			
		||||
                if (!this.cards.contains(card)) {
 | 
			
		||||
                if (!this.cards.stream().map(PowerCard::getCard).toList().contains(card.getCard())) {
 | 
			
		||||
                    this.cards.add(card);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -2,10 +2,10 @@ lobby.deny.join=The lobby is already full.
 | 
			
		||||
server.shutdown=The server has shut down.
 | 
			
		||||
incorrect.request.0=The selected TSK is already occupied.
 | 
			
		||||
incorrect.request.1=No TSK is available for selection.
 | 
			
		||||
incorrect.request.2=Test
 | 
			
		||||
incorrect.request.3=Test
 | 
			
		||||
incorrect.request.4=Test
 | 
			
		||||
incorrect.request.5=Test
 | 
			
		||||
incorrect.request.2=Chosen PowerCard cannot be played.
 | 
			
		||||
incorrect.request.3=Selected to many or wrong pieces.
 | 
			
		||||
incorrect.request.4=Did not select exactly 2 pieces or selected wrong pieces.
 | 
			
		||||
incorrect.request.5=Cannot start game because not everyone is ready.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@ lobby.deny.join=Die Lobby ist bereits voll.
 | 
			
		||||
server.shutdown=Der Server wurde heruntergefahren.
 | 
			
		||||
incorrect.request.0=Die ausgewählte TSK ist bereits belegt.
 | 
			
		||||
incorrect.request.1=Es gibt keine freie TSK mehr, welche ausgewählt werden kann.
 | 
			
		||||
incorrect.request.2=Test
 | 
			
		||||
incorrect.request.3=Test
 | 
			
		||||
incorrect.request.4=Test
 | 
			
		||||
incorrect.request.5=Test
 | 
			
		||||
incorrect.request.2=Die ausgewälte Powerkarte kann nicht eingesetzt werden.
 | 
			
		||||
incorrect.request.3=Du hast zuviele, oder eine falsche Figur ausgewählt.
 | 
			
		||||
incorrect.request.4=Du hast nicht genau zwei Figuren, oder falsche Figuren ausgewählt.
 | 
			
		||||
incorrect.request.5=Du kannst das Spiel nicht starten, da nicht alle Spieler bereit sind.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user