Merge commit
This commit is contained in:
		@@ -159,11 +159,6 @@ public void received(ChoosePieceStateMessage msg){
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(DrawCardMessage msg){
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public ChoosePieceState getChoosePiece() {
 | 
			
		||||
        return choosePieceState;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -63,7 +63,7 @@ public void received(StartPieceMessage msg){
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(NoTurnMessage msg){
 | 
			
		||||
    public void received(EndOfTurnMessage msg){
 | 
			
		||||
        currentState.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -70,7 +70,7 @@ public void received(StartPieceMessage msg){
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(NoTurnMessage msg){
 | 
			
		||||
    public void received(EndOfTurnMessage msg){
 | 
			
		||||
        logic.getGame().setTurboFlag(false);
 | 
			
		||||
        parent.getParent().getParent().setState(parent.getParent().getParent().getWaiting());
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -28,16 +28,14 @@ private void initialize(){
 | 
			
		||||
        Player activePlayer = logic.getGame().getPlayerByColor(logic.getGame().getActiveColor());
 | 
			
		||||
        if(logic.getGame().getDiceModifier() == 0){
 | 
			
		||||
            if (logic.getGame().getDiceEyes() == 6) {
 | 
			
		||||
                if (activePlayer.hasPieceInWaitingArea()){
 | 
			
		||||
                    if (!logic.getGame().getBoard().getInfield()[activePlayer.getStartNodeIndex()].isOccupied(activePlayer.getColor())){
 | 
			
		||||
                       this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getWaitingPieceState());
 | 
			
		||||
                    } else {
 | 
			
		||||
                        this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getNoTurnState());
 | 
			
		||||
                if (activePlayer.hasPieceInWaitingArea()) {
 | 
			
		||||
                    if (!logic.getGame().getBoard().getInfield()[activePlayer.getStartNodeIndex()].isOccupied(activePlayer.getColor())) {
 | 
			
		||||
                        this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getWaitingPieceState());
 | 
			
		||||
                        return;
 | 
			
		||||
                    }
 | 
			
		||||
                } else {
 | 
			
		||||
                    this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getNoTurnState());
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getNoTurnState());
 | 
			
		||||
        } else if (activePlayer.hasPieceInWaitingArea()) {
 | 
			
		||||
            if (!logic.getGame().getBoard().getInfield()[activePlayer.getStartNodeIndex()].isOccupied(activePlayer.getColor())){
 | 
			
		||||
                if (logic.getGame().getDiceEyes() == 6) {
 | 
			
		||||
 
 | 
			
		||||
@@ -29,6 +29,7 @@ private void setActivePlayer(Color color) {
 | 
			
		||||
        } else {
 | 
			
		||||
            setActivePlayer(color.next(logic.getGame()));
 | 
			
		||||
        }
 | 
			
		||||
        this.choosePieceAutomaton.getTurnAutomaton().getGameAutomaton().setCurrentState(this.choosePieceAutomaton.getTurnAutomaton().getGameAutomaton().getTurnState());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -41,7 +41,7 @@ public ServerCardVisitor(ServerGameLogic logic) {
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void visit(TurboCard card) {
 | 
			
		||||
        for (Piece piece : this.logic.getGame().getPlayerByColor(this.logic.getGame().getActiveColor()).getPieces()) {
 | 
			
		||||
        for (Piece piece : this.logic.getGame().getActivePlayer().getPieces()) {
 | 
			
		||||
            if (piece.getState() == PieceState.ACTIVE) {
 | 
			
		||||
                if (!this.cards.contains(card)) {
 | 
			
		||||
                    this.cards.add(card);
 | 
			
		||||
@@ -58,7 +58,7 @@ public void visit(TurboCard card) {
 | 
			
		||||
    @Override
 | 
			
		||||
    public void visit(SwapCard card) {
 | 
			
		||||
        List<Piece> possibleOwnPieces = new ArrayList<>();
 | 
			
		||||
        for (Piece piece : this.logic.getGame().getPlayerByColor(this.logic.getGame().getActiveColor()).getPieces()) {
 | 
			
		||||
        for (Piece piece : this.logic.getGame().getActivePlayer().getPieces()) {
 | 
			
		||||
            if (piece.getState() == PieceState.ACTIVE) {
 | 
			
		||||
                if (!possibleOwnPieces.contains(piece)) {
 | 
			
		||||
                    possibleOwnPieces.add(piece);
 | 
			
		||||
@@ -68,7 +68,7 @@ public void visit(SwapCard card) {
 | 
			
		||||
 | 
			
		||||
        List<Piece> possibleOtherPieces = new ArrayList<>();
 | 
			
		||||
        for (var player : this.logic.getGame().getPlayers().values()) {
 | 
			
		||||
            if (player != this.logic.getGame().getPlayerByColor(this.logic.getGame().getActiveColor())) {
 | 
			
		||||
            if (player != this.logic.getGame().getActivePlayer()) {
 | 
			
		||||
                for (Piece piece : player.getPieces()) {
 | 
			
		||||
                    if (piece.getState() == PieceState.ACTIVE) {
 | 
			
		||||
                        if (!possibleOtherPieces.contains(piece)) {
 | 
			
		||||
@@ -82,7 +82,9 @@ public void visit(SwapCard card) {
 | 
			
		||||
        if (!possibleOtherPieces.isEmpty() && !possibleOwnPieces.isEmpty()) {
 | 
			
		||||
            this.swapOwnPieces.addAll(possibleOwnPieces);
 | 
			
		||||
            this.swapOtherPieces.addAll(possibleOtherPieces);
 | 
			
		||||
            this.cards.add(card);
 | 
			
		||||
            if (!this.cards.contains(card)) {
 | 
			
		||||
                this.cards.add(card);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user