Monopoly/src/main/java/de/joethei/monopoly/fields/Street.java

40 lines
1.1 KiB
Java

package de.joethei.monopoly.fields;
import de.joethei.monopoly.actions.BuildHouseAction;
import de.joethei.monopoly.actions.BuyFieldAction;
import de.joethei.monopoly.actions.PayRentAction;
import de.joethei.monopoly.actions.SellFieldAction;
import de.joethei.monopoly.colors.ConsoleColor;
import de.joethei.monopoly.colors.NormalColor;
public class Street extends OwnableField {
private ConsoleColor color;
private int houses = 0;
public Street(String name, int price, ConsoleColor color) {
super(name, price);
this.color = color;
getActions().add(new BuyFieldAction(this));
getActions().add(new SellFieldAction(this));
getActions().add(new BuildHouseAction(this));
getActions().add(new PayRentAction(this, 50));
}
public ConsoleColor getColor() {
return color;
}
public int getHouses() {
return houses;
}
public void setHouses(int houses) {
this.houses = houses;
}
@Override
public String getName() {
return color.getColorCode() + super.getName() + NormalColor.RESET.getColorCode();
}
}