added two Pieces in RequestPlayCard in order to differentiate between own and enemy pieces
This commit is contained in:
@@ -16,17 +16,20 @@ public class RequestPlayCard extends ClientMessage {
|
|||||||
/**
|
/**
|
||||||
* The identifier of the piece.
|
* The identifier of the piece.
|
||||||
*/
|
*/
|
||||||
private final String pieceIdentifier;
|
private final String ownPieceIdentifier;
|
||||||
|
|
||||||
|
private final String enemyPieceIdentifier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new RequestPlayCard instance.
|
* Constructs a new RequestPlayCard instance.
|
||||||
*
|
*
|
||||||
* @param card the bonus card to be played
|
* @param card the bonus card to be played
|
||||||
* @param pieceIdentifier the identifier of the piece
|
* @param ownPieceIdentifier the identifier of the piece
|
||||||
*/
|
*/
|
||||||
public RequestPlayCard(BonusCard card, String pieceIdentifier) {
|
public RequestPlayCard(BonusCard card, String ownPieceIdentifier, String enemyPieceIdentifier) {
|
||||||
this.pieceIdentifier = pieceIdentifier;
|
this.ownPieceIdentifier = ownPieceIdentifier;
|
||||||
this.card = card;
|
this.card = card;
|
||||||
|
this.enemyPieceIdentifier = enemyPieceIdentifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,7 +37,23 @@ public RequestPlayCard(BonusCard card, String pieceIdentifier) {
|
|||||||
*/
|
*/
|
||||||
private RequestPlayCard() {
|
private RequestPlayCard() {
|
||||||
card = null;
|
card = null;
|
||||||
pieceIdentifier = null;
|
ownPieceIdentifier = null;
|
||||||
|
enemyPieceIdentifier = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new RequestPlayCard instance for a given bonus card.
|
||||||
|
*
|
||||||
|
* @param ownPieceIdentifier the identifier of the piece
|
||||||
|
* @param enemyPieceIdentifier the identifier of the enemy piece
|
||||||
|
* @return a new RequestPlayCard instance
|
||||||
|
*/
|
||||||
|
public static RequestPlayCard requestPlaySwap(String ownPieceIdentifier, String enemyPieceIdentifier){
|
||||||
|
return new RequestPlayCard(BonusCard.SWAP, ownPieceIdentifier, enemyPieceIdentifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static RequestPlayCard requestPlayShield(String ownPieceIdentifier){
|
||||||
|
return new RequestPlayCard(BonusCard.SHIELD, ownPieceIdentifier, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -51,8 +70,17 @@ public BonusCard getCard() {
|
|||||||
*
|
*
|
||||||
* @return the piece identifier
|
* @return the piece identifier
|
||||||
*/
|
*/
|
||||||
public String getPieceIdentifier() {
|
public String getOwnPieceIdentifier() {
|
||||||
return pieceIdentifier;
|
return ownPieceIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the enemy piece identifier associated with this request.
|
||||||
|
*
|
||||||
|
* @return the enemy piece identifier
|
||||||
|
*/
|
||||||
|
public String getEnemyPieceIdentifier() {
|
||||||
|
return enemyPieceIdentifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user