mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-24 20:29:44 +01:00
added logic for visiting event field
This commit is contained in:
parent
a66c570b51
commit
3c4eac1fcd
@ -13,7 +13,7 @@ import java.util.Random;
|
|||||||
import pp.monopoly.message.server.DiceResult;
|
import pp.monopoly.message.server.DiceResult;
|
||||||
import pp.monopoly.model.FieldVisitor;
|
import pp.monopoly.model.FieldVisitor;
|
||||||
import pp.monopoly.model.Figure;
|
import pp.monopoly.model.Figure;
|
||||||
import pp.monopoly.model.IntPoint;
|
import pp.monopoly.model.card.Card;
|
||||||
import pp.monopoly.model.card.DeckHelper;
|
import pp.monopoly.model.card.DeckHelper;
|
||||||
import pp.monopoly.model.fields.BuildingProperty;
|
import pp.monopoly.model.fields.BuildingProperty;
|
||||||
import pp.monopoly.model.fields.EventField;
|
import pp.monopoly.model.fields.EventField;
|
||||||
@ -89,6 +89,14 @@ public class Player implements FieldVisitor<Void>{
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retuns the Playerhandler
|
||||||
|
* @return the Playerhandler
|
||||||
|
*/
|
||||||
|
public PlayerHandler getHandler() {
|
||||||
|
return handler;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns this players id
|
* Returns this players id
|
||||||
* @return th eid of this player
|
* @return th eid of this player
|
||||||
@ -284,7 +292,8 @@ public class Player implements FieldVisitor<Void>{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Void visit(EventField field) {
|
public Void visit(EventField field) {
|
||||||
DeckHelper.drawCard();
|
Card c = getHandler().getLogic().getDeckHelper().drawCard();
|
||||||
|
getHandler().getLogic().getDeckHelper().visit(c, this);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,6 +336,26 @@ public class Player implements FieldVisitor<Void>{
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getNumHouses() {
|
||||||
|
int total = 0;
|
||||||
|
for (PropertyField field : properties) {
|
||||||
|
if (field.getClass() == BuildingProperty.class) {
|
||||||
|
total += ((BuildingProperty) field).getHouses();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNumHotels() {
|
||||||
|
int total = 0;
|
||||||
|
for (PropertyField field : properties) {
|
||||||
|
if (field.getClass() == BuildingProperty.class) {
|
||||||
|
total += ((BuildingProperty) field).getHotel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inner class for dice functionality in the game.
|
* Inner class for dice functionality in the game.
|
||||||
* Rolls random dice values.
|
* Rolls random dice values.
|
||||||
|
@ -17,6 +17,7 @@ public class PlayerHandler {
|
|||||||
private Set<Player> readyPlayers = new HashSet<>();
|
private Set<Player> readyPlayers = new HashSet<>();
|
||||||
private ServerGameLogic logic;
|
private ServerGameLogic logic;
|
||||||
private Player hostPlayer;
|
private Player hostPlayer;
|
||||||
|
private Player extra = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contructs a PlayerHandler
|
* Contructs a PlayerHandler
|
||||||
@ -131,8 +132,13 @@ public class PlayerHandler {
|
|||||||
* Completes a player turn and return the next player
|
* Completes a player turn and return the next player
|
||||||
* @return the next players who is active
|
* @return the next players who is active
|
||||||
*/
|
*/
|
||||||
Player nextPlayer() {
|
public Player nextPlayer() {
|
||||||
Player tmp = players.get(0);
|
Player tmp = players.get(0);
|
||||||
|
if (extra != null) {
|
||||||
|
tmp = extra;
|
||||||
|
extra = null;
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
players.remove(0);
|
players.remove(0);
|
||||||
players.add(tmp);
|
players.add(tmp);
|
||||||
return players.get(0);
|
return players.get(0);
|
||||||
@ -142,7 +148,7 @@ public class PlayerHandler {
|
|||||||
* Returns the {@link ServerGameLogic} of this PlayerHandler
|
* Returns the {@link ServerGameLogic} of this PlayerHandler
|
||||||
* @return the {@link ServerGameLogic} of this PlayerHandler
|
* @return the {@link ServerGameLogic} of this PlayerHandler
|
||||||
*/
|
*/
|
||||||
ServerGameLogic getLogic() {
|
public ServerGameLogic getLogic() {
|
||||||
return logic;
|
return logic;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,4 +176,8 @@ public class PlayerHandler {
|
|||||||
player.setAccountBalance(amount);
|
player.setAccountBalance(amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void extraTurn(Player player) {
|
||||||
|
if (players.contains(player)) extra = player;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ import pp.monopoly.message.server.ViewAssetsResponse;
|
|||||||
import pp.monopoly.model.Board;
|
import pp.monopoly.model.Board;
|
||||||
import pp.monopoly.model.Figure;
|
import pp.monopoly.model.Figure;
|
||||||
import pp.monopoly.model.Rotation;
|
import pp.monopoly.model.Rotation;
|
||||||
|
import pp.monopoly.model.card.DeckHelper;
|
||||||
import pp.monopoly.model.fields.BoardManager;
|
import pp.monopoly.model.fields.BoardManager;
|
||||||
import pp.monopoly.model.fields.PropertyField;
|
import pp.monopoly.model.fields.PropertyField;
|
||||||
|
|
||||||
@ -38,6 +39,7 @@ public class ServerGameLogic implements ClientInterpreter {
|
|||||||
private ServerState state = ServerState.LOBBY;
|
private ServerState state = ServerState.LOBBY;
|
||||||
private static final int MAX_PLAYERS = 6;
|
private static final int MAX_PLAYERS = 6;
|
||||||
private BoardManager boardManager = new BoardManager();
|
private BoardManager boardManager = new BoardManager();
|
||||||
|
private final DeckHelper deckHelper = new DeckHelper();
|
||||||
private int startMoney;
|
private int startMoney;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -283,4 +285,8 @@ public class ServerGameLogic implements ClientInterpreter {
|
|||||||
public Player getPlayerById(int id) {
|
public Player getPlayerById(int id) {
|
||||||
return playerHandler.getPlayerById(id);
|
return playerHandler.getPlayerById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DeckHelper getDeckHelper() {
|
||||||
|
return deckHelper;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
package pp.monopoly.model;
|
|
||||||
|
|
||||||
import pp.monopoly.model.card.Card;
|
|
||||||
|
|
||||||
public interface CardVisitor<T> {
|
|
||||||
T visit(Card c);
|
|
||||||
}
|
|
@ -1,5 +1,7 @@
|
|||||||
package pp.monopoly.model.card;
|
package pp.monopoly.model.card;
|
||||||
|
|
||||||
|
import pp.monopoly.game.server.Player;
|
||||||
|
|
||||||
public class Card {
|
public class Card {
|
||||||
private final String description;
|
private final String description;
|
||||||
private final String keyword;
|
private final String keyword;
|
||||||
|
@ -2,24 +2,317 @@ package pp.monopoly.model.card;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
|
|
||||||
import pp.monopoly.model.CardVisitor;
|
import pp.monopoly.game.server.Player;
|
||||||
|
import pp.monopoly.message.client.EndTurn;
|
||||||
|
|
||||||
public class DeckHelper implements CardVisitor<Void>{
|
public class DeckHelper{
|
||||||
|
|
||||||
private static Queue<Card> cards;
|
private Queue<Card> cards;
|
||||||
|
private List<Card> drawn = new ArrayList<>();
|
||||||
|
|
||||||
private DeckHelper() {
|
public DeckHelper() {
|
||||||
|
cards = new LinkedList<Card>();
|
||||||
|
cards.add(new Card("Du wurdest mit einem Dienst KFZ geblitzt. Zahle: 800€", "dienst-kfz-blitzer"));
|
||||||
|
cards.add(new Card("Die erste Spoparty steht bevor. Ziehe vor zum 23er.", "spoparty"));
|
||||||
|
cards.add(new Card("Du kommst aus dem Gulak frei.", "gulak-frei-1"));
|
||||||
|
cards.add(new Card("Du kommst aus dem Gulak frei.", "gulak-frei-2"));
|
||||||
|
cards.add(new Card("Du hast den Dienstführerschein bestanden. Ziehe vor bis Teststrecke.", "dienstfuehrerschein"));
|
||||||
|
cards.add(new Card("Malkmus läd zum Pubquiz ein. Rücke vor bis zum 20er.", "pubquiz"));
|
||||||
|
cards.add(new Card("Du warst ohne Namensschild in der Truppenküche. Rücke vor zum 10er. Gehe nicht über Monatsgehalt. Ziehe keine 2000x€ ein.", "namensschild-truppenkueche"));
|
||||||
|
cards.add(new Card("Du hast heute die Spendierhosen an und gibst eine Runde in der Unibar. Zahle jedem Spieler: 400€", "spendierhosen-unibar"));
|
||||||
|
cards.add(new Card("Du warst in der Prüfungsphase krank. Gehe 3 Felder zurück.", "pruefungsphase-krank"));
|
||||||
|
cards.add(new Card("Ziehe vor bis zum nächsten Monatsgehalt.", "naechstes-monatsgehalt"));
|
||||||
|
cards.add(new Card("Du hast ein Antreten verschlafen. Zahle: 500€", "antreten-verschlafen-1"));
|
||||||
|
cards.add(new Card("Du hast den Maibock organisiert. Du erhältst: 3000€", "maibock-organisiert"));
|
||||||
|
cards.add(new Card("Der Spieß macht eine unangekündigte Inventur. Zahle für jedes Haus: 400€ und jedes Hotel: 2800€", "inventur-haeuser-hotels"));
|
||||||
|
cards.add(new Card("Es gab keine Mozzarella Bällchen mehr für Thoma. Alle Spieler ziehen vor auf Gym.", "dienstsport-gym"));
|
||||||
|
cards.add(new Card("Auf deiner Stube wurde Schimmel gefunden. Gehe ins Gulak. Begib Dich direkt dorthin. Gehe nicht über Monatsgehalt. Ziehe nicht ein.", "schimmel-gulak"));
|
||||||
|
cards.add(new Card("Deine Stube ist nach einer Partynacht nicht mehr bewohnbar. Du ziehst ins Gulak. Begib Dich direkt dorthin. Gehe nicht über Monatsgehalt. Ziehe nicht ein.", "partynacht-gulak"));
|
||||||
|
cards.add(new Card("Das Jahresabschlussantreten steht an. Ziehe vor bis Schwimmhalle.", "jahresabschlussantreten"));
|
||||||
|
cards.add(new Card("Du wurdest beim Verkaufen von Versicherungen erwischt. Zahle: 4000€", "verkaufen-versicherungen"));
|
||||||
|
cards.add(new Card("Du musstest einen Rückstuferantrag stellen. Setze eine Runde aus.", "rueckstuferantrag"));
|
||||||
|
cards.add(new Card("Auf einer Hausfeier bist du betrunken auf der Treppe gestürzt und dabei auf einen Kameraden gefallen. Zahle: 800€ und gehe zurück zu SanZ.", "hausfeier-sturz"));
|
||||||
|
cards.add(new Card("Beförderung. Beim nächsten Monatsgehalt ziehst du ein: 3000€", "befoerderung"));
|
||||||
|
cards.add(new Card("Du entscheidest dich für eine Dienstreise nach Lourd. Zahle: 1000€ und setze eine Runde aus.", "dienstreise-lourd"));
|
||||||
|
cards.add(new Card("Du warst fleißig Blutspenden und erhältst einen Tag Sonderurlaub. Du bist nochmal an der Reihe.", "blutspenden-sonderurlaub"));
|
||||||
|
cards.add(new Card("Dir wurde auf dem Oktoberfest dein Geldbeutel geklaut. Gebe 10% deines Vermögens ab.", "geldbeutel-oktoberfest"));
|
||||||
|
cards.add(new Card("Du wirst von deinem Chef für vorbildliches Verhalten gelobt. Du erhältst: 4000€", "lob-chef"));
|
||||||
|
cards.add(new Card("Deine Bekanntschaft von letzter Nacht war eine Spo. Lasse dich testen und zahle: 200€", "spo-testen"));
|
||||||
|
cards.add(new Card("Du wurdest von Kranz geexmattet. Gehe zurück zu Prüfungsamt.", "kranz-exmatrikulation"));
|
||||||
|
cards.add(new Card("Die letzte Party ist ein wenig eskaliert. Setze eine Runde aus.", "party-eskaliert"));
|
||||||
|
cards.add(new Card("Du wurdest zur VP gewählt und schmeißt eine Einstandsparty. Zahle: 800€", "vp-einstandsparty"));
|
||||||
|
cards.add(new Card("Du hast eine Party veranstaltet und dick Gewinn gemacht. Ziehe ein: 1500€", "party-gewinn"));
|
||||||
|
cards.add(new Card("Zur falschen Zeit am falschen Ort. Du musst einen Bergmarsch planen und setzt eine Runde aus.", "bergmarsch"));
|
||||||
|
cards.add(new Card("Dein Jodel eines Eispenis mit Unterhodenbeleuchtung geht viral. Ziehe ein: 1000€", "jodel-eispenis"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void visit(Card card, Player player) {
|
||||||
|
switch (card.getKeyword()) {
|
||||||
|
case "dienst-kfz-blitzer":
|
||||||
|
dienstKfzBlitzer(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "spoparty":
|
||||||
|
spoparty(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "gulak-frei-1":
|
||||||
|
case "gulak-frei-2":
|
||||||
|
gulakFrei(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "dienstfuehrerschein":
|
||||||
|
dienstfuehrerschein(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "pubquiz":
|
||||||
|
pubquiz(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "namensschild-truppenkueche":
|
||||||
|
namensschildTruppenkueche(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "spendierhosen-unibar":
|
||||||
|
spendierhosenUnibar(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "pruefungsphase-krank":
|
||||||
|
pruefungsphaseKrank(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "naechstes-monatsgehalt":
|
||||||
|
naechstesMonatsgehalt(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "antreten-verschlafen-1":
|
||||||
|
antretenVerschlafen(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "maibock-organisiert":
|
||||||
|
maibockOrganisiert(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "inventur-haeuser-hotels":
|
||||||
|
inventurHaeuserHotels(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "dienstsport-gym":
|
||||||
|
dienstsportGym(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "schimmel-gulak":
|
||||||
|
schimmelGulak(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "partynacht-gulak":
|
||||||
|
partynachtGulak(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "jahresabschlussantreten":
|
||||||
|
jahresabschlussantreten(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "verkaufen-versicherungen":
|
||||||
|
verkaufenVersicherungen(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "rueckstuferantrag":
|
||||||
|
rueckstuferantrag(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "hausfeier-sturz":
|
||||||
|
hausfeierSturz(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "befoerderung":
|
||||||
|
befoerderung(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "dienstreise-lourd":
|
||||||
|
dienstreiseLourd(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "blutspenden-sonderurlaub":
|
||||||
|
blutspendenSonderurlaub(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "geldbeutel-oktoberfest":
|
||||||
|
geldbeutelOktoberfest(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "lob-chef":
|
||||||
|
lobChef(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "spo-testen":
|
||||||
|
spoTesten(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "kranz-exmatrikulation":
|
||||||
|
kranzExmatrikulation(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "party-eskaliert":
|
||||||
|
partyEskaliert(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "vp-einstandsparty":
|
||||||
|
vpEinstandsparty(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "party-gewinn":
|
||||||
|
partyGewinn(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "bergmarsch":
|
||||||
|
bergmarsch(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "jodel-eispenis":
|
||||||
|
jodelEispenis(player);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void dienstKfzBlitzer(Player player) {
|
||||||
public Void visit(Card c) {
|
player.pay(800);
|
||||||
// TODO Auto-generated method stub
|
}
|
||||||
throw new UnsupportedOperationException("Unimplemented method 'visit'");
|
|
||||||
}
|
private void spoparty(Player player) {
|
||||||
|
player.movePos(14);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void gulakFrei(Player player) {
|
||||||
|
player.addJailCard();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dienstfuehrerschein(Player player) {
|
||||||
|
player.movePos(20);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void pubquiz(Player player) {
|
||||||
|
player.movePos(39);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void namensschildTruppenkueche(Player player) {
|
||||||
|
//TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
private void spendierhosenUnibar(Player player) {
|
||||||
|
for (Player p : player.getHandler().getPlayers()) {
|
||||||
|
p.earnMoney(400);
|
||||||
|
}
|
||||||
|
player.pay(player.getHandler().getPlayerCount()*400 - 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void pruefungsphaseKrank(Player player) {
|
||||||
|
player.movePos(player.getFieldID() - 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void naechstesMonatsgehalt(Player player) {
|
||||||
|
player.movePos(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void antretenVerschlafen(Player player) {
|
||||||
|
player.pay(500);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void maibockOrganisiert(Player player) {
|
||||||
|
player.earnMoney(3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void inventurHaeuserHotels(Player player) {
|
||||||
|
player.pay(player.getNumHouses() * 400 + player.getNumHotels() * 2800);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dienstsportGym(Player player) {
|
||||||
|
for (Player p : player.getHandler().getPlayers()) {
|
||||||
|
p.movePos(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void schimmelGulak(Player player) {
|
||||||
|
player.movePos(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void partynachtGulak(Player player) {
|
||||||
|
player.movePos(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void jahresabschlussantreten(Player player) {
|
||||||
|
player.movePos(17);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verkaufenVersicherungen(Player player) {
|
||||||
|
player.pay(4000);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void rueckstuferantrag(Player player) {
|
||||||
|
player.getHandler().getLogic().received(new EndTurn(), player.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void hausfeierSturz(Player player) {
|
||||||
|
player.pay(800);
|
||||||
|
player.movePos(32);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void befoerderung(Player player) {
|
||||||
|
player.earnMoney(3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dienstreiseLourd(Player player) {
|
||||||
|
player.pay(1000);
|
||||||
|
player.getHandler().getLogic().received(new EndTurn(), player.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void blutspendenSonderurlaub(Player player) {
|
||||||
|
player.getHandler().extraTurn(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void geldbeutelOktoberfest(Player player) {
|
||||||
|
player.pay(player.getAccountBalance() / 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void lobChef(Player player) {
|
||||||
|
player.earnMoney( 4000);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void spoTesten(Player player) {
|
||||||
|
player.pay( 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void kranzExmatrikulation(Player player) {
|
||||||
|
player.movePos(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void partyEskaliert(Player player) {
|
||||||
|
player.getHandler().getLogic().received(new EndTurn(), player.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void vpEinstandsparty(Player player) {
|
||||||
|
player.pay( 800);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void partyGewinn(Player player) {
|
||||||
|
player.earnMoney( 1500);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void bergmarsch(Player player) {
|
||||||
|
player.getHandler().getLogic().received(new EndTurn(), player.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void jodelEispenis(Player player) {
|
||||||
|
player.earnMoney(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void shuffle() {
|
private void shuffle() {
|
||||||
List<Card> cardList = new ArrayList<>(cards);
|
List<Card> cardList = new ArrayList<>(cards);
|
||||||
@ -28,7 +321,13 @@ public class DeckHelper implements CardVisitor<Void>{
|
|||||||
cards.addAll(cardList);
|
cards.addAll(cardList);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Card drawCard() {
|
public Card drawCard() {
|
||||||
return cards != null ? cards.poll() : null;
|
if (cards.isEmpty()) {
|
||||||
|
drawn.forEach(cards::add);
|
||||||
|
shuffle();
|
||||||
|
}
|
||||||
|
Card card = cards.poll();
|
||||||
|
drawn.add(card);
|
||||||
|
return card;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,4 +98,12 @@ public class BuildingProperty extends PropertyField {
|
|||||||
public int getHousePrice() {
|
public int getHousePrice() {
|
||||||
return housePrice;
|
return housePrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getHouses() {
|
||||||
|
return houses;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHotel() {
|
||||||
|
return hotel ? 1:0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user