Merge remote-tracking branch 'origin/development2' into development2
This commit is contained in:
@@ -87,7 +87,7 @@ public Game() {
|
|||||||
gameStatistics = new Statistic();
|
gameStatistics = new Statistic();
|
||||||
initializeDrawPile();
|
initializeDrawPile();
|
||||||
board = new Board();
|
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;
|
package pp.mdga.server.automaton.game.turn.powercard;
|
||||||
|
|
||||||
|
import pp.mdga.game.BonusCard;
|
||||||
import pp.mdga.game.card.HiddenCard;
|
import pp.mdga.game.card.HiddenCard;
|
||||||
|
import pp.mdga.game.card.PowerCard;
|
||||||
import pp.mdga.game.card.ShieldCard;
|
import pp.mdga.game.card.ShieldCard;
|
||||||
import pp.mdga.game.card.SwapCard;
|
import pp.mdga.game.card.SwapCard;
|
||||||
import pp.mdga.game.card.TurboCard;
|
import pp.mdga.game.card.TurboCard;
|
||||||
@@ -12,6 +14,8 @@
|
|||||||
import pp.mdga.server.automaton.game.turn.PowerCardState;
|
import pp.mdga.server.automaton.game.turn.PowerCardState;
|
||||||
import pp.mdga.visitor.Visitor;
|
import pp.mdga.visitor.Visitor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ChoosePowerCardState extends PowerCardAutomatonState implements Visitor {
|
public class ChoosePowerCardState extends PowerCardAutomatonState implements Visitor {
|
||||||
|
|
||||||
private static final System.Logger LOGGER = System.getLogger(ChoosePowerCardState.class.getName());
|
private static final System.Logger LOGGER = System.getLogger(ChoosePowerCardState.class.getName());
|
||||||
@@ -44,7 +48,10 @@ public void exit() {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void received(SelectCardMessage msg, int from) {
|
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());
|
this.powerCardAutomaton.setSelectedCard(msg.getCard());
|
||||||
msg.getCard().accept(this);
|
msg.getCard().accept(this);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public ServerCardVisitor(ServerGameLogic logic) {
|
|||||||
public void visit(TurboCard card) {
|
public void visit(TurboCard card) {
|
||||||
for (Piece piece : this.logic.getGame().getActivePlayer().getPieces()) {
|
for (Piece piece : this.logic.getGame().getActivePlayer().getPieces()) {
|
||||||
if (piece.getState() == PieceState.ACTIVE) {
|
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);
|
this.cards.add(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -82,7 +82,7 @@ public void visit(SwapCard card) {
|
|||||||
if (!possibleOtherPieces.isEmpty() && !possibleOwnPieces.isEmpty()) {
|
if (!possibleOtherPieces.isEmpty() && !possibleOwnPieces.isEmpty()) {
|
||||||
this.swapOwnPieces.addAll(possibleOwnPieces);
|
this.swapOwnPieces.addAll(possibleOwnPieces);
|
||||||
this.swapOtherPieces.addAll(possibleOtherPieces);
|
this.swapOtherPieces.addAll(possibleOtherPieces);
|
||||||
if (!this.cards.contains(card)) {
|
if (!this.cards.stream().map(PowerCard::getCard).toList().contains(card.getCard())) {
|
||||||
this.cards.add(card);
|
this.cards.add(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -100,7 +100,7 @@ public void visit(ShieldCard card) {
|
|||||||
if (!this.shieldPieces.contains(piece)) {
|
if (!this.shieldPieces.contains(piece)) {
|
||||||
this.shieldPieces.add(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);
|
this.cards.add(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user