Fix shield card issue
This commit is contained in:
@@ -13,7 +13,6 @@ public class PlayPowerCardState extends TurnStates {
|
|||||||
private final TurnState parent;
|
private final TurnState parent;
|
||||||
|
|
||||||
private PlayCardMessage playCardMessage;
|
private PlayCardMessage playCardMessage;
|
||||||
private int animationCounter = 0;
|
|
||||||
|
|
||||||
public PlayPowerCardState(ClientState parent, ClientGameLogic logic) {
|
public PlayPowerCardState(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
@@ -22,11 +21,7 @@ public PlayPowerCardState(ClientState parent, ClientGameLogic logic) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
animationCounter++;
|
|
||||||
logic.addNotification(new PlayCardNotification(logic.getGame().getActiveColor() , playCardMessage.getCard().getCard()));
|
logic.addNotification(new PlayCardNotification(logic.getGame().getActiveColor() , playCardMessage.getCard().getCard()));
|
||||||
if(!playCardMessage.getCard().getCard().equals(BonusCard.TURBO)){
|
|
||||||
animationCounter++;
|
|
||||||
}
|
|
||||||
handlePowerCard(playCardMessage);
|
handlePowerCard(playCardMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,10 +36,7 @@ public void setPlayCard(PlayCardMessage playCardMessage) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void selectAnimationEnd(){
|
public void selectAnimationEnd(){
|
||||||
animationCounter--;
|
|
||||||
if(animationCounter == 0){
|
|
||||||
logic.send(new AnimationEndMessage());
|
logic.send(new AnimationEndMessage());
|
||||||
parent.setState(parent.getRollDice());
|
parent.setState(parent.getRollDice());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,7 +112,6 @@ public void received(PossiblePieceMessage msg){
|
|||||||
if (msg.getEnemyPossiblePieces().isEmpty()){
|
if (msg.getEnemyPossiblePieces().isEmpty()){
|
||||||
parent.getShield().setPossiblePieces(msg.getOwnPossiblePieces().stream().map(piece -> logic.getGame().getPieceThroughUUID(piece.getUuid())).collect(Collectors.toCollection(ArrayList::new)));
|
parent.getShield().setPossiblePieces(msg.getOwnPossiblePieces().stream().map(piece -> logic.getGame().getPieceThroughUUID(piece.getUuid())).collect(Collectors.toCollection(ArrayList::new)));
|
||||||
parent.setState(parent.getShield());
|
parent.setState(parent.getShield());
|
||||||
logic.addNotification(new SelectableShieldNotification(msg.getOwnPossiblePieces().stream().map(Piece::getUuid).toList()));
|
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Should enter Swap State");
|
System.out.println("Should enter Swap State");
|
||||||
parent.getSwap().setPossibleOwnPieces(msg.getOwnPossiblePieces().stream().map(piece -> logic.getGame().getPieceThroughUUID(piece.getUuid())).collect(Collectors.toCollection(ArrayList::new)));
|
parent.getSwap().setPossibleOwnPieces(msg.getOwnPossiblePieces().stream().map(piece -> logic.getGame().getPieceThroughUUID(piece.getUuid())).collect(Collectors.toCollection(ArrayList::new)));
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
import pp.mdga.message.client.RequestPlayCardMessage;
|
import pp.mdga.message.client.RequestPlayCardMessage;
|
||||||
import pp.mdga.message.client.SelectedPiecesMessage;
|
import pp.mdga.message.client.SelectedPiecesMessage;
|
||||||
import pp.mdga.message.server.PlayCardMessage;
|
import pp.mdga.message.server.PlayCardMessage;
|
||||||
|
import pp.mdga.notification.SelectableShieldNotification;
|
||||||
|
|
||||||
import java.lang.System.Logger.Level;
|
import java.lang.System.Logger.Level;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -27,8 +28,7 @@ public ShieldState(ClientState parent, ClientGameLogic logic) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
logic.addNotification(null);
|
logic.addNotification(new SelectableShieldNotification(possiblePieces.stream().map(Piece::getUuid).toList()));
|
||||||
//TODO: selectable piece notification
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user