mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-23 03:23:17 -04:00
Tile stats from inside city now show what they would produce if assigned to this city (important for buildings that improve tiles eg. jungle/university)
This commit is contained in:
parent
561b1b5fdc
commit
86d8378021
@ -114,8 +114,8 @@ public class CityInfo {
|
|||||||
|
|
||||||
// Working ppl
|
// Working ppl
|
||||||
for (TileInfo cell : getTilesInRange())
|
for (TileInfo cell : getTilesInRange())
|
||||||
if (name.equals(cell.workingCity) || cell.isCityCenter())
|
if (name.equals(cell.workingCity))
|
||||||
stats.add(cell.getTileStats());
|
stats.add(cell.getTileStats(this));
|
||||||
|
|
||||||
//idle ppl
|
//idle ppl
|
||||||
stats.production += getFreePopulation();
|
stats.production += getFreePopulation();
|
||||||
@ -218,9 +218,7 @@ public class CityInfo {
|
|||||||
TileInfo toWork = null;
|
TileInfo toWork = null;
|
||||||
for (TileInfo tileInfo : getTilesInRange()) {
|
for (TileInfo tileInfo : getTilesInRange()) {
|
||||||
if (tileInfo.workingCity !=null) continue;
|
if (tileInfo.workingCity !=null) continue;
|
||||||
FullStats stats = tileInfo.getTileStats();
|
double value = rankTile(tileInfo);
|
||||||
|
|
||||||
double value = stats.food + stats.production * 0.5;
|
|
||||||
if (value > maxValue) {
|
if (value > maxValue) {
|
||||||
maxValue = value;
|
maxValue = value;
|
||||||
toWork = tileInfo;
|
toWork = tileInfo;
|
||||||
@ -232,7 +230,7 @@ public class CityInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private double rankTile(TileInfo tile){
|
private double rankTile(TileInfo tile){
|
||||||
FullStats stats = tile.getTileStats();
|
FullStats stats = tile.getTileStats(this);
|
||||||
double rank=0;
|
double rank=0;
|
||||||
if(stats.food <2) rank+=stats.food;
|
if(stats.food <2) rank+=stats.food;
|
||||||
else rank += 2 + (stats.food -2)/2; // 1 point for each food up to 2, from there on half a point
|
else rank += 2 + (stats.food -2)/2; // 1 point for each food up to 2, from there on half a point
|
||||||
|
@ -51,7 +51,9 @@ public class TileInfo
|
|||||||
|
|
||||||
private boolean isResearched(String techName) { return UnCivGame.Current.civInfo.tech.isResearched(techName); }
|
private boolean isResearched(String techName) { return UnCivGame.Current.civInfo.tech.isResearched(techName); }
|
||||||
|
|
||||||
public FullStats getTileStats()
|
public FullStats getTileStats(){return getTileStats(getCity());}
|
||||||
|
|
||||||
|
public FullStats getTileStats(CityInfo city)
|
||||||
{
|
{
|
||||||
FullStats stats = new FullStats(getBaseTerrain());
|
FullStats stats = new FullStats(getBaseTerrain());
|
||||||
|
|
||||||
@ -61,7 +63,6 @@ public class TileInfo
|
|||||||
else stats.add(terrainFeature);
|
else stats.add(terrainFeature);
|
||||||
}
|
}
|
||||||
|
|
||||||
CityInfo city = getCity();
|
|
||||||
TileResource resource = getTileResource();
|
TileResource resource = getTileResource();
|
||||||
if (hasViewableResource())
|
if (hasViewableResource())
|
||||||
{
|
{
|
||||||
@ -89,7 +90,8 @@ public class TileInfo
|
|||||||
|
|
||||||
if (stats.production < 0) stats.production = 0;
|
if (stats.production < 0) stats.production = 0;
|
||||||
|
|
||||||
if("Jungle".equals(terrainFeature) && city.getBuildingUniques().contains("JunglesProvideScience")) stats.science+=2;
|
if("Jungle".equals(terrainFeature) && city!=null
|
||||||
|
&& city.getBuildingUniques().contains("JunglesProvideScience")) stats.science+=2;
|
||||||
if(stats.gold!=0 && CivilizationInfo.current().isGoldenAge())
|
if(stats.gold!=0 && CivilizationInfo.current().isGoldenAge())
|
||||||
stats.gold++;
|
stats.gold++;
|
||||||
|
|
||||||
|
@ -267,8 +267,8 @@ public class CityScreen extends com.unciv.game.utils.CameraStageBaseScreen {
|
|||||||
if(selectedTile == null) return;
|
if(selectedTile == null) return;
|
||||||
TileTable.clearChildren();
|
TileTable.clearChildren();
|
||||||
|
|
||||||
CityInfo City =game.civInfo.getCurrentCity();
|
CityInfo city =game.civInfo.getCurrentCity();
|
||||||
FullStats stats = selectedTile.getTileStats();
|
FullStats stats = selectedTile.getTileStats(city);
|
||||||
TileTable.pad(20);
|
TileTable.pad(20);
|
||||||
TileTable.columnDefaults(0).padRight(10);
|
TileTable.columnDefaults(0).padRight(10);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user