fixed missing check on shield state after swap
This commit is contained in:
		@@ -37,15 +37,6 @@ protected void handlePowerCard(PlayCardMessage msg) {
 | 
			
		||||
        logic.getGame().getDiscardPile().add(msg.getCard());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected void throwPiece(Piece piece) {
 | 
			
		||||
        logic.getGame().getBoard().getInfield()[logic.getGame().getBoard().getInfieldIndexOfPiece(piece)].clearOccupant();
 | 
			
		||||
        logic.getGame().getPlayerByColor(piece.getColor()).addWaitingPiece(piece);
 | 
			
		||||
        logic.addNotification(new ThrowPieceNotification(piece.getUuid(), piece.getColor()));
 | 
			
		||||
        logic.getGame().getPlayerByColor(piece.getColor()).getPlayerStatistic().increasePiecesBeingThrown();
 | 
			
		||||
        logic.getGame().getGameStatistics().increasePiecesBeingThrown();
 | 
			
		||||
        piece.setState(PieceState.WAITING);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void handleShield(UUID uuid) {
 | 
			
		||||
        Board board = logic.getGame().getBoard();
 | 
			
		||||
        Piece piece = logic.getGame().getPieceThroughUUID(uuid);
 | 
			
		||||
@@ -70,6 +61,22 @@ private void swapPieces(Piece messageOwn, Piece messageEnemy) {
 | 
			
		||||
 | 
			
		||||
        ownNode.setOccupant(modelEnemy);
 | 
			
		||||
        enemyNode.setOccupant(modelOwn);
 | 
			
		||||
 | 
			
		||||
        logic.addNotification(new SwapPieceNotification(modelOwn.getUuid(), modelEnemy.getUuid()));
 | 
			
		||||
        checkShieldAfterSwap(enemyNode, modelOwn);
 | 
			
		||||
        checkShieldAfterSwap(ownNode, modelEnemy);
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void checkShieldAfterSwap(Node node, Piece piece){
 | 
			
		||||
        if (node.isStart()){
 | 
			
		||||
            if (piece.isShielded()){
 | 
			
		||||
                piece.setShield(ShieldState.SUPPRESSED);
 | 
			
		||||
                logic.addNotification(new ShieldSuppressedNotification(piece.getUuid()));
 | 
			
		||||
            }
 | 
			
		||||
        } else if (piece.isSuppressed()){
 | 
			
		||||
            piece.setShield(ShieldState.ACTIVE);
 | 
			
		||||
            logic.addNotification(new ShieldActiveNotification(piece.getUuid()));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user