Merge commit

This commit is contained in:
Felix Koppe
2024-12-09 17:05:55 +01:00
7 changed files with 17 additions and 21 deletions

View File

@@ -1,9 +1,9 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="MdgaApp" type="Application" factoryName="Application" singleton="false" nameIsGenerated="true"> <configuration default="false" name="MdgaApp" type="Application" factoryName="Application" singleton="false" nameIsGenerated="true">
<option name="ALTERNATIVE_JRE_PATH" value="21" /> <option name="ALTERNATIVE_JRE_PATH" value="20" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" /> <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="MAIN_CLASS_NAME" value="pp.mdga.client.MdgaApp" /> <option name="MAIN_CLASS_NAME" value="pp.mdga.client.MdgaApp" />
<module name="Projekte.mdga.client.main" /> <module name="Gruppe-01.Projekte.mdga.client.main" />
<option name="VM_PARAMETERS" value="-Djava.util.logging.config.file=logging.properties -ea" /> <option name="VM_PARAMETERS" value="-Djava.util.logging.config.file=logging.properties -ea" />
<option name="WORKING_DIRECTORY" value="$MODULE_WORKING_DIR$" /> <option name="WORKING_DIRECTORY" value="$MODULE_WORKING_DIR$" />
<extension name="coverage"> <extension name="coverage">

View File

@@ -159,11 +159,6 @@ public void received(ChoosePieceStateMessage msg){
state.received(msg); state.received(msg);
} }
@Override
public void received(DrawCardMessage msg){
}
public ChoosePieceState getChoosePiece() { public ChoosePieceState getChoosePiece() {
return choosePieceState; return choosePieceState;
} }

View File

@@ -63,7 +63,7 @@ public void received(StartPieceMessage msg){
} }
@Override @Override
public void received(NoTurnMessage msg){ public void received(EndOfTurnMessage msg){
currentState.received(msg); currentState.received(msg);
} }

View File

@@ -70,7 +70,7 @@ public void received(StartPieceMessage msg){
} }
@Override @Override
public void received(NoTurnMessage msg){ public void received(EndOfTurnMessage msg){
logic.getGame().setTurboFlag(false); logic.getGame().setTurboFlag(false);
parent.getParent().getParent().setState(parent.getParent().getParent().getWaiting()); parent.getParent().getParent().setState(parent.getParent().getParent().getWaiting());
} }

View File

@@ -31,13 +31,11 @@ private void initialize(){
if (activePlayer.hasPieceInWaitingArea()) { if (activePlayer.hasPieceInWaitingArea()) {
if (!logic.getGame().getBoard().getInfield()[activePlayer.getStartNodeIndex()].isOccupied(activePlayer.getColor())) { if (!logic.getGame().getBoard().getInfield()[activePlayer.getStartNodeIndex()].isOccupied(activePlayer.getColor())) {
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getWaitingPieceState()); this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getWaitingPieceState());
} else { return;
}
}
}
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getNoTurnState()); this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getNoTurnState());
}
} else {
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) {

View File

@@ -29,6 +29,7 @@ private void setActivePlayer(Color color) {
} else { } else {
setActivePlayer(color.next(logic.getGame())); setActivePlayer(color.next(logic.getGame()));
} }
this.choosePieceAutomaton.getTurnAutomaton().getGameAutomaton().setCurrentState(this.choosePieceAutomaton.getTurnAutomaton().getGameAutomaton().getTurnState());
} }
/** /**

View File

@@ -41,7 +41,7 @@ public ServerCardVisitor(ServerGameLogic logic) {
*/ */
@Override @Override
public void visit(TurboCard card) { public void visit(TurboCard card) {
for (Piece piece : this.logic.getGame().getPlayerByColor(this.logic.getGame().getActiveColor()).getPieces()) { for (Piece piece : this.logic.getGame().getActivePlayer().getPieces()) {
if (piece.getState() == PieceState.ACTIVE) { if (piece.getState() == PieceState.ACTIVE) {
if (!this.cards.contains(card)) { if (!this.cards.contains(card)) {
this.cards.add(card); this.cards.add(card);
@@ -58,7 +58,7 @@ public void visit(TurboCard card) {
@Override @Override
public void visit(SwapCard card) { public void visit(SwapCard card) {
List<Piece> possibleOwnPieces = new ArrayList<>(); List<Piece> possibleOwnPieces = new ArrayList<>();
for (Piece piece : this.logic.getGame().getPlayerByColor(this.logic.getGame().getActiveColor()).getPieces()) { for (Piece piece : this.logic.getGame().getActivePlayer().getPieces()) {
if (piece.getState() == PieceState.ACTIVE) { if (piece.getState() == PieceState.ACTIVE) {
if (!possibleOwnPieces.contains(piece)) { if (!possibleOwnPieces.contains(piece)) {
possibleOwnPieces.add(piece); possibleOwnPieces.add(piece);
@@ -68,7 +68,7 @@ public void visit(SwapCard card) {
List<Piece> possibleOtherPieces = new ArrayList<>(); List<Piece> possibleOtherPieces = new ArrayList<>();
for (var player : this.logic.getGame().getPlayers().values()) { for (var player : this.logic.getGame().getPlayers().values()) {
if (player != this.logic.getGame().getPlayerByColor(this.logic.getGame().getActiveColor())) { if (player != this.logic.getGame().getActivePlayer()) {
for (Piece piece : player.getPieces()) { for (Piece piece : player.getPieces()) {
if (piece.getState() == PieceState.ACTIVE) { if (piece.getState() == PieceState.ACTIVE) {
if (!possibleOtherPieces.contains(piece)) { if (!possibleOtherPieces.contains(piece)) {
@@ -82,9 +82,11 @@ public void visit(SwapCard card) {
if (!possibleOtherPieces.isEmpty() && !possibleOwnPieces.isEmpty()) { if (!possibleOtherPieces.isEmpty() && !possibleOwnPieces.isEmpty()) {
this.swapOwnPieces.addAll(possibleOwnPieces); this.swapOwnPieces.addAll(possibleOwnPieces);
this.swapOtherPieces.addAll(possibleOtherPieces); this.swapOtherPieces.addAll(possibleOtherPieces);
if (!this.cards.contains(card)) {
this.cards.add(card); this.cards.add(card);
} }
} }
}
/** /**
* This method will be used to visit the given card parameter. * This method will be used to visit the given card parameter.