mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-24 20:29:44 +01:00
added fine to FineField
This commit is contained in:
parent
10b978debf
commit
627e3dbd7f
@ -50,6 +50,14 @@ public class Player implements FieldVisitor<Void>{
|
||||
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<Void>{
|
||||
return accountBalance;
|
||||
}
|
||||
|
||||
public void payRent(int amount) {
|
||||
public void pay(int amount) {
|
||||
accountBalance -= amount;
|
||||
}
|
||||
|
||||
@ -119,7 +127,7 @@ public class Player implements FieldVisitor<Void>{
|
||||
int rent = field.calcRent();
|
||||
|
||||
field.getOwner().earnMoney(rent);
|
||||
payRent(rent);
|
||||
pay(rent);
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -130,7 +138,7 @@ public class Player implements FieldVisitor<Void>{
|
||||
factor = 10;
|
||||
}
|
||||
field.getOwner().earnMoney(rollResult*factor);
|
||||
payRent(rollResult*factor);
|
||||
pay(rollResult*factor);
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -139,7 +147,7 @@ public class Player implements FieldVisitor<Void>{
|
||||
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<Void>{
|
||||
@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) {
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user