mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-12 08:49:22 +07:00
Organized unique wonder abilities by adding "unique" string to building
Added Machu Pichu, Angkor Wat and Aqueduct unique abilities Expanded civilopidia entry for buildings Merged CityPopulation into CityInfo because the division was arbitrary
This commit is contained in:
@ -21,7 +21,7 @@ android {
|
|||||||
applicationId "com.unciv.game"
|
applicationId "com.unciv.game"
|
||||||
minSdkVersion 9
|
minSdkVersion 9
|
||||||
targetSdkVersion 25
|
targetSdkVersion 25
|
||||||
versionCode 5
|
versionCode 6
|
||||||
versionName "0.9"
|
versionName "0.9"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
@ -45,6 +45,7 @@ public class CityInfo {
|
|||||||
// (per game XML files) at 6*(t+0.4813)^1.3
|
// (per game XML files) at 6*(t+0.4813)^1.3
|
||||||
// The second seems to be more based, so I'll go with that
|
// The second seems to be more based, so I'll go with that
|
||||||
double a = 6*Math.pow(tilesClaimed+1.4813,1.3);
|
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);
|
return (int)Math.round(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,9 +108,12 @@ public class CityInfo {
|
|||||||
stats.production += getFreePopulation();
|
stats.production += getFreePopulation();
|
||||||
stats.food -= cityPopulation.Population * 2;
|
stats.food -= cityPopulation.Population * 2;
|
||||||
|
|
||||||
if(!isCapital() && isConnectedToCapital()) // Calculated by http://civilization.wikia.com/wiki/Trade_route_(Civ5)
|
if(!isCapital() && isConnectedToCapital()) { // Calculated by http://civilization.wikia.com/wiki/Trade_route_(Civ5)
|
||||||
stats.gold+= CivilizationInfo.current().getCapital().cityPopulation.Population * 0.15
|
double goldFromTradeRoute = CivilizationInfo.current().getCapital().cityPopulation.Population * 0.15
|
||||||
+ cityPopulation.Population * 1.1 - 1;
|
+ cityPopulation.Population * 1.1 - 1;
|
||||||
|
if(CivilizationInfo.current().getCivTags().contains("TradeRouteGoldIncrease")) goldFromTradeRoute*=1.25; // Machu Pichu speciality
|
||||||
|
stats.gold += goldFromTradeRoute;
|
||||||
|
}
|
||||||
|
|
||||||
stats.add(cityBuildings.getStats());
|
stats.add(cityBuildings.getStats());
|
||||||
|
|
||||||
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -4,16 +4,18 @@ import com.badlogic.gdx.math.Vector2;
|
|||||||
import com.badlogic.gdx.utils.Predicate;
|
import com.badlogic.gdx.utils.Predicate;
|
||||||
import com.unciv.game.UnCivGame;
|
import com.unciv.game.UnCivGame;
|
||||||
import com.unciv.models.LinqCollection;
|
import com.unciv.models.LinqCollection;
|
||||||
|
import com.unciv.models.gamebasics.Building;
|
||||||
import com.unciv.models.gamebasics.GameBasics;
|
import com.unciv.models.gamebasics.GameBasics;
|
||||||
import com.unciv.models.stats.CivStats;
|
import com.unciv.models.stats.CivStats;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by LENOVO on 10/18/2017.
|
* Created by LENOVO on 10/18/2017.
|
||||||
*/
|
*/
|
||||||
public class CivilizationInfo {
|
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 CivStats civStats = new CivStats();
|
||||||
public int baseHappiness = 15;
|
public int baseHappiness = 15;
|
||||||
@ -79,5 +81,19 @@ public class CivilizationInfo {
|
|||||||
|
|
||||||
return statsForTurn;
|
return statsForTurn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LinqCollection<String> getCivTags(){
|
||||||
|
return cities.selectMany(new LinqCollection.Func<CityInfo, Collection<? extends String>>() {
|
||||||
|
@Override
|
||||||
|
public Collection<? extends String> GetBy(CityInfo arg0) {
|
||||||
|
return arg0.cityBuildings.getBuiltBuildings().select(new LinqCollection.Func<Building, String>() {
|
||||||
|
@Override
|
||||||
|
public String GetBy(Building arg0) {
|
||||||
|
return arg0.unique;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ public class WorldScreen extends CameraStageBaseScreen {
|
|||||||
LinqHashMap<TileInfo, Float> distanceToTiles = game.civInfo.tileMap.getDistanceToTiles(unitTile.position,unitTile.unit.CurrentMovement);
|
LinqHashMap<TileInfo, Float> distanceToTiles = game.civInfo.tileMap.getDistanceToTiles(unitTile.position,unitTile.unit.CurrentMovement);
|
||||||
if(distanceToTiles.containsKey(selectedTile)) {
|
if(distanceToTiles.containsKey(selectedTile)) {
|
||||||
unitTile.unit.CurrentMovement -= distanceToTiles.get(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"
|
if(unitTile.unit.CurrentMovement < 0.1) unitTile.unit.CurrentMovement=0; // silly floats which are "almost zero"
|
||||||
group.tileInfo.unit = unitTile.unit;
|
group.tileInfo.unit = unitTile.unit;
|
||||||
unitTile.unit = null;
|
unitTile.unit = null;
|
||||||
|
@ -107,7 +107,7 @@ public class TechPickerScreen extends PickerScreen {
|
|||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
topTable.row().pad(5);
|
topTable.row().pad(5);
|
||||||
|
|
||||||
for (int j = 0; j < 6; j++) {
|
for (int j = 0; j < 8; j++) {
|
||||||
final Technology tech = techMatrix[j][i];
|
final Technology tech = techMatrix[j][i];
|
||||||
if (tech == null) topTable.add(); // empty cell
|
if (tech == null) topTable.add(); // empty cell
|
||||||
else {
|
else {
|
||||||
|
@ -41,6 +41,12 @@ public class LinqCollection <T> extends ArrayList<T> {
|
|||||||
return newCollection;
|
return newCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public <T2> LinqCollection<T2> selectMany(Func<T,Collection<? extends T2>> multiSelector){
|
||||||
|
LinqCollection<T2> newCollection = new LinqCollection<T2>();
|
||||||
|
for(T t:this) newCollection.addAll(multiSelector.GetBy(t));
|
||||||
|
return newCollection;
|
||||||
|
}
|
||||||
|
|
||||||
public T getRandom(){
|
public T getRandom(){
|
||||||
if(size()==0) return null;
|
if(size()==0) return null;
|
||||||
return get((int) (Math.random() * (size())));
|
return get((int) (Math.random() * (size())));
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.unciv.models.gamebasics;
|
package com.unciv.models.gamebasics;
|
||||||
|
|
||||||
|
import com.unciv.models.LinqCollection;
|
||||||
import com.unciv.models.stats.FullStats;
|
import com.unciv.models.stats.FullStats;
|
||||||
import com.unciv.models.stats.NamedStats;
|
import com.unciv.models.stats.NamedStats;
|
||||||
|
|
||||||
@ -19,17 +20,23 @@ public class Building extends NamedStats implements ICivilopedia {
|
|||||||
// Uniques
|
// Uniques
|
||||||
public String providesFreeBuilding;
|
public String providesFreeBuilding;
|
||||||
public int freeTechs;
|
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 */
|
/** 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);
|
FullStats stats = new FullStats(this);
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
if(isWonder) stringBuilder.append("Wonder\r\n");
|
stringBuilder.append("Cost: "+cost+"\r\n");
|
||||||
stringBuilder.append(description + "\r\n" + stats);
|
if (isWonder) stringBuilder.append("Wonder\r\n");
|
||||||
return stringBuilder.toString();
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ public class TileImprovement extends NamedStats implements ICivilopedia {
|
|||||||
stringBuilder.append("\r\n"+statsString+" for "+ StringUtils.join(", ",statsToResourceNames.get(statsString)));
|
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();
|
return stringBuilder.toString();
|
||||||
}
|
}
|
||||||
|
@ -29,12 +29,12 @@ public class FullStats extends CivStats // also used for hex stats, since it's b
|
|||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder valuableParts = new StringBuilder();
|
StringBuilder valuableParts = new StringBuilder();
|
||||||
if (production != 0) valuableParts.append(display(production,"production"));
|
if (production != 0) valuableParts.append(display(production,"Production"));
|
||||||
if (food != 0) valuableParts.append(display(food,"food"));
|
if (food != 0) valuableParts.append(display(food,"Food"));
|
||||||
if (gold != 0) valuableParts.append(display(gold,"gold"));
|
if (gold != 0) valuableParts.append(display(gold,"Gold"));
|
||||||
if (science != 0) valuableParts.append(display(science,"science"));
|
if (science != 0) valuableParts.append(display(science,"Science"));
|
||||||
if (happiness != 0) valuableParts.append(display(happiness,"Happpiness"));
|
if (happiness != 0) valuableParts.append(display(happiness,"Happiness"));
|
||||||
if (culture != 0) valuableParts.append(display(culture,"culture"));
|
if (culture != 0) valuableParts.append(display(culture,"Culture"));
|
||||||
if (valuableParts.length() == 0) return "";
|
if (valuableParts.length() == 0) return "";
|
||||||
valuableParts.delete(0,1);
|
valuableParts.delete(0,1);
|
||||||
return valuableParts.toString();
|
return valuableParts.toString();
|
||||||
|
Reference in New Issue
Block a user