mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-24 22:49: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;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColor(ColorRGBA color) {
|
||||||
|
this.color = color;
|
||||||
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@ -87,7 +95,7 @@ public class Player implements FieldVisitor<Void>{
|
|||||||
return accountBalance;
|
return accountBalance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void payRent(int amount) {
|
public void pay(int amount) {
|
||||||
accountBalance -= amount;
|
accountBalance -= amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +127,7 @@ public class Player implements FieldVisitor<Void>{
|
|||||||
int rent = field.calcRent();
|
int rent = field.calcRent();
|
||||||
|
|
||||||
field.getOwner().earnMoney(rent);
|
field.getOwner().earnMoney(rent);
|
||||||
payRent(rent);
|
pay(rent);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,7 +138,7 @@ public class Player implements FieldVisitor<Void>{
|
|||||||
factor = 10;
|
factor = 10;
|
||||||
}
|
}
|
||||||
field.getOwner().earnMoney(rollResult*factor);
|
field.getOwner().earnMoney(rollResult*factor);
|
||||||
payRent(rollResult*factor);
|
pay(rollResult*factor);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +147,7 @@ public class Player implements FieldVisitor<Void>{
|
|||||||
int rent = field.calcRent() * field.getOwner().getNumProp(field);
|
int rent = field.calcRent() * field.getOwner().getNumProp(field);
|
||||||
|
|
||||||
field.getOwner().earnMoney(rent);
|
field.getOwner().earnMoney(rent);
|
||||||
payRent(rent);
|
pay(rent);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,14 +179,18 @@ public class Player implements FieldVisitor<Void>{
|
|||||||
@Override
|
@Override
|
||||||
public Void visit(GoField field) {
|
public Void visit(GoField field) {
|
||||||
accountBalance += 4000;
|
accountBalance += 4000;
|
||||||
visit((GulagField)handler.getLogic().getBoardManager().getFieldAtIndex(10));
|
GulagField res = (GulagField) handler.getLogic().getBoardManager().getFieldAtIndex(10);
|
||||||
|
res.accept(this);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Void visit(FineField field) {
|
public Void visit(FineField field) {
|
||||||
// TODO Auto-generated method stub
|
int amount = field.getFine();
|
||||||
throw new UnsupportedOperationException("Unimplemented method 'visit'");
|
pay(amount);
|
||||||
|
TestStreckeField res =(TestStreckeField) handler.getLogic().getBoardManager().getFieldAtIndex(20);
|
||||||
|
res.addMoney(amount);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNumProp(PropertyField field) {
|
public int getNumProp(PropertyField field) {
|
||||||
|
@ -29,7 +29,7 @@ public class BoardManager {
|
|||||||
fields.addLast(new BuildingProperty("Gym", 1, 600, 20));
|
fields.addLast(new BuildingProperty("Gym", 1, 600, 20));
|
||||||
fields.addLast(new EventField("Hausfeier", 2));
|
fields.addLast(new EventField("Hausfeier", 2));
|
||||||
fields.addLast(new BuildingProperty("Sportplatz", 3, 600, 40));
|
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 GateField("Südtor", 5));
|
||||||
fields.addLast(new BuildingProperty("Studium+", 6, 1000, 60));
|
fields.addLast(new BuildingProperty("Studium+", 6, 1000, 60));
|
||||||
fields.addLast(new EventField("Üvas", 7));
|
fields.addLast(new EventField("Üvas", 7));
|
||||||
@ -63,7 +63,7 @@ public class BoardManager {
|
|||||||
fields.addLast(new GateField("Osttor", 35));
|
fields.addLast(new GateField("Osttor", 35));
|
||||||
fields.addLast(new EventField("Üvas", 36));
|
fields.addLast(new EventField("Üvas", 36));
|
||||||
fields.addLast(new BuildingProperty("2er", 37, 3500, 350));
|
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));
|
fields.addLast(new BuildingProperty("20er", 39, 4000, 500));
|
||||||
|
|
||||||
return fields;
|
return fields;
|
||||||
|
@ -4,8 +4,15 @@ import pp.monopoly.game.server.Player;
|
|||||||
|
|
||||||
public class FineField extends Field{
|
public class FineField extends Field{
|
||||||
|
|
||||||
FineField(String name, int id) {
|
private final int fine;
|
||||||
|
|
||||||
|
FineField(String name, int id, int fine) {
|
||||||
super(name, id);
|
super(name, id);
|
||||||
|
this.fine = fine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getFine() {
|
||||||
|
return fine;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user