merge the new developmentbranch into the test branch #39
@@ -68,8 +68,6 @@ public void received(MoveMessage msg) {
|
|||||||
}
|
}
|
||||||
logic.getGame().getBoard().getInfield()[infieldIndex].clearOccupant();
|
logic.getGame().getBoard().getInfield()[infieldIndex].clearOccupant();
|
||||||
logic.getGame().getPlayerByColor(piece.getColor()).setPieceInHome(msg.getTargetIndex(), piece);
|
logic.getGame().getPlayerByColor(piece.getColor()).setPieceInHome(msg.getTargetIndex(), piece);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
System.out.println("Client: SelectPieceState: receivedMoveMessage:reached else");
|
System.out.println("Client: SelectPieceState: receivedMoveMessage:reached else");
|
||||||
@@ -84,10 +82,9 @@ public void received(MoveMessage msg) {
|
|||||||
}
|
}
|
||||||
logic.getGame().getActivePlayer().getHomeNodes()[pieceHomeIndex].clearOccupant();
|
logic.getGame().getActivePlayer().getHomeNodes()[pieceHomeIndex].clearOccupant();
|
||||||
logic.getGame().getPlayerByColor(piece.getColor()).setPieceInHome(msg.getTargetIndex(), piece);
|
logic.getGame().getPlayerByColor(piece.getColor()).setPieceInHome(msg.getTargetIndex(), piece);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
int oldIndex = logic.getGame().getBoard().getInfieldIndexOfPiece(piece);
|
int oldIndex = logic.getGame().getBoard().getInfieldIndexOfPiece(piece);
|
||||||
|
|
||||||
Piece occ = logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].getOccupant();
|
Piece occ = logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].getOccupant();
|
||||||
@@ -109,7 +106,8 @@ public void received(MoveMessage msg) {
|
|||||||
piece.setShield(ShieldState.SUPPRESSED);
|
piece.setShield(ShieldState.SUPPRESSED);
|
||||||
logic.addNotification(new ShieldSuppressedNotification(piece.getUuid()));
|
logic.addNotification(new ShieldSuppressedNotification(piece.getUuid()));
|
||||||
}
|
}
|
||||||
} else if (piece.isSuppressed()){
|
}
|
||||||
|
else if (piece.isSuppressed()) {
|
||||||
piece.setShield(ShieldState.ACTIVE);
|
piece.setShield(ShieldState.ACTIVE);
|
||||||
logic.addNotification(new ShieldActiveNotification(piece.getUuid()));
|
logic.addNotification(new ShieldActiveNotification(piece.getUuid()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ protected boolean canMove(Piece piece) {
|
|||||||
int normPieceIdx = (-startIdx + pieceIdx + 40) % 40;
|
int normPieceIdx = (-startIdx + pieceIdx + 40) % 40;
|
||||||
int targetIdx = normPieceIdx + steps;
|
int targetIdx = normPieceIdx + steps;
|
||||||
|
|
||||||
|
|
||||||
//checks if the piece can move in the home
|
//checks if the piece can move in the home
|
||||||
if (piece.getState().equals(PieceState.HOME)) {
|
if (piece.getState().equals(PieceState.HOME)) {
|
||||||
if (canPieceMoveInHome(piece, steps)) {
|
if (canPieceMoveInHome(piece, steps)) {
|
||||||
|
|||||||
@@ -36,19 +36,24 @@ private void initialize(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getNoTurnState());
|
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getNoTurnState());
|
||||||
} else if (activePlayer.hasPieceInWaitingArea()) {
|
}
|
||||||
|
else if (activePlayer.hasPieceInWaitingArea()) {
|
||||||
if (!logic.getGame().getBoard().getInfield()[activePlayer.getStartNodeIndex()].isOccupied(activePlayer.getColor())) {
|
if (!logic.getGame().getBoard().getInfield()[activePlayer.getStartNodeIndex()].isOccupied(activePlayer.getColor())) {
|
||||||
if (logic.getGame().getDiceEyes() == 6) {
|
if (logic.getGame().getDiceEyes() == 6) {
|
||||||
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getWaitingPieceState());
|
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getWaitingPieceState());
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
checkSelectPiece(activePlayer);
|
checkSelectPiece(activePlayer);
|
||||||
}
|
}
|
||||||
} else if (canMove(logic.getGame().getBoard().getInfield()[activePlayer.getStartNodeIndex()].getOccupant())){
|
}
|
||||||
|
else if (canMove(logic.getGame().getBoard().getInfield()[activePlayer.getStartNodeIndex()].getOccupant())) {
|
||||||
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getStartPieceState());
|
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getStartPieceState());
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
checkSelectPiece(activePlayer);
|
checkSelectPiece(activePlayer);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
checkSelectPiece(activePlayer);
|
checkSelectPiece(activePlayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -63,7 +68,8 @@ private void checkSelectPiece(Player activePlayer){
|
|||||||
moveablePieces.removeIf(piece -> !canMove(piece));
|
moveablePieces.removeIf(piece -> !canMove(piece));
|
||||||
if (moveablePieces.isEmpty()) {
|
if (moveablePieces.isEmpty()) {
|
||||||
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getNoTurnState());
|
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getNoTurnState());
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
this.choosePieceAutomaton.getSelectPieceState().setMoveablePieces(moveablePieces);
|
this.choosePieceAutomaton.getSelectPieceState().setMoveablePieces(moveablePieces);
|
||||||
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getSelectPieceState());
|
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getSelectPieceState());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,6 @@ public void received(RequestMoveMessage msg, int from){
|
|||||||
|
|
||||||
oldNode.clearOccupant();
|
oldNode.clearOccupant();
|
||||||
targetNode.setOccupant(piece);
|
targetNode.setOccupant(piece);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int oldNoteIdx = logic.getGame().getBoard().getInfieldIndexOfPiece(piece);
|
int oldNoteIdx = logic.getGame().getBoard().getInfieldIndexOfPiece(piece);
|
||||||
@@ -103,7 +102,6 @@ public void received(RequestMoveMessage msg, int from){
|
|||||||
|
|
||||||
oldNode.clearOccupant();
|
oldNode.clearOccupant();
|
||||||
targetNode.setOccupant(piece);
|
targetNode.setOccupant(piece);
|
||||||
|
|
||||||
}
|
}
|
||||||
LOGGER.log(System.Logger.Level.INFO, "Server : SelectPieceState: PieceState:" + piece.getState());
|
LOGGER.log(System.Logger.Level.INFO, "Server : SelectPieceState: PieceState:" + piece.getState());
|
||||||
}
|
}
|
||||||
@@ -126,7 +124,6 @@ public void received(RequestMoveMessage msg, int from){
|
|||||||
|
|
||||||
oldNode.clearOccupant();
|
oldNode.clearOccupant();
|
||||||
targetNode.setOccupant(piece);
|
targetNode.setOccupant(piece);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean homeMove = isHomeMove.get(indexOfPiece);
|
boolean homeMove = isHomeMove.get(indexOfPiece);
|
||||||
@@ -143,7 +140,8 @@ public void received(RequestMoveMessage msg, int from){
|
|||||||
PowerCard cardToDraw = logic.getGame().draw();
|
PowerCard cardToDraw = logic.getGame().draw();
|
||||||
p.addHandCard(cardToDraw);
|
p.addHandCard(cardToDraw);
|
||||||
logic.getServerSender().send(logic.getGame().getPlayerIdByColor(p.getColor()), new DrawCardMessage(cardToDraw));
|
logic.getServerSender().send(logic.getGame().getPlayerIdByColor(p.getColor()), new DrawCardMessage(cardToDraw));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
logic.getServerSender().send(logic.getGame().getPlayerIdByColor(p.getColor()), new DrawCardMessage(new HiddenCard()));
|
logic.getServerSender().send(logic.getGame().getPlayerIdByColor(p.getColor()), new DrawCardMessage(new HiddenCard()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,8 @@ public void received(RequestMoveMessage msg, int from){
|
|||||||
PowerCard cardToDraw = logic.getGame().draw();
|
PowerCard cardToDraw = logic.getGame().draw();
|
||||||
p.addHandCard(cardToDraw);
|
p.addHandCard(cardToDraw);
|
||||||
logic.getServerSender().send(logic.getGame().getPlayerIdByColor(p.getColor()), new DrawCardMessage(cardToDraw));
|
logic.getServerSender().send(logic.getGame().getPlayerIdByColor(p.getColor()), new DrawCardMessage(cardToDraw));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
logic.getServerSender().send(logic.getGame().getPlayerIdByColor(p.getColor()), new DrawCardMessage(new HiddenCard()));
|
logic.getServerSender().send(logic.getGame().getPlayerIdByColor(p.getColor()), new DrawCardMessage(new HiddenCard()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user