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