This commit is contained in:
Benjamin Feyer
2024-12-09 22:22:49 +01:00
10 changed files with 52 additions and 16 deletions

View File

@@ -541,7 +541,6 @@ public void shieldPiece(UUID uuid){
* @param uuid the UUID of the piece to unshield
*/
public void unshieldPiece(UUID uuid){
pieces.get(uuid).deactivateShield();
}

View File

@@ -150,6 +150,9 @@ public void rotateInit() {
* This adds a visual shield effect in the form of a rotating ring.
*/
public void activateShield(){
if(shieldRing != null){
deactivateShield();
}
shieldRing = assetManager.loadModel(Asset.shieldRing.getModelPath());
shieldRing.scale(1f);
shieldRing.rotate((float) Math.toRadians(0), 0, (float) Math.toRadians(0));

View File

@@ -294,17 +294,14 @@ public void received(ChoosePieceStateMessage msg){
@Override
public void received(DrawCardMessage msg){
if(msg.getCard() instanceof HiddenCard){
logic.getGame().getActivePlayer().addHandCard(msg.getCard());
if (msg.getCard() instanceof HiddenCard) {
logic.addNotification(new DrawCardNotification(logic.getGame().getActiveColor(), BonusCard.HIDDEN));
} else if(msg.getCard() instanceof TurboCard) {
logic.addNotification(new AcquireCardNotification(BonusCard.TURBO));
} else if(msg.getCard() instanceof ShieldCard) {
logic.addNotification(new AcquireCardNotification(BonusCard.SHIELD));
} else if(msg.getCard() instanceof SwapCard) {
logic.addNotification(new AcquireCardNotification(BonusCard.SWAP));
} else {
throw new RuntimeException();
}
else{
logic.addNotification(new AcquireCardNotification(msg.getCard().getCard()));
}
}
/**

View File

@@ -3,8 +3,10 @@
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
import pp.mdga.client.GameState;
import pp.mdga.game.BonusCard;
import pp.mdga.game.Piece;
import pp.mdga.game.PieceState;
import pp.mdga.game.card.HiddenCard;
import pp.mdga.message.server.*;
import pp.mdga.notification.*;
@@ -33,7 +35,12 @@ public void received(CeremonyMessage msg) {
@Override
public void received(DrawCardMessage msg){
logic.addNotification(new DrawCardNotification(logic.getGame().getActiveColor(), msg.getCard().getCard()));
logic.getGame().getActivePlayer().addHandCard(msg.getCard());
if (msg.getCard() instanceof HiddenCard) {
logic.addNotification(new DrawCardNotification(logic.getGame().getActiveColor(), BonusCard.HIDDEN));
}
//stats
logic.getGame().getPlayerByColor(logic.getGame().getActiveColor()).getPlayerStatistic().increaseActivatedBonusNodes();
logic.getGame().getGameStatistics().increaseActivatedBonusNodes();
}

View File

@@ -40,6 +40,7 @@ public TurnState(ClientState parent, ClientGameLogic logic) {
@Override
public void enter() {
logic = logic;
for (Piece piece : logic.getGame().getPlayerByColor(logic.getGame().getActiveColor()).getPieces()) {
if (piece.isShielded() || piece.isSuppressed()){
piece.setShield(ShieldState.NONE);

View File

@@ -5,6 +5,7 @@
import pp.mdga.client.gamestate.turnstate.PowerCardState;
import pp.mdga.game.BonusCard;
import pp.mdga.game.Piece;
import pp.mdga.game.Player;
import pp.mdga.game.card.*;
import pp.mdga.message.client.NoPowerCardMessage;
import pp.mdga.message.client.SelectCardMessage;
@@ -73,8 +74,14 @@ public void received(PossibleCardsMessage msg){
*/
@Override
public void selectCard(BonusCard card){
Player player = logic.getGame().getPlayers().get(logic.getOwnPlayerId());
ArrayList<PowerCard> handCards = player.getHandCards();
if(card != null){
logic.send(new SelectCardMessage(logic.getGame().getPlayers().get(logic.getOwnPlayerId()).getPowerCardByType(card)));
PowerCard select = player.getPowerCardByType(card);
if(select == null){
select = select;
}
logic.send(new SelectCardMessage(select));
} else {
logic.send(new NoPowerCardMessage());
}

View File

@@ -87,7 +87,7 @@ public Game() {
gameStatistics = new Statistic();
initializeDrawPile();
board = new Board();
die = new Die(1,2,3,4,5);
die = new Die(1,4);
}
/**

View File

@@ -43,9 +43,6 @@ public Piece getOccupant() {
* @param occupant the new occupant of the node
*/
public void setOccupant(Piece occupant) {
if (occupant.isSuppressed()) {
occupant.setShield(ShieldState.NONE);
}
this.occupant = occupant;
}

View File

@@ -152,6 +152,7 @@ public PowerCard getPowerCardByType(BonusCard bonusCard) {
}
}
return null;
// throw new RuntimeException("bonusCard is not in handCards");
}
public Piece getWaitingPiece(){

View File

@@ -61,6 +61,30 @@ public void initializeGame() {
player.addHandCard(new ShieldCard());
player.addHandCard(new TurboCard());
player.addHandCard(new TurboCard());
player.addHandCard(new TurboCard());
player.addHandCard(new TurboCard());
player.addHandCard(new TurboCard());
player.addHandCard(new TurboCard());
player.addHandCard(new TurboCard());
player.addHandCard(new TurboCard());
player.addHandCard(new TurboCard());
player.addHandCard(new TurboCard());
player.addHandCard(new TurboCard());
player.addHandCard(new TurboCard());
player.addHandCard(new TurboCard());
player.addHandCard(new TurboCard());
player.addHandCard(new TurboCard());
player.addHandCard(new TurboCard());
player.addHandCard(new TurboCard());
player.addHandCard(new TurboCard());
player.addHandCard(new TurboCard());
player.addHandCard(new TurboCard());
player.addHandCard(new TurboCard());
player.addHandCard(new TurboCard());
player.addHandCard(new TurboCard());
player.addHandCard(new TurboCard());
player.addHandCard(new TurboCard());
player.addHandCard(new SwapCard());
player.addHandCard(new SwapCard());