fixed Turbo card with zero modifier

This commit is contained in:
Fleischer Hanno
2024-12-09 16:54:26 +01:00
parent e699f4556e
commit a56f68efdc
7 changed files with 17 additions and 21 deletions

View File

@@ -1,9 +1,9 @@
<component name="ProjectRunConfigurationManager">
<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="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="WORKING_DIRECTORY" value="$MODULE_WORKING_DIR$" />
<extension name="coverage">
@@ -16,4 +16,4 @@
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
</component>

View File

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

View File

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

View File

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

View File

@@ -28,16 +28,14 @@ private void initialize(){
Player activePlayer = logic.getGame().getPlayerByColor(logic.getGame().getActiveColor());
if(logic.getGame().getDiceModifier() == 0){
if (logic.getGame().getDiceEyes() == 6) {
if (activePlayer.hasPieceInWaitingArea()){
if (!logic.getGame().getBoard().getInfield()[activePlayer.getStartNodeIndex()].isOccupied(activePlayer.getColor())){
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getWaitingPieceState());
} else {
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getNoTurnState());
if (activePlayer.hasPieceInWaitingArea()) {
if (!logic.getGame().getBoard().getInfield()[activePlayer.getStartNodeIndex()].isOccupied(activePlayer.getColor())) {
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getWaitingPieceState());
return;
}
} else {
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getNoTurnState());
}
}
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getNoTurnState());
} else if (activePlayer.hasPieceInWaitingArea()) {
if (!logic.getGame().getBoard().getInfield()[activePlayer.getStartNodeIndex()].isOccupied(activePlayer.getColor())){
if (logic.getGame().getDiceEyes() == 6) {

View File

@@ -29,6 +29,7 @@ private void setActivePlayer(Color color) {
} else {
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
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 (!this.cards.contains(card)) {
this.cards.add(card);
@@ -58,7 +58,7 @@ public void visit(TurboCard card) {
@Override
public void visit(SwapCard card) {
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 (!possibleOwnPieces.contains(piece)) {
possibleOwnPieces.add(piece);
@@ -68,7 +68,7 @@ public void visit(SwapCard card) {
List<Piece> possibleOtherPieces = new ArrayList<>();
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()) {
if (piece.getState() == PieceState.ACTIVE) {
if (!possibleOtherPieces.contains(piece)) {
@@ -82,7 +82,9 @@ public void visit(SwapCard card) {
if (!possibleOtherPieces.isEmpty() && !possibleOwnPieces.isEmpty()) {
this.swapOwnPieces.addAll(possibleOwnPieces);
this.swapOtherPieces.addAll(possibleOtherPieces);
this.cards.add(card);
if (!this.cards.contains(card)) {
this.cards.add(card);
}
}
}