Merge remote-tracking branch 'origin/development2' into development2
This commit is contained in:
		@@ -87,7 +87,7 @@ public Game() {
 | 
			
		||||
        gameStatistics = new Statistic();
 | 
			
		||||
        initializeDrawPile();
 | 
			
		||||
        board = new Board();
 | 
			
		||||
        die = new Die(1,6,6,6,6);
 | 
			
		||||
        die = new Die(1,2,3,4,5);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user