mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-13 19:39:34 +07:00
Policy transformation
This commit is contained in:
parent
654a355666
commit
0444a28657
@ -154,7 +154,7 @@
|
|||||||
"name": "Piety",
|
"name": "Piety",
|
||||||
"era": "Classical era",
|
"era": "Classical era",
|
||||||
"effect": "Building time of culture buildings reduced by 15%",
|
"effect": "Building time of culture buildings reduced by 15%",
|
||||||
"uniques": ["Production cost of [Culture] buildings reduced by [15]%"],
|
"uniques": ["+[15]% Production when constructing [Culture] buildings"],
|
||||||
"policies": [
|
"policies": [
|
||||||
{
|
{
|
||||||
"name": "Organized Religion",
|
"name": "Organized Religion",
|
||||||
@ -167,12 +167,14 @@
|
|||||||
{
|
{
|
||||||
"name": "Mandate Of Heaven",
|
"name": "Mandate Of Heaven",
|
||||||
"effect": "50% of excess happiness added to culture towards policies",
|
"effect": "50% of excess happiness added to culture towards policies",
|
||||||
|
"uniques": ["50% of excess happiness added to culture towards policies"],
|
||||||
"row": 1,
|
"row": 1,
|
||||||
"column": 5
|
"column": 5
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Theocracy",
|
"name": "Theocracy",
|
||||||
"effect": "Temples give +10% gold",
|
"effect": "Temples give +10% gold",
|
||||||
|
"uniques": ["Temples give +10% gold"],
|
||||||
"requires": ["Organized Religion"],
|
"requires": ["Organized Religion"],
|
||||||
"row": 2,
|
"row": 2,
|
||||||
"column": 1
|
"column": 1
|
||||||
@ -180,6 +182,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Reformation",
|
"name": "Reformation",
|
||||||
"effect": "+33% culture in all cities with a world wonder, immediately enter a golden age",
|
"effect": "+33% culture in all cities with a world wonder, immediately enter a golden age",
|
||||||
|
"uniques": ["+33% culture in all cities with a world wonder", "Empire enters golden age"]
|
||||||
"requires": ["Organized Religion"],
|
"requires": ["Organized Religion"],
|
||||||
"row": 2,
|
"row": 2,
|
||||||
"column": 3
|
"column": 3
|
||||||
@ -187,6 +190,8 @@
|
|||||||
{
|
{
|
||||||
"name": "Free Religion",
|
"name": "Free Religion",
|
||||||
"effect": "+1 culture for each monument, temple and monastery. Gain a free policy.",
|
"effect": "+1 culture for each monument, temple and monastery. Gain a free policy.",
|
||||||
|
"uniques": ["[+1 Culture] from every [Monument]", "[+1 Culture] from every [Temple]", "[+1 Culture] from every [Monastery]",
|
||||||
|
"Free Social Policy"]
|
||||||
"requires": ["Mandate Of Heaven","Reformation"],
|
"requires": ["Mandate Of Heaven","Reformation"],
|
||||||
"row": 3,
|
"row": 3,
|
||||||
"column": 4
|
"column": 4
|
||||||
|
@ -342,10 +342,21 @@ class CityStats {
|
|||||||
if (cityInfo.civInfo.hasUnique("+20% production when training melee units")
|
if (cityInfo.civInfo.hasUnique("+20% production when training melee units")
|
||||||
&& currentConstruction is BaseUnit && currentConstruction.unitType.isMelee())
|
&& currentConstruction is BaseUnit && currentConstruction.unitType.isMelee())
|
||||||
stats.production += 20
|
stats.production += 20
|
||||||
if (policies.contains("Piety")
|
|
||||||
&& listOf("Monument", "Temple", "Opera House", "Museum", "Broadcast Tower").contains(currentConstruction.name))
|
if(currentConstruction is Building && !currentConstruction.isWonder)
|
||||||
stats.production += 15f
|
for(unique in cityInfo.civInfo.getMatchingUniques("+[]% Production when constructing [] buildings")){
|
||||||
if (policies.contains("Reformation") && cityConstructions.getBuiltBuildings().any { it.isWonder })
|
val placeholderParams = unique.getPlaceholderParameters()
|
||||||
|
val stat = Stat.valueOf(placeholderParams[0])
|
||||||
|
if(currentConstruction.isStatRelated(stat))
|
||||||
|
stats.production += placeholderParams[1].toInt()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentConstruction is Building && currentConstruction.name == "Courthouse"
|
||||||
|
&& cityInfo.civInfo.policies.hasEffect("+3 Happiness from every Courthouse. Build Courthouses in half the usual time."))
|
||||||
|
stats.production += 100
|
||||||
|
|
||||||
|
if (cityConstructions.getBuiltBuildings().any { it.isWonder }
|
||||||
|
&& cityInfo.civInfo.hasUnique("+33% culture in all cities with a world wonder"))
|
||||||
stats.culture += 33f
|
stats.culture += 33f
|
||||||
if (policies.contains("Commerce") && cityInfo.isCapital())
|
if (policies.contains("Commerce") && cityInfo.isCapital())
|
||||||
stats.gold += 25f
|
stats.gold += 25f
|
||||||
|
@ -91,7 +91,7 @@ class CivInfoStats(val civInfo: CivilizationInfo){
|
|||||||
statMap["Transportation upkeep"] = Stats().apply { gold=- getTransportationUpkeep().toFloat()}
|
statMap["Transportation upkeep"] = Stats().apply { gold=- getTransportationUpkeep().toFloat()}
|
||||||
statMap["Unit upkeep"] = Stats().apply { gold=- getUnitUpkeep().toFloat()}
|
statMap["Unit upkeep"] = Stats().apply { gold=- getUnitUpkeep().toFloat()}
|
||||||
|
|
||||||
if (civInfo.policies.hasEffect("50% of excess happiness added to culture towards policies")) {
|
if (civInfo.hasUnique("50% of excess happiness added to culture towards policies")) {
|
||||||
val happiness = civInfo.getHappiness()
|
val happiness = civInfo.getHappiness()
|
||||||
if(happiness>0) statMap.add("Policies", Stats().apply { culture=happiness/2f })
|
if(happiness>0) statMap.add("Policies", Stats().apply { culture=happiness/2f })
|
||||||
}
|
}
|
||||||
|
@ -138,9 +138,8 @@ class PolicyManager {
|
|||||||
if (hasCapital && (unitName != Constants.settler || !civInfo.isOneCityChallenger()))
|
if (hasCapital && (unitName != Constants.settler || !civInfo.isOneCityChallenger()))
|
||||||
civInfo.placeUnitNearTile(civInfo.getCapital().location, unitName)
|
civInfo.placeUnitNearTile(civInfo.getCapital().location, unitName)
|
||||||
}
|
}
|
||||||
"+1 culture for each monument, temple and monastery. Gain a free policy." -> freePolicies++
|
"Gain a free policy" -> freePolicies++
|
||||||
"Empire enters golden age",
|
"Empire enters golden age" ->
|
||||||
"+33% culture in all cities with a world wonder, immediately enter a golden age" ->
|
|
||||||
civInfo.goldenAges.enterGoldenAge()
|
civInfo.goldenAges.enterGoldenAge()
|
||||||
"Free Great Person" -> {
|
"Free Great Person" -> {
|
||||||
if (civInfo.isPlayerCivilization()) civInfo.greatPeople.freeGreatPeople++
|
if (civInfo.isPlayerCivilization()) civInfo.greatPeople.freeGreatPeople++
|
||||||
|
@ -143,9 +143,6 @@ class Building : NamedStats(), IConstruction{
|
|||||||
stats.add(Stats.parse(placeholderParams[0]))
|
stats.add(Stats.parse(placeholderParams[0]))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (adoptedPolicies.contains("Free Religion") && cultureBuildings.contains(baseBuildingName ))
|
|
||||||
stats.culture += 1f
|
|
||||||
|
|
||||||
if (adoptedPolicies.contains("Entrepreneurship") && hashSetOf("Mint", "Market", "Bank", "Stock Market").contains(baseBuildingName ))
|
if (adoptedPolicies.contains("Entrepreneurship") && hashSetOf("Mint", "Market", "Bank", "Stock Market").contains(baseBuildingName ))
|
||||||
stats.science += 1f
|
stats.science += 1f
|
||||||
|
|
||||||
@ -172,10 +169,10 @@ class Building : NamedStats(), IConstruction{
|
|||||||
val adoptedPolicies = civInfo.policies.adoptedPolicies
|
val adoptedPolicies = civInfo.policies.adoptedPolicies
|
||||||
val baseBuildingName = getBaseBuilding(civInfo.gameInfo.ruleSet).name
|
val baseBuildingName = getBaseBuilding(civInfo.gameInfo.ruleSet).name
|
||||||
|
|
||||||
if (adoptedPolicies.contains("Theocracy") && baseBuildingName == "Temple")
|
if (baseBuildingName == "Temple" && civInfo.hasUnique("Temples give +10% gold"))
|
||||||
stats.gold = 10f
|
stats.gold = 10f
|
||||||
|
|
||||||
if (adoptedPolicies.contains("Free Thought") && baseBuildingName == "University")
|
if (baseBuildingName == "University" && adoptedPolicies.contains("Free Thought"))
|
||||||
stats.science = 50f
|
stats.science = 50f
|
||||||
|
|
||||||
if(uniques.contains("+5% Production for every Trade Route with a City-State in the empire"))
|
if(uniques.contains("+5% Production for every Trade Route with a City-State in the empire"))
|
||||||
@ -192,16 +189,6 @@ class Building : NamedStats(), IConstruction{
|
|||||||
override fun getProductionCost(civInfo: CivilizationInfo): Int {
|
override fun getProductionCost(civInfo: CivilizationInfo): Int {
|
||||||
var productionCost = cost.toFloat()
|
var productionCost = cost.toFloat()
|
||||||
|
|
||||||
if(!isWonder)
|
|
||||||
for(unique in civInfo.getMatchingUniques("Production cost of [] buildings reduced by []%")){
|
|
||||||
val placeholderParams = unique.getPlaceholderParameters()
|
|
||||||
val stat = Stat.valueOf(placeholderParams[0])
|
|
||||||
if(this.isStatRelated(stat))
|
|
||||||
productionCost *= (1f - placeholderParams[1].toFloat()/100)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name == "Courthouse" && civInfo.policies.hasEffect("+3 Happiness from every Courthouse. Build Courthouses in half the usual time."))
|
|
||||||
productionCost *= 0.5f
|
|
||||||
|
|
||||||
if (civInfo.isPlayerCivilization()) {
|
if (civInfo.isPlayerCivilization()) {
|
||||||
if (!isWonder)
|
if (!isWonder)
|
||||||
|
Loading…
Reference in New Issue
Block a user