added two lists in PossiblePiece in order to differentiate between own and enemy pieces

This commit is contained in:
Hanno Fleischer
2024-11-25 15:07:43 +01:00
committed by Felix
parent dd7a27629b
commit f321608132

View File

@@ -2,6 +2,7 @@
import com.jme3.network.serializing.Serializable;
import java.sql.PseudoColumnUsage;
import java.util.ArrayList;
import java.util.List;
@@ -29,6 +30,32 @@ public PossiblePiece() {
possibleEnemyPieces = new ArrayList<>();
}
/**
* Swap the possible pieces
*
* @param possibleOwnPieces the list of possible own pieces
* @param possibleEnemyPieces the list of possible enemy pieces
* @return the swapped possible pieces
*/
public static PossiblePiece swapPossiblePieces(ArrayList<String> possibleOwnPieces, ArrayList<String> possibleEnemyPieces) {
PossiblePiece possiblePiece = new PossiblePiece();
possiblePiece.possibleOwnPieces.addAll(possibleOwnPieces);
possiblePiece.possibleEnemyPieces.addAll(possibleEnemyPieces);
return possiblePiece;
}
/**
* Get the possible pieces for the shield
*
* @param possibleOwnPieces the list of possible own pieces
* @return the possible pieces for the shield
*/
public static PossiblePiece shieldPossiblePieces(ArrayList<String> possibleOwnPieces){
PossiblePiece possiblePiece = new PossiblePiece();
possiblePiece.possibleOwnPieces.addAll(possibleOwnPieces);
return possiblePiece;
}
/**
* Add a piece to the list of possible pieces
*
@@ -50,10 +77,17 @@ public void addEnemyPossiblePiece(String piece) {
/** Getter for the list of possible pieces
* @return the list of possible pieces
*/
public List<String> getPossiblePieces() {
public List<String> getOwnPossiblePieces() {
return possibleOwnPieces;
}
/** Getter for the list of possible enemy pieces
* @return the list of possible enemy pieces
*/
public List<String> getEnemyPossiblePieces() {
return possibleEnemyPieces;
}
/**
* Accepts a visitor to process this message.
*