mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-24 03:53:12 -04:00
Added CivilizationPolicies, added great person pick when completing Liberty
This commit is contained in:
parent
546472b528
commit
85ffcc58ee
@ -79,7 +79,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name:"Liberty Complete",
|
name:"Liberty Complete",
|
||||||
description:"Free Great Person of choice near capital - TODO"
|
description:"Free Great Person of choice near capital"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},{
|
},{
|
||||||
|
@ -3,8 +3,8 @@ package com.unciv.logic.city;
|
|||||||
import com.unciv.models.stats.INamed;
|
import com.unciv.models.stats.INamed;
|
||||||
|
|
||||||
public interface IConstruction extends INamed {
|
public interface IConstruction extends INamed {
|
||||||
public int getProductionCost();
|
int getProductionCost();
|
||||||
public int getGoldCost();
|
int getGoldCost();
|
||||||
public boolean isBuildable(CityConstructions construction);
|
boolean isBuildable(CityConstructions construction);
|
||||||
public void postBuildEvent(CityConstructions construction); // Yes I'm hilarious.
|
void postBuildEvent(CityConstructions construction); // Yes I'm hilarious.
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ public class CivilizationInfo {
|
|||||||
public FullStats greatPersonPoints = new FullStats();
|
public FullStats greatPersonPoints = new FullStats();
|
||||||
|
|
||||||
public CivilizationTech tech = new CivilizationTech();
|
public CivilizationTech tech = new CivilizationTech();
|
||||||
public Linq<String> policies = new Linq<String>();
|
public CivilizationPolicies policies = new CivilizationPolicies();
|
||||||
public int freePolicies=0;
|
public int freePolicies=0;
|
||||||
public int turns = 1;
|
public int turns = 1;
|
||||||
|
|
||||||
|
@ -1,8 +1,51 @@
|
|||||||
package com.unciv.logic.civilization;
|
package com.unciv.logic.civilization;
|
||||||
|
|
||||||
/**
|
import com.badlogic.gdx.utils.Predicate;
|
||||||
* Created by LENOVO on 1/11/2018.
|
import com.unciv.logic.city.CityInfo;
|
||||||
*/
|
import com.unciv.models.gamebasics.GameBasics;
|
||||||
|
import com.unciv.models.gamebasics.Policy;
|
||||||
|
import com.unciv.models.gamebasics.PolicyBranch;
|
||||||
|
import com.unciv.models.linq.Linq;
|
||||||
|
import com.unciv.ui.UnCivGame;
|
||||||
|
import com.unciv.ui.pickerscreens.GreatPersonPickerScreen;
|
||||||
|
|
||||||
class CivilizationPolicies {
|
|
||||||
|
public class CivilizationPolicies extends Linq<String> {
|
||||||
|
|
||||||
|
public void adopt(Policy policy){
|
||||||
|
|
||||||
|
PolicyBranch branch = GameBasics.PolicyBranches.get(policy.branch);
|
||||||
|
int policiesCompleteInBranch = branch.policies.count(new Predicate<Policy>() {
|
||||||
|
@Override
|
||||||
|
public boolean evaluate(Policy arg0) {
|
||||||
|
return contains(arg0.name);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (policiesCompleteInBranch == branch.policies.size() - 1) { // All done apart from branch completion
|
||||||
|
adopt(branch.policies.get(branch.policies.size() - 1)); // add branch completion!
|
||||||
|
}
|
||||||
|
if (policy.name.equals("Collective Rule"))
|
||||||
|
CivilizationInfo.current().tileMap.
|
||||||
|
placeUnitNearTile(CivilizationInfo.current().getCapital().cityLocation, "Settler");
|
||||||
|
if (policy.name.equals("Citizenship"))
|
||||||
|
CivilizationInfo.current().tileMap.
|
||||||
|
placeUnitNearTile(CivilizationInfo.current().getCapital().cityLocation, "Worker");
|
||||||
|
if (policy.name.equals("Representation") || policy.name.equals("Reformation"))
|
||||||
|
CivilizationInfo.current().enterGoldenAge();
|
||||||
|
|
||||||
|
if (policy.name.equals("Scientific Revolution"))
|
||||||
|
CivilizationInfo.current().tech.freeTechs+=2;
|
||||||
|
|
||||||
|
if (policy.name.equals("Legalism"))
|
||||||
|
for (CityInfo city : CivilizationInfo.current().cities.subList(0,4))
|
||||||
|
city.cityConstructions.addCultureBuilding();
|
||||||
|
|
||||||
|
if (policy.name.equals("Free Religion"))
|
||||||
|
CivilizationInfo.current().freePolicies++;
|
||||||
|
|
||||||
|
if (policy.name.equals("Liberty Complete"))
|
||||||
|
UnCivGame.Current.setScreen(new GreatPersonPickerScreen());
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,37 +48,7 @@ public class PolicyPickerScreen extends PickerScreen {
|
|||||||
public void clicked(InputEvent event, float x, float y) {
|
public void clicked(InputEvent event, float x, float y) {
|
||||||
if(game.civInfo.freePolicies>0) game.civInfo.freePolicies--;
|
if(game.civInfo.freePolicies>0) game.civInfo.freePolicies--;
|
||||||
else game.civInfo.civStats.culture -= game.civInfo.getCultureNeededForNextPolicy();
|
else game.civInfo.civStats.culture -= game.civInfo.getCultureNeededForNextPolicy();
|
||||||
game.civInfo.policies.add(pickedPolicy.name);
|
game.civInfo.policies.adopt(pickedPolicy);
|
||||||
|
|
||||||
PolicyBranch branch = GameBasics.PolicyBranches.get(pickedPolicy.branch);
|
|
||||||
int policiesCompleteInBranch = branch.policies.count(new Predicate<Policy>() {
|
|
||||||
@Override
|
|
||||||
public boolean evaluate(Policy arg0) {
|
|
||||||
return game.civInfo.policies.contains(arg0.name);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (policiesCompleteInBranch == branch.policies.size() - 1) { // All done apart from branch completion
|
|
||||||
game.civInfo.policies.add(branch.policies.get(branch.policies.size() - 1).name); // add branch completion!
|
|
||||||
}
|
|
||||||
if (pickedPolicy.name.equals("Collective Rule"))
|
|
||||||
CivilizationInfo.current().tileMap.
|
|
||||||
placeUnitNearTile(CivilizationInfo.current().getCapital().cityLocation, "Settler");
|
|
||||||
if (pickedPolicy.name.equals("Citizenship"))
|
|
||||||
CivilizationInfo.current().tileMap.
|
|
||||||
placeUnitNearTile(CivilizationInfo.current().getCapital().cityLocation, "Worker");
|
|
||||||
if (pickedPolicy.name.equals("Representation") || pickedPolicy.name.equals("Reformation"))
|
|
||||||
CivilizationInfo.current().enterGoldenAge();
|
|
||||||
|
|
||||||
if (pickedPolicy.name.equals("Scientific Revolution"))
|
|
||||||
CivilizationInfo.current().tech.freeTechs+=2;
|
|
||||||
|
|
||||||
if (pickedPolicy.name.equals("Legalism"))
|
|
||||||
for (CityInfo city : game.civInfo.cities.subList(0,4))
|
|
||||||
city.cityConstructions.addCultureBuilding();
|
|
||||||
|
|
||||||
if (pickedPolicy.name.equals("Free Religion"))
|
|
||||||
CivilizationInfo.current().freePolicies++;
|
|
||||||
|
|
||||||
if (pickedPolicy.name.equals(""))
|
if (pickedPolicy.name.equals(""))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user