mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-07 14:02:48 +07:00
Great Person Points added to wonder description
Fixed bug where university science percent would keep rising Specialists are now per-building
This commit is contained in:
parent
e9ad0be635
commit
7b0b0b2f3b
@ -21,7 +21,7 @@ android {
|
||||
applicationId "com.unciv.game"
|
||||
minSdkVersion 9
|
||||
targetSdkVersion 25
|
||||
versionCode 11
|
||||
versionCode 12
|
||||
versionName "0.9"
|
||||
}
|
||||
buildTypes {
|
||||
|
@ -5,6 +5,7 @@ import com.badlogic.gdx.utils.Predicate;
|
||||
import com.unciv.game.UnCivGame;
|
||||
import com.unciv.models.LinqCollection;
|
||||
import com.unciv.models.LinqCounter;
|
||||
import com.unciv.models.LinqHashMap;
|
||||
import com.unciv.models.gamebasics.Building;
|
||||
import com.unciv.models.gamebasics.GameBasics;
|
||||
import com.unciv.models.gamebasics.TileResource;
|
||||
@ -19,6 +20,7 @@ public class CityInfo {
|
||||
private int tilesClaimed;
|
||||
public int population = 1;
|
||||
public int foodStored = 0;
|
||||
public LinqHashMap<String,FullStats> buildingsSpecialists = new LinqHashMap<String, FullStats>();
|
||||
public FullStats specialists = new FullStats();
|
||||
|
||||
public FullStats cityStats; // This is so we won't have to calculate this multiple times - takes a lot of time, especially on phones!
|
||||
@ -96,7 +98,18 @@ public class CityInfo {
|
||||
return cityResources;
|
||||
}
|
||||
|
||||
public int getNumberOfSpecialists(){return (int) (specialists.science+specialists.production+specialists.culture+specialists.gold);}
|
||||
|
||||
public FullStats getSpecialists(){
|
||||
FullStats allSpecialists = new FullStats();
|
||||
for(FullStats stats : buildingsSpecialists.values())
|
||||
allSpecialists.add(stats);
|
||||
return allSpecialists;
|
||||
}
|
||||
|
||||
public int getNumberOfSpecialists(){
|
||||
FullStats specialists = getSpecialists();
|
||||
return (int) (specialists.science+specialists.production+specialists.culture+specialists.gold);
|
||||
}
|
||||
|
||||
public int getFreePopulation() {
|
||||
int workingPopulation = getTilesInRange().count(new Predicate<TileInfo>() {
|
||||
@ -123,6 +136,7 @@ public class CityInfo {
|
||||
stats.add(cell.getTileStats(this));
|
||||
|
||||
// Specialists
|
||||
FullStats specialists = getSpecialists();
|
||||
stats.culture+=specialists.culture*3;
|
||||
stats.production+=specialists.production*2;
|
||||
stats.science+=specialists.science*3;
|
||||
@ -340,6 +354,7 @@ public class CityInfo {
|
||||
private boolean isCapital(){ return CivilizationInfo.current().getCapital() == this; }
|
||||
|
||||
private boolean isConnectedToCapital(RoadStatus roadType){
|
||||
if(CivilizationInfo.current().getCapital()==null) return false;// first city!
|
||||
TileInfo capitalTile = CivilizationInfo.current().getCapital().getTile();
|
||||
LinqCollection<TileInfo> tilesReached = new LinqCollection<TileInfo>();
|
||||
LinqCollection<TileInfo> tilesToCheck = new LinqCollection<TileInfo>();
|
||||
@ -381,7 +396,7 @@ public class CityInfo {
|
||||
}
|
||||
|
||||
public FullStats getGreatPersonPoints(){
|
||||
FullStats greatPersonPoints = specialists.multiply(3);
|
||||
FullStats greatPersonPoints = getSpecialists().multiply(3);
|
||||
CivilizationInfo civInfo = CivilizationInfo.current();
|
||||
|
||||
for(Building building : cityConstructions.getBuiltBuildings())
|
||||
|
@ -62,7 +62,7 @@ public class TileMap{
|
||||
resource = GetRandomResource(TileResources, ResourceType.Bonus);
|
||||
} else if (Math.random() < 1 / 7f) {
|
||||
resource = GetRandomResource(TileResources, ResourceType.Strategic);
|
||||
} else if (Math.random() < 1 / 10f) {
|
||||
} else if (Math.random() < 1 / 15f) {
|
||||
resource = GetRandomResource(TileResources, ResourceType.Luxury);
|
||||
}
|
||||
if (resource != null) tileInfo.resource = resource.name;
|
||||
|
@ -94,16 +94,21 @@ public class CityScreen extends CameraStageBaseScreen {
|
||||
}
|
||||
}
|
||||
|
||||
private Image getSpecialistIcon(String imageName, final boolean isFilled, final FullStats specialistType) {
|
||||
private Image getSpecialistIcon(String imageName, final String building, final boolean isFilled, final FullStats specialistType) {
|
||||
Image specialist = ImageGetter.getImage(imageName);
|
||||
specialist.setSize(40,40);
|
||||
if(!isFilled) specialist.setColor(Color.GRAY);
|
||||
specialist.addListener(new ClickListener(){
|
||||
@Override
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
if(isFilled) getCity().specialists.add(specialistType.minus()); //unassign
|
||||
if(isFilled) getCity().buildingsSpecialists.get(building).add(specialistType.minus()); //unassign
|
||||
else if(getCity().getFreePopulation()==0) return;
|
||||
else getCity().specialists.add(specialistType); //assign!
|
||||
else {
|
||||
if(!getCity().buildingsSpecialists.containsKey(building))
|
||||
getCity().buildingsSpecialists.put(building,new FullStats());
|
||||
getCity().buildingsSpecialists.get(building).add(specialistType); //assign!}
|
||||
}
|
||||
|
||||
getCity().updateCityStats();
|
||||
update();
|
||||
}
|
||||
@ -114,28 +119,30 @@ public class CityScreen extends CameraStageBaseScreen {
|
||||
private void updateBuildingsTable(){
|
||||
BuildingsTable.clear();
|
||||
|
||||
|
||||
for(Building building : getCity().cityConstructions.getBuiltBuildings()){
|
||||
BuildingsTable.add(new Label(building.name,skin)).pad(10);
|
||||
if(building.specialistSlots==null) BuildingsTable.add();
|
||||
else {
|
||||
Table specialists = new Table();
|
||||
specialists.row().size(20).pad(10);
|
||||
if(!getCity().buildingsSpecialists.containsKey(building.name))
|
||||
getCity().buildingsSpecialists.put(building.name, new FullStats());
|
||||
FullStats currentBuildingSpecialists = getCity().buildingsSpecialists.get(building.name);
|
||||
for (int i = 0; i < building.specialistSlots.production; i++) {
|
||||
specialists.add(getSpecialistIcon("StatIcons/populationBrown.png",
|
||||
getCity().specialists.production > i, new FullStats(){{production=1;}}) );
|
||||
specialists.add(getSpecialistIcon("StatIcons/populationBrown.png",building.name,
|
||||
currentBuildingSpecialists.production > i, new FullStats(){{production=1;}}) );
|
||||
}
|
||||
for (int i = 0; i < building.specialistSlots.science; i++) {
|
||||
specialists.add(getSpecialistIcon("StatIcons/populationBlue.png",
|
||||
getCity().specialists.science > i, new FullStats(){{science=1;}}) );
|
||||
specialists.add(getSpecialistIcon("StatIcons/populationBlue.png",building.name,
|
||||
currentBuildingSpecialists.science > i, new FullStats(){{science=1;}}) );
|
||||
}
|
||||
for (int i = 0; i < building.specialistSlots.culture; i++) {
|
||||
specialists.add(getSpecialistIcon("StatIcons/populationPurple.png",
|
||||
getCity().specialists.culture > i, new FullStats(){{culture=1;}}) );
|
||||
specialists.add(getSpecialistIcon("StatIcons/populationPurple.png",building.name,
|
||||
currentBuildingSpecialists.culture > i, new FullStats(){{culture=1;}}) );
|
||||
}
|
||||
for (int i = 0; i < building.specialistSlots.gold; i++) {
|
||||
specialists.add(getSpecialistIcon("StatIcons/populationYellow.png",
|
||||
getCity().specialists.gold > i, new FullStats(){{gold=1;}}) );
|
||||
specialists.add(getSpecialistIcon("StatIcons/populationYellow.png",building.name,
|
||||
currentBuildingSpecialists.gold > i, new FullStats(){{gold=1;}}) );
|
||||
}
|
||||
BuildingsTable.add(specialists);
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ public class Building extends NamedStats implements IConstruction, ICivilopedia
|
||||
percentStatBonus = new FullStats(){{gold=10;}};
|
||||
|
||||
if (policies.contains("Free Thought") && name.equals("University"))
|
||||
percentStatBonus.science+=17;
|
||||
percentStatBonus.science=50;
|
||||
|
||||
if (policies.contains("Rationalism Complete") && !isWonder && stats.science>0)
|
||||
stats.gold+=1;
|
||||
@ -107,6 +107,12 @@ public class Building extends NamedStats implements IConstruction, ICivilopedia
|
||||
if(this.percentStatBonus.food!=0) stringBuilder.append("+"+(int)this.percentStatBonus.food+"% food\r\n");
|
||||
if(this.percentStatBonus.culture!=0) stringBuilder.append("+"+(int)this.percentStatBonus.culture+"% culture\r\n");
|
||||
}
|
||||
if(this.greatPersonPoints!=null){
|
||||
if(this.greatPersonPoints.production!=0) stringBuilder.append("+"+(int)this.greatPersonPoints.production+" Great Engineer points\r\n");
|
||||
if(this.greatPersonPoints.gold!=0) stringBuilder.append("+"+(int)this.greatPersonPoints.gold+" Great Merchant points\r\n");
|
||||
if(this.greatPersonPoints.science!=0) stringBuilder.append("+"+(int)this.greatPersonPoints.science+" Great Scientist points\r\n");
|
||||
if(this.greatPersonPoints.culture!=0) stringBuilder.append("+"+(int)this.greatPersonPoints.culture+" Great Artist points\r\n");
|
||||
}
|
||||
if(resourceBonusStats!=null){
|
||||
String resources = StringUtils.join(",",GameBasics.TileResources.linqValues().where(new Predicate<TileResource>() {
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user