mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-25 07:09:16 +07:00
Can now see gold/science production added in city information after selecting it as the construction!
This commit is contained in:
@ -45,10 +45,7 @@ public class CityBuildings
|
||||
|
||||
public void nextTurn(FullStats cityStats)
|
||||
{
|
||||
if (currentBuilding == null) return;
|
||||
if(currentBuilding.equals("Gold")) {cityStats.gold+=cityStats.production/4; return;}
|
||||
if(currentBuilding.equals("Science")) {cityStats.science+=cityStats.production/4; return;}
|
||||
|
||||
if (getCurrentBuilding()==null) return;
|
||||
|
||||
Building gameBuilding = getGameBuilding(currentBuilding);
|
||||
|
||||
@ -235,4 +232,10 @@ public class CityBuildings
|
||||
result+="\r\n"+turnsToBuilding(currentBuilding)+" turns";
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public String getAmountConstructedText(){
|
||||
if(currentBuilding.equals("Science") || currentBuilding.equals("Gold")) return "";
|
||||
return " ("+ workDone(currentBuilding) + "/"+getCurrentBuilding().cost+")";
|
||||
}
|
||||
}
|
@ -134,9 +134,12 @@ public class CityInfo {
|
||||
FullStats statPercentBonuses = cityBuildings.getStatPercentBonuses();
|
||||
if(isCapital() || isConnectedToCapital(RoadStatus.Railroad)) statPercentBonuses.production += 25;
|
||||
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.gold*=1+statPercentBonuses.gold/100;
|
||||
stats.production*=1+statPercentBonuses.production/100;
|
||||
stats.science*=1+statPercentBonuses.science/100;
|
||||
stats.culture*=1+statPercentBonuses.culture/100;
|
||||
|
||||
@ -285,4 +288,7 @@ public class CityInfo {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -22,7 +22,6 @@ import com.badlogic.gdx.utils.Align;
|
||||
import com.unciv.civinfo.CityInfo;
|
||||
import com.unciv.civinfo.TileInfo;
|
||||
import com.unciv.game.pickerscreens.BuildingPickerScreen;
|
||||
import com.unciv.game.pickerscreens.PickerScreen;
|
||||
import com.unciv.models.gamebasics.Building;
|
||||
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>();
|
||||
CityStatsValues.put("Production",Math.round(stats.production)
|
||||
+" ("+ cityInfo.cityBuildings.workDone(cityInfo.cityBuildings.currentBuilding)
|
||||
+"/"+cityInfo.cityBuildings.getCurrentBuilding().cost+")");
|
||||
+cityInfo.cityBuildings.getAmountConstructedText());
|
||||
CityStatsValues.put("Food",Math.round(stats.food)
|
||||
+" ("+cityInfo.foodStored+"/"+cityInfo.foodToNextPopulation()+")");
|
||||
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/
|
||||
|
||||
Building building = cityInfo.cityBuildings.getCurrentBuilding();
|
||||
if(!building.isWonder) {
|
||||
if(building != null && !building.isWonder) {
|
||||
CityStatsTable.row();
|
||||
int buildingGoldCost = building.getGoldCost();
|
||||
TextButton buildingBuyButton = new TextButton("Buy for \r\n"+buildingGoldCost+" gold", skin);
|
||||
|
@ -48,6 +48,7 @@ public class BuildingPickerScreen extends PickerScreen {
|
||||
@Override
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
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));
|
||||
dispose();
|
||||
}
|
||||
|
Reference in New Issue
Block a user