diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/BuildingProperty.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/BuildingProperty.java new file mode 100644 index 0000000..01cf896 --- /dev/null +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/BuildingProperty.java @@ -0,0 +1,59 @@ +package pp.monopoly.model.fields; + +import pp.monopoly.game.server.Player; + +public class BuildingProperty extends PropertyField { + + private int houses; + private boolean hotel = false; + + BuildingProperty(String name, int id, int price, int rent) { + super(name, id, price, rent); + } + + @Override + protected int calcRent() { + if(!hotel) { + return rent*houses; + } else { + return rent*6; + } + } + + public boolean buildHouse() { + if (houses < 4) { + houses++; + return true; + } + return false; + } + + public boolean buildHotel() { + if (hotel) { + return false; + } + hotel = true; + return true; + } + + public boolean removeHouse() { + if (houses == 0) { + return false; + } + houses--; + return true; + } + + public boolean removeHotel() { + if (!hotel) { + return false; + } + hotel = false; + return true; + } + + @Override + public void accept(Player player) { + player.visit(this); + } +} diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/EventField.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/EventField.java new file mode 100644 index 0000000..0035755 --- /dev/null +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/EventField.java @@ -0,0 +1,23 @@ +package pp.monopoly.model.fields; + + +import pp.monopoly.game.server.Player; +import pp.monopoly.model.card.Card; +import pp.monopoly.model.card.DeckHelper; + +public class EventField extends Field{ + + public EventField(int id) { + super("EreignissFeld", id); + } + + @Override + public void accept(Player player) { + player.visit(this); + } + + public Card drawCard() { + return DeckHelper.drawCard(); + } + +} diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/Field.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/Field.java new file mode 100644 index 0000000..841142a --- /dev/null +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/Field.java @@ -0,0 +1,19 @@ +package pp.monopoly.model.fields; + +import pp.monopoly.game.server.Player; + +abstract class Field { + protected final String name; + protected final int id; + + protected Field(String name, int id) { + this.name = name; + this.id= id; + } + + public abstract void accept(Player player); + + public int getId() { + return id; + } +} diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/FoodField.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/FoodField.java new file mode 100644 index 0000000..efa3eb4 --- /dev/null +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/FoodField.java @@ -0,0 +1,21 @@ +package pp.monopoly.model.fields; + +import pp.monopoly.game.server.Player; + +public class FoodField extends PropertyField { + + public FoodField(String name, int id) { + super(name, id, 1500,0); + } + + @Override + protected int calcRent() { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'calcRent'"); + } + + @Override + public void accept(Player player) { + player.visit(this); + } +} diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/GateField.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/GateField.java new file mode 100644 index 0000000..6e8440a --- /dev/null +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/GateField.java @@ -0,0 +1,21 @@ +package pp.monopoly.model.fields; + +import pp.monopoly.game.server.Player; + +public class GateField extends PropertyField{ + + GateField(String name, int id) { + super(name, id, 2000, 25); + } + + @Override + protected int calcRent() { + return rent; + } + + @Override + public void accept(Player player) { + player.visit(this); + } + +} diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/GoField.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/GoField.java new file mode 100644 index 0000000..09c6c58 --- /dev/null +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/GoField.java @@ -0,0 +1,15 @@ +package pp.monopoly.model.fields; + +import pp.monopoly.game.server.Player; + +public class GoField extends Field{ + + public GoField() { + super("Monatsgehalt", 0); + } + + @Override + public void accept(Player player) { + player.visit(this); + } +} diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/GulagField.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/GulagField.java new file mode 100644 index 0000000..172a1f4 --- /dev/null +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/GulagField.java @@ -0,0 +1,18 @@ +package pp.monopoly.model.fields; + +import pp.monopoly.game.server.Player; + +public class GulagField extends Field{ + + private int bailCost = 500; + + GulagField() { + super("Gulag", 10); + } + + @Override + public void accept(Player player) { + player.visit(this); + } + +} diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/PropertyField.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/PropertyField.java new file mode 100644 index 0000000..b8d6438 --- /dev/null +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/PropertyField.java @@ -0,0 +1,25 @@ +package pp.monopoly.model.fields; + +import pp.monopoly.game.server.Player; + +public abstract class PropertyField extends Field { + + private final int price; + protected final int rent; + private Player owner; + private boolean mortaged = false; + + protected PropertyField(String name, int id, int price, int rent) { + super(name, id); + this.price = price; + this.rent = rent; + } + + + protected abstract int calcRent(); + + public int getPrice() { + return price; + } + +} diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/TestStreckeField.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/TestStreckeField.java new file mode 100644 index 0000000..89da7dc --- /dev/null +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/TestStreckeField.java @@ -0,0 +1,24 @@ +package pp.monopoly.model.fields; + +import pp.monopoly.game.server.Player; + +public class TestStreckeField extends Field{ + private int money; + + TestStreckeField() { + super("Teststrecke", 20); + } + + @Override + public void accept(Player player) { + player.visit(this); + } + + public void addMoney(int amount) { + money += amount; + } + + public int collectMoney() { + return money = 0; + } +} diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/WacheField.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/WacheField.java new file mode 100644 index 0000000..ca0abaf --- /dev/null +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/WacheField.java @@ -0,0 +1,16 @@ +package pp.monopoly.model.fields; + +import pp.monopoly.game.server.Player; + +public class WacheField extends Field{ + + public WacheField() { + super("Wache", 30); + } + + @Override + public void accept(Player player) { + player.visit(this); + } + +}