fixed crash get bonus
This commit is contained in:
@@ -541,7 +541,6 @@ public void shieldPiece(UUID uuid){
|
|||||||
* @param uuid the UUID of the piece to unshield
|
* @param uuid the UUID of the piece to unshield
|
||||||
*/
|
*/
|
||||||
public void unshieldPiece(UUID uuid){
|
public void unshieldPiece(UUID uuid){
|
||||||
|
|
||||||
pieces.get(uuid).deactivateShield();
|
pieces.get(uuid).deactivateShield();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -150,6 +150,9 @@ public void rotateInit() {
|
|||||||
* This adds a visual shield effect in the form of a rotating ring.
|
* This adds a visual shield effect in the form of a rotating ring.
|
||||||
*/
|
*/
|
||||||
public void activateShield(){
|
public void activateShield(){
|
||||||
|
if(shieldRing != null){
|
||||||
|
deactivateShield();
|
||||||
|
}
|
||||||
shieldRing = assetManager.loadModel(Asset.shieldRing.getModelPath());
|
shieldRing = assetManager.loadModel(Asset.shieldRing.getModelPath());
|
||||||
shieldRing.scale(1f);
|
shieldRing.scale(1f);
|
||||||
shieldRing.rotate((float) Math.toRadians(0), 0, (float) Math.toRadians(0));
|
shieldRing.rotate((float) Math.toRadians(0), 0, (float) Math.toRadians(0));
|
||||||
|
|||||||
@@ -294,17 +294,14 @@ public void received(ChoosePieceStateMessage msg){
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void received(DrawCardMessage msg){
|
public void received(DrawCardMessage msg){
|
||||||
|
logic.getGame().getActivePlayer().addHandCard(msg.getCard());
|
||||||
if (msg.getCard() instanceof HiddenCard) {
|
if (msg.getCard() instanceof HiddenCard) {
|
||||||
logic.addNotification(new DrawCardNotification(logic.getGame().getActiveColor(), BonusCard.HIDDEN));
|
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()));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,8 +3,10 @@
|
|||||||
import pp.mdga.client.ClientGameLogic;
|
import pp.mdga.client.ClientGameLogic;
|
||||||
import pp.mdga.client.ClientState;
|
import pp.mdga.client.ClientState;
|
||||||
import pp.mdga.client.GameState;
|
import pp.mdga.client.GameState;
|
||||||
|
import pp.mdga.game.BonusCard;
|
||||||
import pp.mdga.game.Piece;
|
import pp.mdga.game.Piece;
|
||||||
import pp.mdga.game.PieceState;
|
import pp.mdga.game.PieceState;
|
||||||
|
import pp.mdga.game.card.HiddenCard;
|
||||||
import pp.mdga.message.server.*;
|
import pp.mdga.message.server.*;
|
||||||
import pp.mdga.notification.*;
|
import pp.mdga.notification.*;
|
||||||
|
|
||||||
@@ -33,7 +35,12 @@ public void received(CeremonyMessage msg) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void received(DrawCardMessage msg){
|
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().getPlayerByColor(logic.getGame().getActiveColor()).getPlayerStatistic().increaseActivatedBonusNodes();
|
||||||
logic.getGame().getGameStatistics().increaseActivatedBonusNodes();
|
logic.getGame().getGameStatistics().increaseActivatedBonusNodes();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ public TurnState(ClientState parent, ClientGameLogic logic) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
|
logic = logic;
|
||||||
for (Piece piece : logic.getGame().getPlayerByColor(logic.getGame().getActiveColor()).getPieces()) {
|
for (Piece piece : logic.getGame().getPlayerByColor(logic.getGame().getActiveColor()).getPieces()) {
|
||||||
if (piece.isShielded() || piece.isSuppressed()){
|
if (piece.isShielded() || piece.isSuppressed()){
|
||||||
piece.setShield(ShieldState.NONE);
|
piece.setShield(ShieldState.NONE);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
import pp.mdga.client.gamestate.turnstate.PowerCardState;
|
import pp.mdga.client.gamestate.turnstate.PowerCardState;
|
||||||
import pp.mdga.game.BonusCard;
|
import pp.mdga.game.BonusCard;
|
||||||
import pp.mdga.game.Piece;
|
import pp.mdga.game.Piece;
|
||||||
|
import pp.mdga.game.Player;
|
||||||
import pp.mdga.game.card.*;
|
import pp.mdga.game.card.*;
|
||||||
import pp.mdga.message.client.NoPowerCardMessage;
|
import pp.mdga.message.client.NoPowerCardMessage;
|
||||||
import pp.mdga.message.client.SelectCardMessage;
|
import pp.mdga.message.client.SelectCardMessage;
|
||||||
@@ -73,8 +74,14 @@ public void received(PossibleCardsMessage msg){
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void selectCard(BonusCard card){
|
public void selectCard(BonusCard card){
|
||||||
|
Player player = logic.getGame().getPlayers().get(logic.getOwnPlayerId());
|
||||||
|
ArrayList<PowerCard> handCards = player.getHandCards();
|
||||||
if(card != null){
|
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 {
|
} else {
|
||||||
logic.send(new NoPowerCardMessage());
|
logic.send(new NoPowerCardMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public Game() {
|
|||||||
gameStatistics = new Statistic();
|
gameStatistics = new Statistic();
|
||||||
initializeDrawPile();
|
initializeDrawPile();
|
||||||
board = new Board();
|
board = new Board();
|
||||||
die = new Die(1,2,3,4,5);
|
die = new Die(1,4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -43,9 +43,6 @@ public Piece getOccupant() {
|
|||||||
* @param occupant the new occupant of the node
|
* @param occupant the new occupant of the node
|
||||||
*/
|
*/
|
||||||
public void setOccupant(Piece occupant) {
|
public void setOccupant(Piece occupant) {
|
||||||
if (occupant.isSuppressed()) {
|
|
||||||
occupant.setShield(ShieldState.NONE);
|
|
||||||
}
|
|
||||||
this.occupant = occupant;
|
this.occupant = occupant;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ public PowerCard getPowerCardByType(BonusCard bonusCard) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
// throw new RuntimeException("bonusCard is not in handCards");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Piece getWaitingPiece(){
|
public Piece getWaitingPiece(){
|
||||||
|
|||||||
@@ -61,6 +61,30 @@ public void initializeGame() {
|
|||||||
player.addHandCard(new ShieldCard());
|
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 TurboCard());
|
||||||
|
player.addHandCard(new TurboCard());
|
||||||
|
|
||||||
player.addHandCard(new SwapCard());
|
player.addHandCard(new SwapCard());
|
||||||
player.addHandCard(new SwapCard());
|
player.addHandCard(new SwapCard());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user