Fixes voor punten 4, 5 en 6 in de ToDo bij Known Bugs
Kleine refactorings zodat de code wat compacter wordt Joker values aangepast naar Jack om te zorgen dat er na een joker geen twee of drie van elke type opgelegd mag worden Messages aangemaakt
This commit is contained in:
@@ -44,8 +44,9 @@ public class CardHandler {
|
||||
}
|
||||
|
||||
private void handleJack(TurnTable turnTable) {
|
||||
Referee.setAllowedCards(turnTable.getCurrentPlayer().getTypeChoice());
|
||||
System.out.printf("%s chose %s\n", turnTable.getCurrentPlayer().getName(), turnTable.getCurrentPlayer().getTypeChoice());
|
||||
TYPENUM typeChoice = turnTable.getCurrentPlayer().getTypeChoice();
|
||||
Referee.setAllowedType(typeChoice);
|
||||
System.out.printf("%s chose %s\n", turnTable.getCurrentPlayer().getName(), typeChoice);
|
||||
turnTable.nextPlayer();
|
||||
}
|
||||
|
||||
@@ -60,11 +61,13 @@ public class CardHandler {
|
||||
}
|
||||
|
||||
private void handleJoker(TurnTable turnTable) {
|
||||
int punishment = 5;
|
||||
Player nextPlayer = turnTable.getNextPlayer();
|
||||
drawCards(nextPlayer, 5);
|
||||
drawCards(nextPlayer, punishment);
|
||||
System.out.printf("%s was forced to draw 5 cards\n", nextPlayer.getName());
|
||||
Referee.setAllowedCards(nextPlayer.getTypeChoice());
|
||||
System.out.printf("%s chose %s\n", nextPlayer.getName(), nextPlayer.getTypeChoice());
|
||||
TYPENUM typeChoice = nextPlayer.getTypeChoice();
|
||||
Referee.setAllowedType(typeChoice);
|
||||
System.out.printf("%s chose %s\n", nextPlayer.getName(), typeChoice);
|
||||
turnTable.skipNextPlayer();
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class Game {
|
||||
if(playedCard != null){
|
||||
playCard(playedCard);
|
||||
}
|
||||
System.out.println(deck.getDeck().size() + " cards left in deck");
|
||||
System.out.printf("%s cards left in deck%n", deck.getDeck().size());
|
||||
} else {
|
||||
if( Referee.isAmazedByAmazingQuartet || Referee.isValidEndCard(currentCard, playedCard)) {
|
||||
playCard(playedCard);
|
||||
@@ -54,7 +54,8 @@ public class Game {
|
||||
} else {
|
||||
System.out.println("You can't end the game with that card!");
|
||||
System.out.println("Take five cards as punishment!");
|
||||
for (int i = 0; i < 5; i++) {
|
||||
int punishment = 5;
|
||||
for (int i = 0; i < punishment; i++) {
|
||||
player.addCardToHand(dealer.drawCard());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,10 @@ public class Messages {
|
||||
|
||||
public static final String WELCOME = "Welcome to Dutch Mau Mau!";
|
||||
public static final String ASK_FOR_PLAYER_NAME = "What shall be thy name?";
|
||||
public static final String BAD_PLAYER_NAME = "What a pathetic response, thy shall be knoweth as Koet";
|
||||
public static final String BAD_PLAYER_NAME = "What a preposterous reciprocation, thy shall be knoweth as %s%n";
|
||||
public static final String PLAYER_NAME = "Thy shall be knoweth as %s%n";
|
||||
public static final String PLAYER_PLAYED_CARD = KEY_PLAYER_NAME + " played " + KEY_CARD;
|
||||
public static final String PLAYER_DRAW_CARDS = KEY_PLAYER_NAME + " drew " + KEY_NUMBER_OF_CARDS + " cards";
|
||||
public static final String PLAYER_HAS_X_CARDS = KEY_PLAYER_NAME + " now has " + KEY_NUMBER_OF_CARDS + " cards";
|
||||
|
||||
}
|
||||
|
||||
@@ -30,9 +30,9 @@ public class Bot extends Player {
|
||||
} else if (!Referee.isValidMove(card, currentCard)) {
|
||||
continue;
|
||||
}
|
||||
System.out.println(getName() + " played " + card);
|
||||
System.out.printf("%n%s played %s%n", getName(), card);
|
||||
hand.remove(card);
|
||||
System.out.println(getName() + " now has " + getHandSize() + " cards");
|
||||
System.out.printf("%s now has %s cards%n", getName(), getHandSize());
|
||||
return card;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -102,7 +102,9 @@ public class Human extends Player {
|
||||
String input = scanner.nextLine();
|
||||
if (input.equals("")) {
|
||||
input = "Koet";
|
||||
System.out.println(Messages.BAD_PLAYER_NAME);
|
||||
System.out.printf(Messages.BAD_PLAYER_NAME, input);
|
||||
} else {
|
||||
System.out.printf(Messages.PLAYER_NAME, input);
|
||||
}
|
||||
scanner.nextLine();
|
||||
return input;
|
||||
|
||||
@@ -11,12 +11,15 @@
|
||||
6. Redesign terminal interface
|
||||
* ~~Kaarten laten zien als er een joker op je gedropt is~~
|
||||
* ~~Zorgen dat de hand van de speler horizontaal wordt geprint ipv verticaal~~
|
||||
7. Messages voor alles maken
|
||||
|
||||
## Known Bugs
|
||||
1. ~~Teveel kaarten in deck na het opnieuw schudden~~
|
||||
2. Dezelfde type kaart als de boer mag alsnog opgelegd worden
|
||||
3. Je kan als laatste kaart een pestkaart opleggen
|
||||
4. Wanneer je een nieuwe type mag kiezen met een boer of joker, moet je 2 keer kiezen
|
||||
4. ~~Wanneer je een nieuwe type mag kiezen met een boer of joker, moet je 2 keer kiezen~~
|
||||
5. ~~Naam moet je 2 keer bevestigen~~
|
||||
6. ~~Bij een joker kan je altijd opleggen, ook als het niet voldoet aan de zojuist gekozen type~~
|
||||
|
||||
### In een land hier ver, ver vandaan
|
||||
1. UI
|
||||
|
||||
Reference in New Issue
Block a user