Merge branch 'development2' of https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-01 into development2
This commit is contained in:
@@ -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());
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user