Can now see gold/science production added in city information after selecting it as the construction!

This commit is contained in:
Yair Morgenstern 2017-12-13 22:33:03 +02:00
parent 86d8378021
commit 4a6a6d912f
4 changed files with 17 additions and 9 deletions

View File

@ -45,10 +45,7 @@ public class CityBuildings
public void nextTurn(FullStats cityStats) public void nextTurn(FullStats cityStats)
{ {
if (currentBuilding == null) return; if (getCurrentBuilding()==null) return;
if(currentBuilding.equals("Gold")) {cityStats.gold+=cityStats.production/4; return;}
if(currentBuilding.equals("Science")) {cityStats.science+=cityStats.production/4; return;}
Building gameBuilding = getGameBuilding(currentBuilding); Building gameBuilding = getGameBuilding(currentBuilding);
@ -235,4 +232,10 @@ public class CityBuildings
result+="\r\n"+turnsToBuilding(currentBuilding)+" turns"; result+="\r\n"+turnsToBuilding(currentBuilding)+" turns";
return result; return result;
} }
public String getAmountConstructedText(){
if(currentBuilding.equals("Science") || currentBuilding.equals("Gold")) return "";
return " ("+ workDone(currentBuilding) + "/"+getCurrentBuilding().cost+")";
}
} }

View File

@ -134,9 +134,12 @@ public class CityInfo {
FullStats statPercentBonuses = cityBuildings.getStatPercentBonuses(); FullStats statPercentBonuses = cityBuildings.getStatPercentBonuses();
if(isCapital() || isConnectedToCapital(RoadStatus.Railroad)) statPercentBonuses.production += 25; if(isCapital() || isConnectedToCapital(RoadStatus.Railroad)) statPercentBonuses.production += 25;
if(CivilizationInfo.current().isGoldenAge()) statPercentBonuses.production+=20; if(CivilizationInfo.current().isGoldenAge()) statPercentBonuses.production+=20;
stats.production*=1+statPercentBonuses.production/100; // So they get bonuses for production and gold/science
if(cityBuildings.currentBuilding.equals("Gold")) stats.gold+=stats.production/4;
if(cityBuildings.currentBuilding.equals("Science")) stats.science+=stats.production/4;
stats.food*=1+statPercentBonuses.food/100; stats.food*=1+statPercentBonuses.food/100;
stats.gold*=1+statPercentBonuses.gold/100; stats.gold*=1+statPercentBonuses.gold/100;
stats.production*=1+statPercentBonuses.production/100;
stats.science*=1+statPercentBonuses.science/100; stats.science*=1+statPercentBonuses.science/100;
stats.culture*=1+statPercentBonuses.culture/100; stats.culture*=1+statPercentBonuses.culture/100;
@ -285,4 +288,7 @@ public class CityInfo {
}); });
} }
} }

View File

@ -22,7 +22,6 @@ import com.badlogic.gdx.utils.Align;
import com.unciv.civinfo.CityInfo; import com.unciv.civinfo.CityInfo;
import com.unciv.civinfo.TileInfo; import com.unciv.civinfo.TileInfo;
import com.unciv.game.pickerscreens.BuildingPickerScreen; import com.unciv.game.pickerscreens.BuildingPickerScreen;
import com.unciv.game.pickerscreens.PickerScreen;
import com.unciv.models.gamebasics.Building; import com.unciv.models.gamebasics.Building;
import com.unciv.models.stats.FullStats; import com.unciv.models.stats.FullStats;
@ -203,8 +202,7 @@ public class CityScreen extends com.unciv.game.utils.CameraStageBaseScreen {
HashMap<String,String> CityStatsValues = new LinkedHashMap<String, String>(); HashMap<String,String> CityStatsValues = new LinkedHashMap<String, String>();
CityStatsValues.put("Production",Math.round(stats.production) CityStatsValues.put("Production",Math.round(stats.production)
+" ("+ cityInfo.cityBuildings.workDone(cityInfo.cityBuildings.currentBuilding) +cityInfo.cityBuildings.getAmountConstructedText());
+"/"+cityInfo.cityBuildings.getCurrentBuilding().cost+")");
CityStatsValues.put("Food",Math.round(stats.food) CityStatsValues.put("Food",Math.round(stats.food)
+" ("+cityInfo.foodStored+"/"+cityInfo.foodToNextPopulation()+")"); +" ("+cityInfo.foodStored+"/"+cityInfo.foodToNextPopulation()+")");
CityStatsValues.put("Gold",Math.round(stats.gold) +""); CityStatsValues.put("Gold",Math.round(stats.gold) +"");
@ -239,7 +237,7 @@ public class CityScreen extends com.unciv.game.utils.CameraStageBaseScreen {
// https://forums.civfanatics.com/threads/rush-buying-formula.393892/ // https://forums.civfanatics.com/threads/rush-buying-formula.393892/
Building building = cityInfo.cityBuildings.getCurrentBuilding(); Building building = cityInfo.cityBuildings.getCurrentBuilding();
if(!building.isWonder) { if(building != null && !building.isWonder) {
CityStatsTable.row(); CityStatsTable.row();
int buildingGoldCost = building.getGoldCost(); int buildingGoldCost = building.getGoldCost();
TextButton buildingBuyButton = new TextButton("Buy for \r\n"+buildingGoldCost+" gold", skin); TextButton buildingBuyButton = new TextButton("Buy for \r\n"+buildingGoldCost+" gold", skin);

View File

@ -48,6 +48,7 @@ public class BuildingPickerScreen extends PickerScreen {
@Override @Override
public void clicked(InputEvent event, float x, float y) { public void clicked(InputEvent event, float x, float y) {
game.civInfo.getCurrentCity().cityBuildings.currentBuilding = selectedProduction; game.civInfo.getCurrentCity().cityBuildings.currentBuilding = selectedProduction;
game.civInfo.getCurrentCity().updateCityStats(); // Because maybe we set/removed the science or gold production options.
game.setScreen(new CityScreen(game)); game.setScreen(new CityScreen(game));
dispose(); dispose();
} }