This commit is contained in:
Benjamin Feyer
2024-12-09 18:05:40 +01:00
7 changed files with 31 additions and 22 deletions

View File

@@ -1,19 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="MdgaApp" type="Application" factoryName="Application" singleton="false" nameIsGenerated="true">
<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="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">
<pattern>
<option name="PATTERN" value="pp.mdga.client.board.outline.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View File

@@ -66,7 +66,7 @@ public class MdgaApp extends SimpleApplication {
private ServerConnection networkConnection; private ServerConnection networkConnection;
public static final int DEBUG_MULTIPLIER = 1; public static final int DEBUG_MULTIPLIER = 0;
public MdgaApp() { public MdgaApp() {
networkConnection = new NetworkSupport(this); networkConnection = new NetworkSupport(this);

View File

@@ -160,7 +160,7 @@ private void handleGame(Notification notification) {
} else if (notification instanceof HomeMoveNotification home) { } else if (notification instanceof HomeMoveNotification home) {
boardHandler.movePieceHomeAnim(home.getPieceId(), home.getHomeIndex()); boardHandler.movePieceHomeAnim(home.getPieceId(), home.getHomeIndex());
guiHandler.hideText(); guiHandler.hideText();
app.getGameLogic().selectAnimationEnd(); waitForAnimation = true;
} else if (notification instanceof InterruptNotification notification1) { } else if (notification instanceof InterruptNotification notification1) {
gameView.enterInterrupt(notification1.getColor()); gameView.enterInterrupt(notification1.getColor());
} else if (notification instanceof MovePieceNotification n) { } else if (notification instanceof MovePieceNotification n) {

View File

@@ -442,6 +442,7 @@ private void moveHomePiece(UUID uuid, int index){
pieceControl.setRotation(getRotationMove(firstHomeNode.getLocation(), lastHomeNode.getLocation())); pieceControl.setRotation(getRotationMove(firstHomeNode.getLocation(), lastHomeNode.getLocation()));
app.getModelSynchronize().animationEnd(); app.getModelSynchronize().animationEnd();
app.getModelSynchronize().animationEnd();
} }
/** /**

View File

@@ -21,7 +21,7 @@
public class DiceControl extends AbstractControl { public class DiceControl extends AbstractControl {
private Quaternion targetRotation; private Quaternion targetRotation;
private final Vector3f angularVelocity = new Vector3f(); private final Vector3f angularVelocity = new Vector3f();
private float deceleration = 1.7f; private float deceleration = 1f;
private float timeElapsed = 0.0f; private float timeElapsed = 0.0f;
private float rollDuration = 1f; private float rollDuration = 1f;
private static final int ANGULAR_MIN = 5; private static final int ANGULAR_MIN = 5;

View File

@@ -4,12 +4,15 @@
import pp.mdga.client.ClientState; import pp.mdga.client.ClientState;
import pp.mdga.client.gamestate.turnstate.ChoosePieceState; import pp.mdga.client.gamestate.turnstate.ChoosePieceState;
import pp.mdga.game.Piece; import pp.mdga.game.Piece;
import pp.mdga.game.ShieldState;
import pp.mdga.game.PieceState; import pp.mdga.game.PieceState;
import pp.mdga.message.client.RequestMoveMessage; import pp.mdga.message.client.RequestMoveMessage;
import pp.mdga.message.client.SelectedPiecesMessage; import pp.mdga.message.client.SelectedPiecesMessage;
import pp.mdga.message.server.MoveMessage; import pp.mdga.message.server.MoveMessage;
import pp.mdga.notification.HomeMoveNotification; import pp.mdga.notification.HomeMoveNotification;
import pp.mdga.notification.MovePieceNotification; import pp.mdga.notification.MovePieceNotification;
import pp.mdga.notification.ShieldActiveNotification;
import pp.mdga.notification.ShieldSuppressedNotification;
import pp.mdga.notification.ThrowPieceNotification; import pp.mdga.notification.ThrowPieceNotification;
import java.util.ArrayList; import java.util.ArrayList;
@@ -107,6 +110,15 @@ public void received(MoveMessage msg) {
logic.getGame().getBoard().getInfield()[logic.getGame().getBoard().getInfieldIndexOfPiece(piece)].clearOccupant(); logic.getGame().getBoard().getInfield()[logic.getGame().getBoard().getInfieldIndexOfPiece(piece)].clearOccupant();
//set new node //set new node
logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].setOccupant(piece); logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].setOccupant(piece);
if (logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].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()));
}
} }
logic.getGame().setTurboFlag(false); logic.getGame().setTurboFlag(false);
parent.getParent().setState(parent.getParent().getMovePiece()); parent.getParent().setState(parent.getParent().getMovePiece());

View File

@@ -5,10 +5,14 @@
import pp.mdga.client.gamestate.turnstate.ChoosePieceState; import pp.mdga.client.gamestate.turnstate.ChoosePieceState;
import pp.mdga.game.Node; import pp.mdga.game.Node;
import pp.mdga.game.Piece; import pp.mdga.game.Piece;
import pp.mdga.game.ShieldState;
import pp.mdga.message.client.RequestMoveMessage; import pp.mdga.message.client.RequestMoveMessage;
import pp.mdga.message.client.SelectedPiecesMessage; import pp.mdga.message.client.SelectedPiecesMessage;
import pp.mdga.message.server.MoveMessage; import pp.mdga.message.server.MoveMessage;
import pp.mdga.notification.MovePieceNotification; import pp.mdga.notification.MovePieceNotification;
import pp.mdga.notification.RemoveShieldNotification;
import pp.mdga.notification.ShieldActiveNotification;
import pp.mdga.notification.ShieldSuppressedNotification;
import pp.mdga.notification.ThrowPieceNotification; import pp.mdga.notification.ThrowPieceNotification;
import java.util.ArrayList; import java.util.ArrayList;
@@ -63,6 +67,17 @@ public void received(MoveMessage msg){
logic.addNotification(new ThrowPieceNotification(occ.getUuid(), piece.getColor())); logic.addNotification(new ThrowPieceNotification(occ.getUuid(), piece.getColor()));
} }
if (targetNode.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 RemoveShieldNotification(piece.getUuid()));
logic.addNotification(new ShieldActiveNotification(piece.getUuid()));
}
targetNode.setOccupant(msg.getPiece()); targetNode.setOccupant(msg.getPiece());
logic.addNotification(new MovePieceNotification(msg.getPiece().getUuid(), oldIndex, targetIndex)); logic.addNotification(new MovePieceNotification(msg.getPiece().getUuid(), oldIndex, targetIndex));
logic.getGame().setTurboFlag(false); logic.getGame().setTurboFlag(false);