Fix swap card issue
This commit is contained in:
		@@ -4,6 +4,8 @@
 | 
			
		||||
import pp.mdga.client.ClientState;
 | 
			
		||||
import pp.mdga.client.gamestate.TurnState;
 | 
			
		||||
import pp.mdga.game.BonusCard;
 | 
			
		||||
import pp.mdga.game.card.ShieldCard;
 | 
			
		||||
import pp.mdga.game.card.SwapCard;
 | 
			
		||||
import pp.mdga.message.client.AnimationEndMessage;
 | 
			
		||||
import pp.mdga.message.server.PlayCardMessage;
 | 
			
		||||
import pp.mdga.notification.PlayCardNotification;
 | 
			
		||||
@@ -13,6 +15,7 @@ public class PlayPowerCardState extends TurnStates {
 | 
			
		||||
    private final TurnState parent;
 | 
			
		||||
 | 
			
		||||
    private PlayCardMessage playCardMessage;
 | 
			
		||||
    private int extraAnimationCounter = 0;
 | 
			
		||||
 | 
			
		||||
    public PlayPowerCardState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
@@ -21,7 +24,12 @@ public PlayPowerCardState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
        if(playCardMessage.getCard() instanceof SwapCard) {
 | 
			
		||||
            extraAnimationCounter++;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        logic.addNotification(new PlayCardNotification(logic.getGame().getActiveColor() , playCardMessage.getCard().getCard()));
 | 
			
		||||
 | 
			
		||||
        handlePowerCard(playCardMessage);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -36,6 +44,11 @@ public void setPlayCard(PlayCardMessage playCardMessage) {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectAnimationEnd(){
 | 
			
		||||
        if(extraAnimationCounter > 0) {
 | 
			
		||||
            extraAnimationCounter--;
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        logic.send(new AnimationEndMessage());
 | 
			
		||||
        parent.setState(parent.getRollDice());
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -94,8 +94,8 @@ public Game() {
 | 
			
		||||
     * This method initializes the draw pile with the predefined number of bonus cards.
 | 
			
		||||
     */
 | 
			
		||||
    private void initializeDrawPile() {
 | 
			
		||||
//        this.addBonusCards(new TurboCard(), AMOUNT_OF_TURBO_CARDS);
 | 
			
		||||
//        this.addBonusCards(new SwapCard(), AMOUNT_OF_SWAP_CARDS);
 | 
			
		||||
        this.addBonusCards(new TurboCard(), AMOUNT_OF_TURBO_CARDS);
 | 
			
		||||
        this.addBonusCards(new SwapCard(), AMOUNT_OF_SWAP_CARDS);
 | 
			
		||||
        this.addBonusCards(new ShieldCard(), AMOUNT_OF_SHIELD_CARDS);
 | 
			
		||||
        Collections.shuffle(this.drawPile);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user