added the possiblity when the drawpile has only 1 card the discard pile will be shuffeled and then put into the draw pile.

This commit is contained in:
Fleischer Hanno
2024-12-09 19:11:45 +01:00
parent 0010717411
commit 0fce2fb5d2

View File

@@ -107,9 +107,13 @@ private void initializeDrawPile() {
*/
public PowerCard draw() {
if (!this.drawPile.isEmpty()) {
if (drawPile.size() == 1){
Collections.shuffle(this.discardPile);
this.drawPile.addAll(this.discardPile);
discardPile.clear();
}
return this.drawPile.remove(0);
}
return null;
}