diff --git a/android/build.gradle b/android/build.gradle index a080e2ae19..e33b8672fb 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -21,7 +21,7 @@ android { applicationId "com.unciv.game" minSdkVersion 9 targetSdkVersion 25 - versionCode 5 + versionCode 6 versionName "0.9" } buildTypes { diff --git a/core/src/com/unciv/civinfo/CityInfo.java b/core/src/com/unciv/civinfo/CityInfo.java index e926ddefc9..68923aebb6 100644 --- a/core/src/com/unciv/civinfo/CityInfo.java +++ b/core/src/com/unciv/civinfo/CityInfo.java @@ -45,6 +45,7 @@ public class CityInfo { // (per game XML files) at 6*(t+0.4813)^1.3 // The second seems to be more based, so I'll go with that double a = 6*Math.pow(tilesClaimed+1.4813,1.3); + if(CivilizationInfo.current().getCivTags().contains("NewTileCostReduction")) a *= 0.75; //Speciality of Angkor Wat return (int)Math.round(a); } @@ -107,9 +108,12 @@ public class CityInfo { stats.production += getFreePopulation(); stats.food -= cityPopulation.Population * 2; - if(!isCapital() && isConnectedToCapital()) // Calculated by http://civilization.wikia.com/wiki/Trade_route_(Civ5) - stats.gold+= CivilizationInfo.current().getCapital().cityPopulation.Population * 0.15 + if(!isCapital() && isConnectedToCapital()) { // Calculated by http://civilization.wikia.com/wiki/Trade_route_(Civ5) + double goldFromTradeRoute = CivilizationInfo.current().getCapital().cityPopulation.Population * 0.15 + cityPopulation.Population * 1.1 - 1; + if(CivilizationInfo.current().getCivTags().contains("TradeRouteGoldIncrease")) goldFromTradeRoute*=1.25; // Machu Pichu speciality + stats.gold += goldFromTradeRoute; + } stats.add(cityBuildings.getStats()); diff --git a/core/src/com/unciv/civinfo/CityPopulation.java b/core/src/com/unciv/civinfo/CityPopulation.java deleted file mode 100644 index 4f8e8ab3c3..0000000000 --- a/core/src/com/unciv/civinfo/CityPopulation.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.unciv.civinfo; - -public class CityPopulation -{ - public int Population = 1; - public int FoodStored = 0; - public int FoodToNextPopulation() - { - // civ v math,civilization.wikia - return 15 + 6 * (Population - 1) + (int)Math.floor(Math.pow(Population - 1, 1.8f)); - - } - - /** - * @param FoodProduced - * @return whether a growth occured - */ - public boolean NextTurn(int FoodProduced) - { - FoodStored += FoodProduced; - if (FoodStored < 0) // starvation! - { - Population--; - FoodStored = 0; - } - if (FoodStored >= FoodToNextPopulation()) // growth! - { - FoodStored -= FoodToNextPopulation(); - Population++; - return true; - } - return false; - } -} diff --git a/core/src/com/unciv/civinfo/CivilizationInfo.java b/core/src/com/unciv/civinfo/CivilizationInfo.java index 9a2b7be144..a9b494be7b 100644 --- a/core/src/com/unciv/civinfo/CivilizationInfo.java +++ b/core/src/com/unciv/civinfo/CivilizationInfo.java @@ -4,16 +4,18 @@ import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Predicate; import com.unciv.game.UnCivGame; import com.unciv.models.LinqCollection; +import com.unciv.models.gamebasics.Building; import com.unciv.models.gamebasics.GameBasics; import com.unciv.models.stats.CivStats; +import java.util.Collection; import java.util.HashSet; /** * Created by LENOVO on 10/18/2017. */ public class CivilizationInfo { - public static CivilizationInfo current(){return UnCivGame.Current.civInfo; } + public static CivilizationInfo current(){ return UnCivGame.Current.civInfo; } public CivStats civStats = new CivStats(); public int baseHappiness = 15; @@ -79,5 +81,19 @@ public class CivilizationInfo { return statsForTurn; } + + public LinqCollection getCivTags(){ + return cities.selectMany(new LinqCollection.Func>() { + @Override + public Collection GetBy(CityInfo arg0) { + return arg0.cityBuildings.getBuiltBuildings().select(new LinqCollection.Func() { + @Override + public String GetBy(Building arg0) { + return arg0.unique; + } + }); + } + }); + } } diff --git a/core/src/com/unciv/game/WorldScreen.java b/core/src/com/unciv/game/WorldScreen.java index 99c96225a3..757f8ca37b 100644 --- a/core/src/com/unciv/game/WorldScreen.java +++ b/core/src/com/unciv/game/WorldScreen.java @@ -217,7 +217,7 @@ public class WorldScreen extends CameraStageBaseScreen { LinqHashMap distanceToTiles = game.civInfo.tileMap.getDistanceToTiles(unitTile.position,unitTile.unit.CurrentMovement); if(distanceToTiles.containsKey(selectedTile)) { unitTile.unit.CurrentMovement -= distanceToTiles.get(selectedTile); - unitTile.unit.CurrentMovement = round(unitTile.unit.CurrentMovement,3); + //unitTile.unit.CurrentMovement = round(unitTile.unit.CurrentMovement,3); if(unitTile.unit.CurrentMovement < 0.1) unitTile.unit.CurrentMovement=0; // silly floats which are "almost zero" group.tileInfo.unit = unitTile.unit; unitTile.unit = null; diff --git a/core/src/com/unciv/game/pickerscreens/TechPickerScreen.java b/core/src/com/unciv/game/pickerscreens/TechPickerScreen.java index bc5ed9e4e4..8ad2042ea3 100644 --- a/core/src/com/unciv/game/pickerscreens/TechPickerScreen.java +++ b/core/src/com/unciv/game/pickerscreens/TechPickerScreen.java @@ -107,7 +107,7 @@ public class TechPickerScreen extends PickerScreen { for (int i = 0; i < 10; i++) { topTable.row().pad(5); - for (int j = 0; j < 6; j++) { + for (int j = 0; j < 8; j++) { final Technology tech = techMatrix[j][i]; if (tech == null) topTable.add(); // empty cell else { diff --git a/core/src/com/unciv/models/LinqCollection.java b/core/src/com/unciv/models/LinqCollection.java index f5ebf05723..ea16dc0914 100644 --- a/core/src/com/unciv/models/LinqCollection.java +++ b/core/src/com/unciv/models/LinqCollection.java @@ -41,6 +41,12 @@ public class LinqCollection extends ArrayList { return newCollection; } + public LinqCollection selectMany(Func> multiSelector){ + LinqCollection newCollection = new LinqCollection(); + for(T t:this) newCollection.addAll(multiSelector.GetBy(t)); + return newCollection; + } + public T getRandom(){ if(size()==0) return null; return get((int) (Math.random() * (size()))); diff --git a/core/src/com/unciv/models/gamebasics/Building.java b/core/src/com/unciv/models/gamebasics/Building.java index cf865a1c55..22c3e78c73 100644 --- a/core/src/com/unciv/models/gamebasics/Building.java +++ b/core/src/com/unciv/models/gamebasics/Building.java @@ -1,5 +1,6 @@ package com.unciv.models.gamebasics; +import com.unciv.models.LinqCollection; import com.unciv.models.stats.FullStats; import com.unciv.models.stats.NamedStats; @@ -19,17 +20,23 @@ public class Building extends NamedStats implements ICivilopedia { // Uniques public String providesFreeBuilding; public int freeTechs; - public int newTileCostReduction; + public String unique; // for wonders which have individual functions that are totally unique /** The bonus stats that a resource gets when this building is built */ public FullStats resourceBonusStats; 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); - return stringBuilder.toString(); + FullStats stats = new FullStats(this); + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append("Cost: "+cost+"\r\n"); + if (isWonder) stringBuilder.append("Wonder\r\n"); + if (requiredTech != null) stringBuilder.append("Requires "+requiredTech+" to be researched\r\n"); + if (requiredBuilding != null) stringBuilder.append("Requires a "+requiredBuilding+" to be built in this city\r\n"); + if (requiredBuildingInAllCities != null) stringBuilder.append("Requires a "+requiredBuildingInAllCities+" to be built in all cities\r\n"); + if(providesFreeBuilding!=null) stringBuilder.append("Provides a free "+providesFreeBuilding+" in this city\r\n"); + if(maintainance!=0) stringBuilder.append("Maintainance cost: "+maintainance+" gold\r\n"); + stringBuilder.append(description + "\r\n" + stats); + return stringBuilder.toString(); } } diff --git a/core/src/com/unciv/models/gamebasics/TileImprovement.java b/core/src/com/unciv/models/gamebasics/TileImprovement.java index 67f631d7cd..fdec98e0eb 100644 --- a/core/src/com/unciv/models/gamebasics/TileImprovement.java +++ b/core/src/com/unciv/models/gamebasics/TileImprovement.java @@ -34,7 +34,7 @@ public class TileImprovement extends NamedStats implements ICivilopedia { 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(); } diff --git a/core/src/com/unciv/models/stats/FullStats.java b/core/src/com/unciv/models/stats/FullStats.java index a861b52956..a5d6e37ebd 100644 --- a/core/src/com/unciv/models/stats/FullStats.java +++ b/core/src/com/unciv/models/stats/FullStats.java @@ -29,12 +29,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,"Happiness")); + if (culture != 0) valuableParts.append(display(culture,"Culture")); if (valuableParts.length() == 0) return ""; valuableParts.delete(0,1); return valuableParts.toString();