mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-13 01:08:25 +07:00
Camelcased json model field names
This commit is contained in:
@ -47,7 +47,7 @@ public class CityBuildings
|
||||
if (!InProgressBuildings.containsKey(CurrentBuilding)) InProgressBuildings.put(CurrentBuilding, 0);
|
||||
InProgressBuildings.put(CurrentBuilding, InProgressBuildings.get(CurrentBuilding) + ProductionProduced);
|
||||
|
||||
if (InProgressBuildings.get(CurrentBuilding) >= GetGameBuilding(CurrentBuilding).Cost)
|
||||
if (InProgressBuildings.get(CurrentBuilding) >= GetGameBuilding(CurrentBuilding).cost)
|
||||
{
|
||||
if (CurrentBuilding.equals(Worker) || CurrentBuilding.equals(Settler))
|
||||
UnCivGame.Current.civInfo.tileMap.get(cityLocation).unit = new Unit(CurrentBuilding,2);
|
||||
@ -56,9 +56,9 @@ public class CityBuildings
|
||||
{
|
||||
BuiltBuildings.add(CurrentBuilding);
|
||||
Building gameBuilding = GetGameBuilding(CurrentBuilding);
|
||||
if (gameBuilding.ProvidesFreeBuilding != null && !BuiltBuildings.contains(gameBuilding.ProvidesFreeBuilding))
|
||||
BuiltBuildings.add(gameBuilding.ProvidesFreeBuilding);
|
||||
if (gameBuilding.FreeTechs != 0) UnCivGame.Current.civInfo.tech.FreeTechs += gameBuilding.FreeTechs;
|
||||
if (gameBuilding.providesFreeBuilding != null && !BuiltBuildings.contains(gameBuilding.providesFreeBuilding))
|
||||
BuiltBuildings.add(gameBuilding.providesFreeBuilding);
|
||||
if (gameBuilding.freeTechs != 0) UnCivGame.Current.civInfo.tech.FreeTechs += gameBuilding.freeTechs;
|
||||
}
|
||||
|
||||
InProgressBuildings.remove(CurrentBuilding);
|
||||
@ -79,36 +79,36 @@ public class CityBuildings
|
||||
public boolean CanBuild(final Building building)
|
||||
{
|
||||
CivilizationInfo civInfo = UnCivGame.Current.civInfo;
|
||||
if(IsBuilt(building.Name)) return false;
|
||||
if(IsBuilt(building.name)) return false;
|
||||
// if (building.name.equals("Worker") || building.name.equals("Settler")) return false;
|
||||
if(building.ResourceRequired) {
|
||||
if(building.resourceRequired) {
|
||||
boolean containsResourceWithImprovement = GetCity().getTilesInRange()
|
||||
.any(new Predicate<TileInfo>() {
|
||||
@Override
|
||||
public boolean evaluate(TileInfo tile) {
|
||||
return tile.resource != null
|
||||
&& building.Name.equals(tile.getTileResource().Building)
|
||||
&& tile.getTileResource().Improvement.equals(tile.improvement);
|
||||
&& building.name.equals(tile.getTileResource().building)
|
||||
&& tile.getTileResource().improvement.equals(tile.improvement);
|
||||
}
|
||||
});
|
||||
if(!containsResourceWithImprovement) return false;
|
||||
}
|
||||
|
||||
if (building.RequiredTech != null && !civInfo.tech.IsResearched(building.RequiredTech)) return false;
|
||||
if (building.IsWonder && civInfo.cities
|
||||
if (building.requiredTech != null && !civInfo.tech.IsResearched(building.requiredTech)) return false;
|
||||
if (building.isWonder && civInfo.cities
|
||||
.any(new Predicate<CityInfo>() {
|
||||
@Override
|
||||
public boolean evaluate(CityInfo arg0) {
|
||||
CityBuildings CB = arg0.cityBuildings;
|
||||
return CB.IsBuilding(building.Name) || CB.IsBuilt(building.Name);
|
||||
return CB.IsBuilding(building.name) || CB.IsBuilt(building.name);
|
||||
}
|
||||
}) ) return false;
|
||||
if (building.RequiredBuilding != null && !IsBuilt(building.RequiredBuilding)) return false;
|
||||
if (building.RequiredBuildingInAllCities != null ||
|
||||
if (building.requiredBuilding != null && !IsBuilt(building.requiredBuilding)) return false;
|
||||
if (building.requiredBuildingInAllCities != null ||
|
||||
civInfo.cities.any(new Predicate<CityInfo>() {
|
||||
@Override
|
||||
public boolean evaluate(CityInfo arg0) {
|
||||
return arg0.cityBuildings.IsBuilt(building.RequiredBuildingInAllCities);
|
||||
return arg0.cityBuildings.IsBuilt(building.requiredBuildingInAllCities);
|
||||
}
|
||||
}) ) return false;
|
||||
|
||||
@ -125,7 +125,7 @@ public class CityBuildings
|
||||
.select(new com.unciv.models.LinqCollection.Func<Building, String>() {
|
||||
@Override
|
||||
public String GetBy(Building arg0) {
|
||||
return arg0.Name;
|
||||
return arg0.name;
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -138,7 +138,7 @@ public class CityBuildings
|
||||
Building gameBuilding = GetGameBuilding(building);
|
||||
stats.add(gameBuilding);
|
||||
//if (gameBuilding.GetFlatBonusStats != null) stats.add(gameBuilding.GetFlatBonusStats(cityInfo));
|
||||
stats.Gold -= gameBuilding.Maintainance;
|
||||
stats.gold -= gameBuilding.maintainance;
|
||||
}
|
||||
return stats;
|
||||
}
|
||||
@ -147,11 +147,11 @@ public class CityBuildings
|
||||
{
|
||||
int workDone = 0;
|
||||
if (InProgressBuildings.containsKey(buildingName)) workDone = InProgressBuildings.get(buildingName);
|
||||
float workLeft = GetGameBuilding(buildingName).Cost - workDone; // needs to be float so that we get the cieling properly ;)
|
||||
float workLeft = GetGameBuilding(buildingName).cost - workDone; // needs to be float so that we get the cieling properly ;)
|
||||
|
||||
FullStats cityStats = GetCity().getCityStats();
|
||||
int production = cityStats.Production;
|
||||
if (buildingName.equals(Settler)) production += cityStats.Food;
|
||||
int production = cityStats.production;
|
||||
if (buildingName.equals(Settler)) production += cityStats.food;
|
||||
|
||||
return (int) Math.ceil(workLeft / production);
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public class CityInfo {
|
||||
ArrayList<String> LuxuryResources = new ArrayList<String>();
|
||||
for (TileInfo tileInfo : getTilesInRange()) {
|
||||
TileResource resource = tileInfo.getTileResource();
|
||||
if (resource != null && resource.ResourceType == ResourceType.Luxury && resource.Improvement.equals(tileInfo.improvement))
|
||||
if (resource != null && resource.resourceType == ResourceType.Luxury && resource.improvement.equals(tileInfo.improvement))
|
||||
LuxuryResources.add(tileInfo.resource);
|
||||
}
|
||||
return LuxuryResources;
|
||||
@ -92,10 +92,10 @@ public class CityInfo {
|
||||
|
||||
public FullStats getCityStats() {
|
||||
FullStats stats = new FullStats() {{
|
||||
Happiness = -3 - cityPopulation.Population; // -3 happiness per city and -3 per population
|
||||
happiness = -3 - cityPopulation.Population; // -3 happiness per city and -3 per population
|
||||
}};
|
||||
|
||||
stats.Science += cityPopulation.Population;
|
||||
stats.science += cityPopulation.Population;
|
||||
|
||||
// Working ppl
|
||||
for (TileInfo cell : getTilesInRange())
|
||||
@ -103,8 +103,8 @@ public class CityInfo {
|
||||
stats.add(cell.getTileStats());
|
||||
|
||||
//idle ppl
|
||||
stats.Production += getFreePopulation();
|
||||
stats.Food -= cityPopulation.Population * 2;
|
||||
stats.production += getFreePopulation();
|
||||
stats.food -= cityPopulation.Population * 2;
|
||||
|
||||
stats.add(cityBuildings.GetStats());
|
||||
|
||||
@ -114,16 +114,16 @@ public class CityInfo {
|
||||
void nextTurn() {
|
||||
FullStats stats = getCityStats();
|
||||
|
||||
if (cityBuildings.CurrentBuilding.equals(CityBuildings.Settler) && stats.Food > 0) {
|
||||
stats.Production += stats.Food;
|
||||
stats.Food = 0;
|
||||
if (cityBuildings.CurrentBuilding.equals(CityBuildings.Settler) && stats.food > 0) {
|
||||
stats.production += stats.food;
|
||||
stats.food = 0;
|
||||
}
|
||||
|
||||
if (cityPopulation.NextTurn(stats.Food)) autoAssignWorker();
|
||||
if (cityPopulation.NextTurn(stats.food)) autoAssignWorker();
|
||||
|
||||
cityBuildings.NextTurn(stats.Production);
|
||||
cityBuildings.NextTurn(stats.production);
|
||||
|
||||
cultureStored+=stats.Culture;
|
||||
cultureStored+=stats.culture;
|
||||
if(cultureStored>=getCultureToNextTile()){
|
||||
addNewTile();
|
||||
}
|
||||
@ -165,7 +165,7 @@ public class CityInfo {
|
||||
if (tileInfo.workingCity !=null) continue;
|
||||
FullStats stats = tileInfo.getTileStats();
|
||||
|
||||
double value = stats.Food + stats.Production * 0.5;
|
||||
double value = stats.food + stats.production * 0.5;
|
||||
if (value > maxValue) {
|
||||
maxValue = value;
|
||||
toWork = tileInfo;
|
||||
@ -177,12 +177,12 @@ public class CityInfo {
|
||||
private double rankTile(TileInfo tile){
|
||||
FullStats stats = tile.getTileStats();
|
||||
double rank=0;
|
||||
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
|
||||
rank+=stats.Gold/2;
|
||||
rank+=stats.Production;
|
||||
rank+=stats.Science;
|
||||
rank+=stats.Culture;
|
||||
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
|
||||
rank+=stats.gold /2;
|
||||
rank+=stats.production;
|
||||
rank+=stats.science;
|
||||
rank+=stats.culture;
|
||||
if(tile.improvement ==null) rank+=0.5; // improvement potential!
|
||||
return rank;
|
||||
}
|
||||
|
@ -34,8 +34,8 @@ public class CivilizationInfo {
|
||||
public CityInfo getCurrentCity() { return cities.get(currentCity); }
|
||||
|
||||
public int turnsToTech(String TechName) {
|
||||
return (int) Math.ceil((float)(GameBasics.Technologies.get(TechName).Cost - tech.ResearchOfTech(TechName))
|
||||
/ getStatsForNextTurn().Science);
|
||||
return (int) Math.ceil((float)(GameBasics.Technologies.get(TechName).cost - tech.ResearchOfTech(TechName))
|
||||
/ getStatsForNextTurn().science);
|
||||
}
|
||||
|
||||
public void addCity(Vector2 location){
|
||||
@ -47,7 +47,7 @@ public class CivilizationInfo {
|
||||
{
|
||||
CivStats nextTurnStats = getStatsForNextTurn();
|
||||
civStats.add(nextTurnStats);
|
||||
if(cities.size() > 0) tech.NextTurn(nextTurnStats.Science);
|
||||
if(cities.size() > 0) tech.NextTurn(nextTurnStats.science);
|
||||
|
||||
for (CityInfo city : cities) city.nextTurn();
|
||||
|
||||
@ -58,14 +58,14 @@ public class CivilizationInfo {
|
||||
|
||||
public CivStats getStatsForNextTurn() {
|
||||
CivStats statsForTurn = new CivStats() {{
|
||||
Happiness = baseHappiness;
|
||||
happiness = baseHappiness;
|
||||
}};
|
||||
HashSet<String> LuxuryResources = new HashSet<String>();
|
||||
for (CityInfo city : cities) {
|
||||
statsForTurn.add(city.getCityStats());
|
||||
LuxuryResources.addAll(city.getLuxuryResources());
|
||||
}
|
||||
statsForTurn.Happiness += LuxuryResources.size() * 5; // 5 happiness for each unique luxury in civ
|
||||
statsForTurn.happiness += LuxuryResources.size() * 5; // 5 happiness for each unique luxury in civ
|
||||
|
||||
return statsForTurn;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public class CivilizationTech{
|
||||
}
|
||||
|
||||
public boolean CanBeResearched(String TechName) {
|
||||
for (String prerequisiteTech : GameBasics.Technologies.get(TechName).Prerequisites)
|
||||
for (String prerequisiteTech : GameBasics.Technologies.get(TechName).prerequisites)
|
||||
if (!IsResearched(prerequisiteTech)) return false;
|
||||
return true;
|
||||
}
|
||||
@ -44,7 +44,7 @@ public class CivilizationTech{
|
||||
if (!TechsInProgress.containsKey(CurrentTechnology))
|
||||
TechsInProgress.put(CurrentTechnology, 0);
|
||||
TechsInProgress.put(CurrentTechnology, TechsInProgress.get(CurrentTechnology) + scienceForNewTurn);
|
||||
if (TechsInProgress.get(CurrentTechnology) >= GetCurrentTechnology().Cost) // We finished it!
|
||||
if (TechsInProgress.get(CurrentTechnology) >= GetCurrentTechnology().cost) // We finished it!
|
||||
{
|
||||
TechsInProgress.remove(CurrentTechnology);
|
||||
TechsResearched.add(CurrentTechnology);
|
||||
|
@ -60,7 +60,7 @@ public class TileInfo
|
||||
|
||||
if(terrainFeature !=null){
|
||||
Terrain terrainFeature = getTerrainFeature();
|
||||
if(terrainFeature.OverrideStats) stats = new FullStats(terrainFeature);
|
||||
if(terrainFeature.overrideStats) stats = new FullStats(terrainFeature);
|
||||
else stats.add(terrainFeature);
|
||||
}
|
||||
|
||||
@ -70,43 +70,43 @@ public class TileInfo
|
||||
if (hasViewableResource())
|
||||
{
|
||||
stats.add(resource);
|
||||
if(resource.Building!=null && City!=null && City.cityBuildings.IsBuilt(resource.Building))
|
||||
if(resource.building !=null && City!=null && City.cityBuildings.IsBuilt(resource.building))
|
||||
{
|
||||
stats.add(resource.GetBuilding().ResourceBonusStats);
|
||||
stats.add(resource.GetBuilding().resourceBonusStats);
|
||||
}
|
||||
}
|
||||
|
||||
TileImprovement improvement = getTileImprovement();
|
||||
if (improvement != null)
|
||||
{
|
||||
if (resource != null && resource.Improvement.equals(improvement.Name))
|
||||
stats.add(resource.ImprovementStats);
|
||||
if (resource != null && resource.improvement.equals(improvement.name))
|
||||
stats.add(resource.improvementStats);
|
||||
else stats.add(improvement);
|
||||
|
||||
if (isResearched(improvement.ImprovingTech)) stats.add(improvement.ImprovingTechStats);
|
||||
if (isResearched(improvement.improvingTech)) stats.add(improvement.improvingTechStats);
|
||||
}
|
||||
|
||||
if (City != null && City.cityLocation.equals(position)) {
|
||||
if (stats.Food < 2) stats.Food = 2;
|
||||
if (stats.Production < 1) stats.Production = 1;
|
||||
if (stats.food < 2) stats.food = 2;
|
||||
if (stats.production < 1) stats.production = 1;
|
||||
}
|
||||
if (stats.Production < 0) stats.Production = 0;
|
||||
if (stats.production < 0) stats.production = 0;
|
||||
return stats;
|
||||
}
|
||||
|
||||
public boolean canBuildImprovement(TileImprovement improvement)
|
||||
{
|
||||
Terrain topTerrain = terrainFeature ==null ? getBaseTerrain() : getTerrainFeature();
|
||||
if (improvement.TechRequired != null && !isResearched(improvement.TechRequired)) return false;
|
||||
if (improvement.TerrainsCanBeBuiltOn.contains(topTerrain.Name)) return true;
|
||||
if (topTerrain.Unbuildable) return false;
|
||||
return resource != null && getTileResource().Improvement.equals(improvement.Name);
|
||||
if (improvement.techRequired != null && !isResearched(improvement.techRequired)) return false;
|
||||
if (improvement.terrainsCanBeBuiltOn.contains(topTerrain.name)) return true;
|
||||
if (topTerrain.unbuildable) return false;
|
||||
return resource != null && getTileResource().improvement.equals(improvement.name);
|
||||
}
|
||||
|
||||
public void startWorkingOnImprovement(TileImprovement improvement)
|
||||
{
|
||||
improvementInProgress = improvement.Name;
|
||||
turnsToImprovement = improvement.TurnsToBuild;
|
||||
improvementInProgress = improvement.name;
|
||||
turnsToImprovement = improvement.turnsToBuild;
|
||||
}
|
||||
|
||||
public void stopWorkingOnImprovement()
|
||||
@ -142,7 +142,7 @@ public class TileInfo
|
||||
}
|
||||
|
||||
public boolean hasViewableResource() {
|
||||
return resource != null && (getTileResource().RevealedBy==null || isResearched(getTileResource().RevealedBy));
|
||||
return resource != null && (getTileResource().revealedBy ==null || isResearched(getTileResource().revealedBy));
|
||||
}
|
||||
|
||||
}
|
@ -8,6 +8,7 @@ import com.unciv.models.LinqHashMap;
|
||||
import com.unciv.models.gamebasics.GameBasics;
|
||||
import com.unciv.models.gamebasics.ResourceType;
|
||||
import com.unciv.models.gamebasics.Terrain;
|
||||
import com.unciv.models.gamebasics.TerrainType;
|
||||
import com.unciv.models.gamebasics.TileResource;
|
||||
|
||||
public class TileMap{
|
||||
@ -29,30 +30,30 @@ public class TileMap{
|
||||
final Terrain baseTerrain = Terrains.where(new Predicate<Terrain>() {
|
||||
@Override
|
||||
public boolean evaluate(Terrain arg0) {
|
||||
return arg0.Type.equals("baseTerrain") && !arg0.Name.equals("Lakes");
|
||||
return arg0.type == TerrainType.BaseTerrain && !arg0.name.equals("Lakes");
|
||||
}
|
||||
}).getRandom();
|
||||
tileInfo.baseTerrain = baseTerrain.Name;
|
||||
tileInfo.baseTerrain = baseTerrain.name;
|
||||
|
||||
if (baseTerrain.CanHaveOverlay) {
|
||||
if (baseTerrain.canHaveOverlay) {
|
||||
if (Math.random() > 0.7f) {
|
||||
Terrain SecondaryTerrain = Terrains.where(new Predicate<Terrain>() {
|
||||
@Override
|
||||
public boolean evaluate(Terrain arg0) {
|
||||
return arg0.Type.equals("terrainFeature") && arg0.OccursOn.contains(baseTerrain.Name);
|
||||
return arg0.type == TerrainType.TerrainFeature && arg0.occursOn.contains(baseTerrain.name);
|
||||
}
|
||||
}).getRandom();
|
||||
if (SecondaryTerrain != null) tileInfo.terrainFeature = SecondaryTerrain.Name;
|
||||
if (SecondaryTerrain != null) tileInfo.terrainFeature = SecondaryTerrain.name;
|
||||
}
|
||||
}
|
||||
|
||||
LinqCollection<TileResource> TileResources = GameBasics.TileResources.linqValues();
|
||||
|
||||
// Resources are placed according to terrainFeature, if exists, otherwise according to BaseLayer.
|
||||
// Resources are placed according to TerrainFeature, if exists, otherwise according to BaseLayer.
|
||||
TileResources = TileResources.where(new Predicate<TileResource>() {
|
||||
@Override
|
||||
public boolean evaluate(TileResource arg0) {
|
||||
return arg0.TerrainsCanBeFoundOn.contains(tileInfo.getLastTerrain().Name);
|
||||
return arg0.terrainsCanBeFoundOn.contains(tileInfo.getLastTerrain().name);
|
||||
}
|
||||
});
|
||||
|
||||
@ -64,7 +65,7 @@ public class TileMap{
|
||||
} else if (Math.random() < 1 / 10f) {
|
||||
resource = GetRandomResource(TileResources, ResourceType.Luxury);
|
||||
}
|
||||
if (resource != null) tileInfo.resource = resource.Name;
|
||||
if (resource != null) tileInfo.resource = resource.name;
|
||||
|
||||
tiles.put(position.toString(),tileInfo);
|
||||
}
|
||||
@ -89,7 +90,7 @@ public class TileMap{
|
||||
return resources.where(new Predicate<TileResource>() {
|
||||
@Override
|
||||
public boolean evaluate(TileResource arg0) {
|
||||
return arg0.ResourceType.equals(resourceType);
|
||||
return arg0.resourceType.equals(resourceType);
|
||||
}
|
||||
}).getRandom();
|
||||
}
|
||||
|
@ -198,11 +198,11 @@ public class CityScreen extends CameraStageBaseScreen {
|
||||
CityStatsTable.row();
|
||||
|
||||
HashMap<String,String> CityStatsValues = new LinkedHashMap<String, String>();
|
||||
CityStatsValues.put("Production",stats.Production+"");
|
||||
CityStatsValues.put("Food",stats.Food+" ("+cityInfo.cityPopulation.FoodStored+"/"+cityInfo.cityPopulation.FoodToNextPopulation()+")");
|
||||
CityStatsValues.put("Gold",stats.Gold+"");
|
||||
CityStatsValues.put("Science",stats.Science+"");
|
||||
CityStatsValues.put("Culture",stats.Culture+" ("+cityInfo.cultureStored+"/"+cityInfo.getCultureToNextTile()+")");
|
||||
CityStatsValues.put("production",stats.production +"");
|
||||
CityStatsValues.put("food",stats.food +" ("+cityInfo.cityPopulation.FoodStored+"/"+cityInfo.cityPopulation.FoodToNextPopulation()+")");
|
||||
CityStatsValues.put("gold",stats.gold +"");
|
||||
CityStatsValues.put("science",stats.science +"");
|
||||
CityStatsValues.put("culture",stats.culture +" ("+cityInfo.cultureStored+"/"+cityInfo.getCultureToNextTile()+")");
|
||||
CityStatsValues.put("Population",cityInfo.getFreePopulation()+"/"+cityInfo.cityPopulation.Population);
|
||||
|
||||
for(String key : CityStatsValues.keySet()){
|
||||
@ -250,11 +250,11 @@ public class CityScreen extends CameraStageBaseScreen {
|
||||
TileTable.row();
|
||||
|
||||
HashMap<String,String> TileStatsValues = new HashMap<String, String>();
|
||||
TileStatsValues.put("Production",stats.Production+"");
|
||||
TileStatsValues.put("Food",stats.Food+"");
|
||||
TileStatsValues.put("Gold",stats.Gold+"");
|
||||
TileStatsValues.put("Science",stats.Science+"");
|
||||
TileStatsValues.put("Culture",stats.Culture+"");
|
||||
TileStatsValues.put("production",stats.production +"");
|
||||
TileStatsValues.put("food",stats.food +"");
|
||||
TileStatsValues.put("gold",stats.gold +"");
|
||||
TileStatsValues.put("science",stats.science +"");
|
||||
TileStatsValues.put("culture",stats.culture +"");
|
||||
|
||||
for(String key : TileStatsValues.keySet()){
|
||||
if(TileStatsValues.get(key).equals("0")) continue; // this tile gives nothing of this stat, so why even display it?
|
||||
|
@ -62,7 +62,7 @@ public class CivilopediaScreen extends CameraStageBaseScreen {
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
ICivilopedia building = nameList.getSelected();
|
||||
if (building == null) return;
|
||||
label.setText(building.GetDescription());
|
||||
label.setText(building.getDescription());
|
||||
super.clicked(event, x, y);
|
||||
}
|
||||
};
|
||||
|
@ -21,7 +21,7 @@ public class TileGroup extends Group {
|
||||
TileGroup(TileInfo tileInfo){
|
||||
this.tileInfo = tileInfo;
|
||||
|
||||
String terrainFileName = "TerrainIcons/" + tileInfo.getLastTerrain().Name.replace(' ','_') + "_(Civ5).png";
|
||||
String terrainFileName = "TerrainIcons/" + tileInfo.getLastTerrain().name.replace(' ','_') + "_(Civ5).png";
|
||||
terrainImage = ImageGetter.getImageByFilename(terrainFileName);
|
||||
terrainImage.setSize(50,50);
|
||||
addActor(terrainImage);
|
||||
|
@ -73,16 +73,16 @@ public class UnCivGame extends Game {
|
||||
TechColumn[] TechColumns = GetFromJson(TechColumn[].class, "Techs");
|
||||
GameBasics.Technologies = new LinqHashMap<String, Technology>();
|
||||
for(TechColumn techColumn : TechColumns){
|
||||
for(com.unciv.models.gamebasics.Technology tech : techColumn.Techs){
|
||||
tech.Cost = techColumn.TechCost;
|
||||
tech.Column = techColumn;
|
||||
GameBasics.Technologies.put(tech.Name,tech);
|
||||
for(com.unciv.models.gamebasics.Technology tech : techColumn.techs){
|
||||
tech.cost = techColumn.techCost;
|
||||
tech.column = techColumn;
|
||||
GameBasics.Technologies.put(tech.name,tech);
|
||||
}
|
||||
}
|
||||
for(com.unciv.models.gamebasics.Building building : GameBasics.Buildings.values()){
|
||||
if(building.RequiredTech == null) continue;
|
||||
TechColumn column = building.GetRequiredTech().Column;
|
||||
building.Cost = building.IsWonder ? column.WonderCost : column.BuildingCost;
|
||||
if(building.requiredTech == null) continue;
|
||||
TechColumn column = building.GetRequiredTech().column;
|
||||
building.cost = building.isWonder ? column.wonderCost : column.buildingCost;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,11 +162,11 @@ public class WorldScreen extends CameraStageBaseScreen {
|
||||
|
||||
CivStats nextTurnStats = game.civInfo.getStatsForNextTurn();
|
||||
|
||||
CivTable.add(new Label("Gold: " + currentStats.Gold + "(" +(nextTurnStats.Gold>0?"+":"") + nextTurnStats.Gold+")", skin));
|
||||
CivTable.add(new Label("gold: " + currentStats.gold + "(" +(nextTurnStats.gold >0?"+":"") + nextTurnStats.gold +")", skin));
|
||||
|
||||
CivTable.add(new Label("Science: +" + nextTurnStats.Science, skin));
|
||||
CivTable.add(new Label("Happiness: " + nextTurnStats.Happiness, skin));
|
||||
CivTable.add(new Label("Culture: " + currentStats.Culture + "(+" + nextTurnStats.Culture+")", skin));
|
||||
CivTable.add(new Label("science: +" + nextTurnStats.science, skin));
|
||||
CivTable.add(new Label("happiness: " + nextTurnStats.happiness, skin));
|
||||
CivTable.add(new Label("culture: " + currentStats.culture + "(+" + nextTurnStats.culture +")", skin));
|
||||
|
||||
CivTable.pack();
|
||||
|
||||
@ -291,11 +291,11 @@ public class WorldScreen extends CameraStageBaseScreen {
|
||||
TileTable.row();
|
||||
|
||||
HashMap<String,String> TileStatsValues = new HashMap<String, String>();
|
||||
TileStatsValues.put("Production",stats.Production+"");
|
||||
TileStatsValues.put("Food",stats.Food+"");
|
||||
TileStatsValues.put("Gold",stats.Gold+"");
|
||||
TileStatsValues.put("Science",stats.Science+"");
|
||||
TileStatsValues.put("Culture",stats.Culture+"");
|
||||
TileStatsValues.put("production",stats.production +"");
|
||||
TileStatsValues.put("food",stats.food +"");
|
||||
TileStatsValues.put("gold",stats.gold +"");
|
||||
TileStatsValues.put("science",stats.science +"");
|
||||
TileStatsValues.put("culture",stats.culture +"");
|
||||
|
||||
for(String key : TileStatsValues.keySet()){
|
||||
if(TileStatsValues.get(key).equals("0")) continue; // this tile gives nothing of this stat, so why even display it?
|
||||
|
@ -30,7 +30,7 @@ public class BuildingPickerScreen extends PickerScreen {
|
||||
rightSideButton.addListener(new ClickListener(){
|
||||
@Override
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
game.civInfo.getCurrentCity().cityBuildings.CurrentBuilding = selectedBuilding.Name;
|
||||
game.civInfo.getCurrentCity().cityBuildings.CurrentBuilding = selectedBuilding.name;
|
||||
game.setScreen(new CityScreen(game));
|
||||
dispose();
|
||||
}
|
||||
@ -41,15 +41,15 @@ public class BuildingPickerScreen extends PickerScreen {
|
||||
CityBuildings cityBuildings = game.civInfo.getCurrentCity().cityBuildings;
|
||||
for(final Building building : GameBasics.Buildings.values()) {
|
||||
if(!cityBuildings.CanBuild(building)) continue;
|
||||
TextButton TB = new TextButton(building.Name+"\r\n"+cityBuildings.TurnsToBuilding(building.Name)+" turns", skin);
|
||||
TextButton TB = new TextButton(building.name +"\r\n"+cityBuildings.TurnsToBuilding(building.name)+" turns", skin);
|
||||
TB.addListener(new ClickListener(){
|
||||
@Override
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
selectedBuilding = building;
|
||||
rightSideButton.setTouchable(Touchable.enabled);
|
||||
rightSideButton.setText("Build "+building.Name);
|
||||
rightSideButton.setText("Build "+building.name);
|
||||
rightSideButton.setColor(Color.WHITE);
|
||||
descriptionLabel.setText(building.GetDescription());
|
||||
descriptionLabel.setText(building.getDescription());
|
||||
}
|
||||
});
|
||||
topTable.add(TB).pad(10);
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.unciv.game.pickerscreens;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||
import com.badlogic.gdx.scenes.scene2d.Touchable;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
||||
@ -34,16 +33,16 @@ public class ImprovementPickerScreen extends PickerScreen {
|
||||
VerticalGroup regularImprovements = new VerticalGroup();
|
||||
regularImprovements.space(10);
|
||||
for(final TileImprovement improvement : GameBasics.TileImprovements.values()) {
|
||||
if(!tileInfo.canBuildImprovement(improvement) || improvement.Name.equals(tileInfo.improvement)) continue;
|
||||
TextButton TB = new TextButton(improvement.Name+"\r\n"+improvement.TurnsToBuild+" turns", skin);
|
||||
if(!tileInfo.canBuildImprovement(improvement) || improvement.name.equals(tileInfo.improvement)) continue;
|
||||
TextButton TB = new TextButton(improvement.name +"\r\n"+improvement.turnsToBuild +" turns", skin);
|
||||
TB.addListener(new ClickListener(){
|
||||
@Override
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
SelectedImprovement = improvement;
|
||||
rightSideButton.setTouchable(Touchable.enabled);
|
||||
rightSideButton.setText("Construct "+improvement.Name);
|
||||
rightSideButton.setText("Construct "+improvement.name);
|
||||
rightSideButton.setColor(Color.WHITE);
|
||||
descriptionLabel.setText(improvement.GetDescription());
|
||||
descriptionLabel.setText(improvement.getDescription());
|
||||
}
|
||||
});
|
||||
regularImprovements.addActor(TB);
|
||||
|
@ -36,13 +36,13 @@ public class TechPickerScreen extends PickerScreen {
|
||||
|
||||
if (SelectedTech != null) {
|
||||
Technology thisTech = GameBasics.Technologies.get(techName);
|
||||
if (techName.equals(SelectedTech.Name)) {
|
||||
if (techName.equals(SelectedTech.name)) {
|
||||
TB.setChecked(true);
|
||||
TB.setColor(TB.getColor().lerp(Color.LIGHT_GRAY, 0.5f));
|
||||
}
|
||||
|
||||
if (thisTech.Prerequisites.contains(SelectedTech.Name)) TB.setText("*" + techName);
|
||||
else if (SelectedTech.Prerequisites.contains(techName)) TB.setText(techName + "*");
|
||||
if (thisTech.prerequisites.contains(SelectedTech.name)) TB.setText("*" + techName);
|
||||
else if (SelectedTech.prerequisites.contains(techName)) TB.setText(techName + "*");
|
||||
}
|
||||
if (TechsToResearch.contains(techName)) {
|
||||
TB.setText(TB.getText() + " (" + TechsToResearch.indexOf(techName) + ")");
|
||||
@ -54,9 +54,9 @@ public class TechPickerScreen extends PickerScreen {
|
||||
|
||||
public void selectTechnology(Technology tech) {
|
||||
SelectedTech = tech;
|
||||
descriptionLabel.setText(tech.Description);
|
||||
descriptionLabel.setText(tech.description);
|
||||
|
||||
if (civTech.IsResearched(tech.Name)) {
|
||||
if (civTech.IsResearched(tech.name)) {
|
||||
rightSideButton.setText("Research");
|
||||
rightSideButton.setTouchable(Touchable.disabled);
|
||||
rightSideButton.setColor(Color.GRAY);
|
||||
@ -67,19 +67,19 @@ public class TechPickerScreen extends PickerScreen {
|
||||
rightSideButton.setTouchable(Touchable.enabled);
|
||||
rightSideButton.setColor(Color.WHITE);
|
||||
|
||||
if (civTech.CanBeResearched(tech.Name)) {
|
||||
if (civTech.CanBeResearched(tech.name)) {
|
||||
TechsToResearch.clear();
|
||||
TechsToResearch.add(tech.Name);
|
||||
TechsToResearch.add(tech.name);
|
||||
} else {
|
||||
Stack<String> Prerequisites = new Stack<String>();
|
||||
ArrayDeque<String> CheckPrerequisites = new ArrayDeque<String>();
|
||||
CheckPrerequisites.add(tech.Name);
|
||||
CheckPrerequisites.add(tech.name);
|
||||
while (!CheckPrerequisites.isEmpty()) {
|
||||
String techNameToCheck = CheckPrerequisites.pop();
|
||||
if (civTech.IsResearched(techNameToCheck))
|
||||
continue; //no need to add or check prerequisites
|
||||
Technology techToCheck = GameBasics.Technologies.get(techNameToCheck);
|
||||
for (String str : techToCheck.Prerequisites)
|
||||
for (String str : techToCheck.prerequisites)
|
||||
if (!CheckPrerequisites.contains(str)) CheckPrerequisites.add(str);
|
||||
Prerequisites.add(techNameToCheck);
|
||||
}
|
||||
@ -100,7 +100,7 @@ public class TechPickerScreen extends PickerScreen {
|
||||
}
|
||||
|
||||
for (Technology technology : GameBasics.Technologies.linqValues()) {
|
||||
techMatrix[technology.Column.ColumnNumber][technology.Row - 1] = technology;
|
||||
techMatrix[technology.column.columnNumber][technology.row - 1] = technology;
|
||||
}
|
||||
|
||||
// Table topTable = new Table();
|
||||
@ -112,7 +112,7 @@ public class TechPickerScreen extends PickerScreen {
|
||||
if (tech == null) topTable.add(); // empty cell
|
||||
else {
|
||||
final TextButton TB = new TextButton("", skin);
|
||||
techNameToButton.put(tech.Name, TB);
|
||||
techNameToButton.put(tech.name, TB);
|
||||
TB.addListener(new ClickListener() {
|
||||
@Override
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
|
@ -3,10 +3,10 @@ package com.unciv.models.gamebasics;
|
||||
import com.unciv.models.stats.NamedStats;
|
||||
|
||||
public class BasicHelp extends NamedStats implements ICivilopedia {
|
||||
public String Description;
|
||||
public String description;
|
||||
|
||||
@Override
|
||||
public String GetDescription() {
|
||||
return Description;
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
}
|
||||
|
@ -1,37 +1,34 @@
|
||||
package com.unciv.models.gamebasics;
|
||||
|
||||
import com.unciv.models.LinqHashMap;
|
||||
import com.unciv.models.stats.FullStats;
|
||||
import com.unciv.models.stats.NamedStats;
|
||||
|
||||
import java.util.Dictionary;
|
||||
|
||||
public class Building extends NamedStats implements ICivilopedia {
|
||||
public String Description;
|
||||
public String RequiredTech;
|
||||
public Technology GetRequiredTech(){return GameBasics.Technologies.get(RequiredTech);}
|
||||
public int Cost;
|
||||
public int Maintainance = 0;
|
||||
public FullStats PercentStatBonus = new FullStats();
|
||||
public String description;
|
||||
public String requiredTech;
|
||||
public Technology GetRequiredTech(){return GameBasics.Technologies.get(requiredTech);}
|
||||
public int cost;
|
||||
public int maintainance = 0;
|
||||
public FullStats percentStatBonus = new FullStats();
|
||||
//public Func<CityInfo,FullStats> GetFlatBonusStats;
|
||||
public boolean IsWonder = false;
|
||||
public boolean ResourceRequired = false;
|
||||
public String RequiredBuilding;
|
||||
public String RequiredBuildingInAllCities;
|
||||
public boolean isWonder = false;
|
||||
public boolean resourceRequired = false;
|
||||
public String requiredBuilding;
|
||||
public String requiredBuildingInAllCities;
|
||||
|
||||
// Uniques
|
||||
public String ProvidesFreeBuilding;
|
||||
public int FreeTechs;
|
||||
public int NewTileCostReduction;
|
||||
public String providesFreeBuilding;
|
||||
public int freeTechs;
|
||||
public int newTileCostReduction;
|
||||
|
||||
/** The bonus stats that a resource gets when this building is built */
|
||||
public FullStats ResourceBonusStats;
|
||||
public FullStats resourceBonusStats;
|
||||
|
||||
public String GetDescription() {
|
||||
public String getDescription() {
|
||||
FullStats stats = new FullStats(this);
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
if(IsWonder) stringBuilder.append("Wonder\r\n");
|
||||
stringBuilder.append(Description + "\r\n" + stats);
|
||||
if(isWonder) stringBuilder.append("Wonder\r\n");
|
||||
stringBuilder.append(description + "\r\n" + stats);
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
}
|
||||
|
@ -5,5 +5,5 @@ package com.unciv.models.gamebasics;
|
||||
*/
|
||||
|
||||
public interface ICivilopedia {
|
||||
public String GetDescription();
|
||||
public String getDescription();
|
||||
}
|
||||
|
@ -4,10 +4,10 @@ import java.util.ArrayList;
|
||||
|
||||
public class TechColumn
|
||||
{
|
||||
public int ColumnNumber;
|
||||
public int columnNumber;
|
||||
public GameBasics gameBasics;
|
||||
public ArrayList<Technology> Techs = new ArrayList<Technology>();
|
||||
public int TechCost;
|
||||
public int BuildingCost;
|
||||
public int WonderCost;
|
||||
public ArrayList<Technology> techs = new ArrayList<Technology>();
|
||||
public int techCost;
|
||||
public int buildingCost;
|
||||
public int wonderCost;
|
||||
}
|
||||
|
@ -4,12 +4,12 @@ import java.util.ArrayList;
|
||||
|
||||
public class Technology
|
||||
{
|
||||
public String Name;
|
||||
public String name;
|
||||
|
||||
public String Description;
|
||||
public int Cost;
|
||||
public ArrayList<String> Prerequisites = new ArrayList<String>();
|
||||
public String description;
|
||||
public int cost;
|
||||
public ArrayList<String> prerequisites = new ArrayList<String>();
|
||||
|
||||
public TechColumn Column; // The column that this tech is in the tech tree
|
||||
public int Row;
|
||||
public TechColumn column; // The column that this tech is in the tech tree
|
||||
public int row;
|
||||
}
|
@ -6,47 +6,35 @@ import com.unciv.models.stats.NamedStats;
|
||||
import java.util.Collection;
|
||||
|
||||
public class Terrain extends NamedStats implements ICivilopedia {
|
||||
public String Type; // baseTerrain or terrainFeature
|
||||
public TerrainType type; // BaseTerrain or TerrainFeature
|
||||
|
||||
/// <summary>
|
||||
/// For base terrain - comma-delimited 256 RGB values, e.g. "116,88,62"
|
||||
/// </summary>
|
||||
public String RGB;
|
||||
//
|
||||
//public Color Color
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// var rgbStringValues = RGB.Split(',');
|
||||
// var rgbs = rgbStringValues.Select(x => int.Parse(x)).ToArray();
|
||||
// return Extensions.ColorFrom256RGB(rgbs[0], rgbs[1], rgbs[2]);
|
||||
// }
|
||||
// }
|
||||
public boolean overrideStats = false;
|
||||
|
||||
public boolean OverrideStats = false;
|
||||
/***
|
||||
* If true, other terrain layers can come over this one. For mountains, lakes etc. this is false
|
||||
*/
|
||||
|
||||
/// <summary>
|
||||
/// If true, other terrain layers can come over this one. For mountains, lakes etc. this is false
|
||||
/// </summary>
|
||||
public boolean CanHaveOverlay = true;
|
||||
public boolean canHaveOverlay = true;
|
||||
|
||||
/// <summary>
|
||||
/// If true, nothing can be built here - not even resource improvements
|
||||
/// </summary>
|
||||
public boolean Unbuildable = false;
|
||||
/***
|
||||
*If true, nothing can be built here - not even resource improvements
|
||||
*/
|
||||
public boolean unbuildable = false;
|
||||
|
||||
/// <summary>
|
||||
/// For terrain features
|
||||
/// </summary>
|
||||
public Collection<String> OccursOn;
|
||||
/***
|
||||
* For terrain features
|
||||
*/
|
||||
public Collection<String> occursOn;
|
||||
|
||||
/// <summary>
|
||||
/// For terrain features - which technology alllows removal of this feature
|
||||
/// </summary>
|
||||
public String RemovalTech;
|
||||
/***
|
||||
*For terrain features - which technology alllows removal of this feature
|
||||
*/
|
||||
public String removalTech;
|
||||
|
||||
public String rgb;
|
||||
|
||||
@Override
|
||||
public String GetDescription() {
|
||||
public String getDescription() {
|
||||
return ""+new FullStats(this);
|
||||
}
|
||||
}
|
||||
|
6
core/src/com/unciv/models/gamebasics/TerrainType.java
Normal file
6
core/src/com/unciv/models/gamebasics/TerrainType.java
Normal file
@ -0,0 +1,6 @@
|
||||
package com.unciv.models.gamebasics;
|
||||
|
||||
public enum TerrainType{
|
||||
BaseTerrain,
|
||||
TerrainFeature
|
||||
}
|
@ -8,33 +8,33 @@ import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class TileImprovement extends NamedStats implements ICivilopedia {
|
||||
public Collection<String> TerrainsCanBeBuiltOn = new ArrayList<String>();
|
||||
public String TechRequired;
|
||||
public Collection<String> terrainsCanBeBuiltOn = new ArrayList<String>();
|
||||
public String techRequired;
|
||||
|
||||
public String ImprovingTech;
|
||||
public FullStats ImprovingTechStats;
|
||||
public String improvingTech;
|
||||
public FullStats improvingTechStats;
|
||||
|
||||
public int TurnsToBuild;
|
||||
public int turnsToBuild;
|
||||
|
||||
@Override
|
||||
public String GetDescription() {
|
||||
public String getDescription() {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
if(!new FullStats(this).toString().isEmpty()) stringBuilder.append(new FullStats(this)+"\r\n");
|
||||
if(!TerrainsCanBeBuiltOn.isEmpty()) stringBuilder.append("Can be built on " + StringUtils.join(", ", TerrainsCanBeBuiltOn));
|
||||
if(!terrainsCanBeBuiltOn.isEmpty()) stringBuilder.append("Can be built on " + StringUtils.join(", ", terrainsCanBeBuiltOn));
|
||||
|
||||
HashMap<String,ArrayList<String>> statsToResourceNames = new HashMap<String, ArrayList<String>>();
|
||||
for(TileResource tr : GameBasics.TileResources.values()){
|
||||
if(!tr.Improvement.equals(Name)) continue;
|
||||
String statsString = tr.ImprovementStats.toString();
|
||||
if(!tr.improvement.equals(name)) continue;
|
||||
String statsString = tr.improvementStats.toString();
|
||||
if(!statsToResourceNames.containsKey(statsString))
|
||||
statsToResourceNames.put(statsString,new ArrayList<String>());
|
||||
statsToResourceNames.get(statsString).add(tr.Name);
|
||||
statsToResourceNames.get(statsString).add(tr.name);
|
||||
}
|
||||
for(String statsString : statsToResourceNames.keySet()){
|
||||
stringBuilder.append("\r\n"+statsString+" for "+ StringUtils.join(", ",statsToResourceNames.get(statsString)));
|
||||
}
|
||||
|
||||
if(TechRequired!=null) stringBuilder.append("\r\ntech required: "+TechRequired);
|
||||
if(techRequired !=null) stringBuilder.append("\r\ntech required: "+ techRequired);
|
||||
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
|
@ -6,26 +6,26 @@ import com.unciv.models.stats.FullStats;
|
||||
import java.util.Collection;
|
||||
|
||||
public class TileResource extends NamedStats implements ICivilopedia {
|
||||
public ResourceType ResourceType;
|
||||
public Collection<String> TerrainsCanBeFoundOn;
|
||||
public String Improvement;
|
||||
public FullStats ImprovementStats;
|
||||
public ResourceType resourceType;
|
||||
public Collection<String> terrainsCanBeFoundOn;
|
||||
public String improvement;
|
||||
public FullStats improvementStats;
|
||||
|
||||
/// <summary>
|
||||
/// The building that improves this resource, if any. E.G.: Granary for wheat, Stable for cattle.
|
||||
/// </summary>
|
||||
public String Building;
|
||||
public com.unciv.models.gamebasics.Building GetBuilding(){return Building==null ? null : GameBasics.Buildings.get(Building);}
|
||||
public String building;
|
||||
public Building GetBuilding(){return building ==null ? null : GameBasics.Buildings.get(building);}
|
||||
|
||||
public String RevealedBy;
|
||||
public String revealedBy;
|
||||
|
||||
@Override
|
||||
public String GetDescription() {
|
||||
public String getDescription() {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append(new FullStats(this)+"\r\n");
|
||||
stringBuilder.append("Can be found on " + com.unciv.models.gamebasics.StringUtils.join(", ",TerrainsCanBeFoundOn));
|
||||
stringBuilder.append("\r\n\r\nImproved by "+Improvement+"\r\n");
|
||||
stringBuilder.append("\r\nBonus stats for improvement: "+ImprovementStats+"\r\n");
|
||||
stringBuilder.append("Can be found on " + com.unciv.models.gamebasics.StringUtils.join(", ", terrainsCanBeFoundOn));
|
||||
stringBuilder.append("\r\n\r\nImproved by "+ improvement +"\r\n");
|
||||
stringBuilder.append("\r\nBonus stats for improvement: "+ improvementStats +"\r\n");
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
package com.unciv.models.stats;
|
||||
|
||||
public class CivStats {
|
||||
public int Gold = 0;
|
||||
public int Science = 0;
|
||||
public int Culture = 0;
|
||||
public int Happiness = 0;
|
||||
public int gold = 0;
|
||||
public int science = 0;
|
||||
public int culture = 0;
|
||||
public int happiness = 0;
|
||||
|
||||
public void add(CivStats other) {
|
||||
Gold += other.Gold;
|
||||
Science += other.Science;
|
||||
Happiness += other.Happiness;
|
||||
Culture += other.Culture;
|
||||
gold += other.gold;
|
||||
science += other.science;
|
||||
happiness += other.happiness;
|
||||
culture += other.culture;
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,8 @@ package com.unciv.models.stats;
|
||||
|
||||
public class FullStats extends CivStats // also used for hex stats, since it's basically the same
|
||||
{
|
||||
public int Production = 0;
|
||||
public int Food = 0;
|
||||
public int production = 0;
|
||||
public int food = 0;
|
||||
|
||||
public FullStats() {
|
||||
}
|
||||
@ -13,12 +13,12 @@ public class FullStats extends CivStats // also used for hex stats, since it's b
|
||||
}
|
||||
|
||||
public void add(FullStats other){
|
||||
Gold+=other.Gold;
|
||||
Science+=other.Science;
|
||||
Happiness+=other.Happiness;
|
||||
Culture+=other.Culture;
|
||||
Food+=other.Food;
|
||||
Production+=other.Production;
|
||||
gold +=other.gold;
|
||||
science +=other.science;
|
||||
happiness +=other.happiness;
|
||||
culture +=other.culture;
|
||||
food +=other.food;
|
||||
production +=other.production;
|
||||
}
|
||||
|
||||
public String display(int value, String name){
|
||||
@ -27,12 +27,12 @@ public class FullStats extends CivStats // also used for hex stats, since it's b
|
||||
|
||||
public String toString() {
|
||||
StringBuilder valuableParts = new StringBuilder();
|
||||
if (Production != 0) valuableParts.append(display(Production,"Production"));
|
||||
if (Food != 0) valuableParts.append(display(Food,"Food"));
|
||||
if (Gold != 0) valuableParts.append(display(Gold,"Gold"));
|
||||
if (Science != 0) valuableParts.append(display(Science,"Science"));
|
||||
if (Happiness != 0) valuableParts.append(display(Happiness,"Happpiness"));
|
||||
if (Culture != 0) valuableParts.append(display(Culture,"Culture"));
|
||||
if (production != 0) valuableParts.append(display(production,"production"));
|
||||
if (food != 0) valuableParts.append(display(food,"food"));
|
||||
if (gold != 0) valuableParts.append(display(gold,"gold"));
|
||||
if (science != 0) valuableParts.append(display(science,"science"));
|
||||
if (happiness != 0) valuableParts.append(display(happiness,"Happpiness"));
|
||||
if (culture != 0) valuableParts.append(display(culture,"culture"));
|
||||
if (valuableParts.length() == 0) return "";
|
||||
valuableParts.delete(0,1);
|
||||
return valuableParts.toString();
|
||||
|
@ -1,13 +1,13 @@
|
||||
package com.unciv.models.stats;
|
||||
|
||||
public class NamedStats extends FullStats {
|
||||
public String Name;
|
||||
public String name;
|
||||
|
||||
public String GetName() {
|
||||
return Name;
|
||||
return name;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return Name;
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user