added logger
This commit is contained in:
@@ -18,7 +18,6 @@ public AnimationState(ClientState parent, ClientGameLogic logic) {
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
LOGGER.log(System.Logger.Level.INFO, "Entering AnimationState");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -55,6 +55,7 @@ public void exit() {
|
||||
}
|
||||
|
||||
public void setState(DetermineStartPlayerStates state) {
|
||||
System.out.println("CLIENT STATE old: " + this.state + " new: " + state);
|
||||
if(this.state != null){
|
||||
this.state.exit();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ public SpectatorState(ClientState parent, ClientGameLogic logic) {
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -40,6 +40,7 @@ public void exit() {
|
||||
}
|
||||
|
||||
public void setState(TurnStates state){
|
||||
System.out.println("CLIENT STATE old: " + this.state + " new: " + state);
|
||||
if(this.state != null){
|
||||
this.state.exit();
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ public void exit() {
|
||||
}
|
||||
|
||||
public void setState(ChoosePieceStates state){
|
||||
System.out.println("CLIENT STATE old: " + this.currentState + " new: " + state);
|
||||
if(currentState != null){
|
||||
currentState.exit();
|
||||
}
|
||||
|
||||
@@ -40,6 +40,8 @@ public void exit() {
|
||||
}
|
||||
|
||||
public void setState(PowerCardStates state) {
|
||||
System.out.println("CLIENT STATE old: " + this.state + " new: " + state);
|
||||
|
||||
if(this.state != null){
|
||||
this.state.exit();
|
||||
}
|
||||
|
||||
@@ -57,15 +57,17 @@ public void setOccupant(Piece occupant) {
|
||||
* @return the old occupant of the node
|
||||
*/
|
||||
public Piece moveOccupant(Piece newOccupant) {
|
||||
if (occupant == null) {
|
||||
setOccupant(newOccupant);
|
||||
return null;
|
||||
} else {
|
||||
occupant.setShield(ShieldState.NONE);
|
||||
occupant.setState(PieceState.WAITING);
|
||||
setOccupant(newOccupant);
|
||||
return occupant;
|
||||
}
|
||||
throw new RuntimeException("BÖSE METHODE !!!!");
|
||||
|
||||
// if (occupant == null) {
|
||||
// setOccupant(newOccupant);
|
||||
// return null;
|
||||
// } else {
|
||||
// occupant.setShield(ShieldState.NONE);
|
||||
// occupant.setState(PieceState.WAITING);
|
||||
// setOccupant(newOccupant);
|
||||
// return occupant;
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -64,7 +64,6 @@ private void checkSelectPiece(Player activePlayer){
|
||||
} else {
|
||||
this.choosePieceAutomaton.getSelectPieceState().setMoveablePieces(moveablePieces);
|
||||
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getSelectPieceState());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package pp.mdga.server.automaton.game.turn.choosepiece;
|
||||
|
||||
import pp.mdga.game.Node;
|
||||
import pp.mdga.game.Piece;
|
||||
import pp.mdga.game.PieceState;
|
||||
import pp.mdga.game.ShieldState;
|
||||
@@ -57,26 +58,33 @@ public void enter() {
|
||||
|
||||
@Override
|
||||
public void received(RequestMoveMessage msg, int from){
|
||||
if (moveablePieces.contains(msg.getPiece())) {
|
||||
int indexOfPiece = moveablePieces.indexOf(msg.getPiece());
|
||||
logic.getGame().getBoard().getInfield()[logic.getGame().getBoard().getInfieldIndexOfPiece(moveablePieces.get(indexOfPiece))].clearOccupant();
|
||||
if (isHomeMove.get(indexOfPiece)) {
|
||||
logic.getGame().getPlayerByColor(msg.getPiece().getColor()).setPieceInHome(targetIndex.get(indexOfPiece), logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid()));
|
||||
if (logic.getGame().getPlayerByColor(msg.getPiece().getColor()).isHomeFinished(logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid()))) {
|
||||
logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid()).setState(PieceState.HOMEFINISHED);
|
||||
} else {
|
||||
logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid()).setState(PieceState.HOME);
|
||||
}
|
||||
logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid()).setShield(ShieldState.NONE);
|
||||
} else {
|
||||
Piece occ = logic.getGame().getBoard().getInfield()[targetIndex.get(indexOfPiece)].moveOccupant(moveablePieces.get(indexOfPiece));
|
||||
if (occ != null) {
|
||||
logic.getGame().getPlayerByColor(occ.getColor()).addWaitingPiece(occ);
|
||||
}
|
||||
}
|
||||
logic.getServerSender().broadcast(new MoveMessage(moveablePieces.get(indexOfPiece), isHomeMove.get(indexOfPiece), targetIndex.get(indexOfPiece)));
|
||||
this.choosePieceAutomaton.getTurnAutomaton().setCurrentState(this.choosePieceAutomaton.getTurnAutomaton().getMovePieceState());
|
||||
if(!moveablePieces.contains(msg.getPiece())){
|
||||
throw new RuntimeException("invalid Piece");
|
||||
}
|
||||
|
||||
int indexOfPiece = moveablePieces.indexOf(msg.getPiece());
|
||||
logic.getGame().getBoard().getInfield()[logic.getGame().getBoard().getInfieldIndexOfPiece(moveablePieces.get(indexOfPiece))].clearOccupant();
|
||||
if (isHomeMove.get(indexOfPiece)) {
|
||||
logic.getGame().getPlayerByColor(msg.getPiece().getColor()).setPieceInHome(targetIndex.get(indexOfPiece), logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid()));
|
||||
if (logic.getGame().getPlayerByColor(msg.getPiece().getColor()).isHomeFinished(logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid()))) {
|
||||
logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid()).setState(PieceState.HOMEFINISHED);
|
||||
} else {
|
||||
logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid()).setState(PieceState.HOME);
|
||||
}
|
||||
logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid()).setShield(ShieldState.NONE);
|
||||
} else {
|
||||
Node targetNode = logic.getGame().getBoard().getInfield()[targetIndex.get(indexOfPiece)];
|
||||
Piece occ = targetNode.getOccupant();
|
||||
// Piece occ = logic.getGame().getBoard().getInfield()[targetIndex.get(indexOfPiece)].moveOccupant(moveablePieces.get(indexOfPiece));
|
||||
if (occ != null) {
|
||||
logic.getGame().getPlayerByColor(occ.getColor()).addWaitingPiece(occ);
|
||||
}
|
||||
|
||||
targetNode.setOccupant(msg.getPiece());
|
||||
}
|
||||
logic.getServerSender().broadcast(new MoveMessage(moveablePieces.get(indexOfPiece), isHomeMove.get(indexOfPiece), targetIndex.get(indexOfPiece)));
|
||||
this.choosePieceAutomaton.getTurnAutomaton().setCurrentState(this.choosePieceAutomaton.getTurnAutomaton().getMovePieceState());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user