setRealm(realm);
}
@Override
public void execute(Realm realm) {
BuildTileImprovement buildTileImprovement = (BuildTileImprovement) getUnit().getType().getAbility("BuildTileImprovement");
if (buildTileImprovement != null) {
Tile tile = realm.getTile(getUnit().getCoordinate());
if (buildTileImprovement.canBuildTileImprovement(tileImprovementType, tile)) {
int productionCost = tileImprovementType.getProductionCost();
int productionPoints = buildTileImprovement.getProductionPoints();
int turnsNeeded = (productionCost / productionPoints);
int turnsSpent = realm.getNumberOfTurns() - getTurnGiven();
if (turnsSpent >= turnsNeeded) {
AddTileImprovementCommand addTileImprovementCommand = new AddTileImprovementCommand(tile, tileImprovementType);
Executor.getInstance().execute(addTileImprovementCommand);