diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/Player.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/Player.java index 35be5cd..9426dd2 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/Player.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/Player.java @@ -50,6 +50,14 @@ public class Player implements FieldVisitor{ this.id = id; } + public void setName(String name) { + this.name = name; + } + + public void setColor(ColorRGBA color) { + this.color = color; + } + public int getId() { return id; } @@ -87,7 +95,7 @@ public class Player implements FieldVisitor{ return accountBalance; } - public void payRent(int amount) { + public void pay(int amount) { accountBalance -= amount; } @@ -119,7 +127,7 @@ public class Player implements FieldVisitor{ int rent = field.calcRent(); field.getOwner().earnMoney(rent); - payRent(rent); + pay(rent); return null; } @@ -130,7 +138,7 @@ public class Player implements FieldVisitor{ factor = 10; } field.getOwner().earnMoney(rollResult*factor); - payRent(rollResult*factor); + pay(rollResult*factor); return null; } @@ -139,7 +147,7 @@ public class Player implements FieldVisitor{ int rent = field.calcRent() * field.getOwner().getNumProp(field); field.getOwner().earnMoney(rent); - payRent(rent); + pay(rent); return null; } @@ -171,14 +179,18 @@ public class Player implements FieldVisitor{ @Override public Void visit(GoField field) { accountBalance += 4000; - visit((GulagField)handler.getLogic().getBoardManager().getFieldAtIndex(10)); + GulagField res = (GulagField) handler.getLogic().getBoardManager().getFieldAtIndex(10); + res.accept(this); return null; } @Override public Void visit(FineField field) { - // TODO Auto-generated method stub - throw new UnsupportedOperationException("Unimplemented method 'visit'"); + int amount = field.getFine(); + pay(amount); + TestStreckeField res =(TestStreckeField) handler.getLogic().getBoardManager().getFieldAtIndex(20); + res.addMoney(amount); + return null; } public int getNumProp(PropertyField field) { diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/BoardManager.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/BoardManager.java index ab0ee3c..cf0b74d 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/BoardManager.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/BoardManager.java @@ -29,7 +29,7 @@ public class BoardManager { fields.addLast(new BuildingProperty("Gym", 1, 600, 20)); fields.addLast(new EventField("Hausfeier", 2)); fields.addLast(new BuildingProperty("Sportplatz", 3, 600, 40)); - fields.addLast(new FineField("Diszi", 4)); + fields.addLast(new FineField("Diszi", 4, 2000)); fields.addLast(new GateField("Südtor", 5)); fields.addLast(new BuildingProperty("Studium+", 6, 1000, 60)); fields.addLast(new EventField("Üvas", 7)); @@ -63,7 +63,7 @@ public class BoardManager { fields.addLast(new GateField("Osttor", 35)); fields.addLast(new EventField("Üvas", 36)); fields.addLast(new BuildingProperty("2er", 37, 3500, 350)); - fields.addLast(new FineField("EZM", 38)); + fields.addLast(new FineField("EZM", 38, 1000)); fields.addLast(new BuildingProperty("20er", 39, 4000, 500)); return fields; diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/FineField.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/FineField.java index 2ec3a8d..8429394 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/FineField.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/FineField.java @@ -4,8 +4,15 @@ import pp.monopoly.game.server.Player; public class FineField extends Field{ - FineField(String name, int id) { + private final int fine; + + FineField(String name, int id, int fine) { super(name, id); + this.fine = fine; + } + + public int getFine() { + return fine; } @Override