mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-23 03:23:17 -04:00
More policy names to effects
This commit is contained in:
parent
038e1cadbf
commit
248d7b5aa6
@ -91,8 +91,7 @@ class CityInfo {
|
|||||||
cityConstructions.currentConstructionFromQueue = Constants.worker // Default for first city only!
|
cityConstructions.currentConstructionFromQueue = Constants.worker // Default for first city only!
|
||||||
}
|
}
|
||||||
|
|
||||||
if (civInfo.policies.isAdopted("Legalism"))
|
civInfo.policies.tryAddLegalismBuildings()
|
||||||
civInfo.policies.tryAddLegalismBuildings()
|
|
||||||
|
|
||||||
expansion.reset()
|
expansion.reset()
|
||||||
|
|
||||||
@ -195,12 +194,13 @@ class CityInfo {
|
|||||||
// Per https://gaming.stackexchange.com/questions/53155/do-manufactories-and-customs-houses-sacrifice-the-strategic-or-luxury-resources
|
// Per https://gaming.stackexchange.com/questions/53155/do-manufactories-and-customs-houses-sacrifice-the-strategic-or-luxury-resources
|
||||||
|| (resource.resourceType==ResourceType.Strategic && tileInfo.containsGreatImprovement())){
|
|| (resource.resourceType==ResourceType.Strategic && tileInfo.containsGreatImprovement())){
|
||||||
var amountToAdd = 1
|
var amountToAdd = 1
|
||||||
if(resource.resourceType == ResourceType.Strategic){
|
if(resource.resourceType == ResourceType.Strategic) {
|
||||||
amountToAdd = 2
|
amountToAdd = 2
|
||||||
if(civInfo.policies.isAdopted("Fascism")) amountToAdd*=2
|
if (civInfo.policies.hasEffect("Quantity of strategic resources produced by the empire increased by 100%"))
|
||||||
if(civInfo.nation.unique == UniqueAbility.SIBERIAN_RICHES && resource.name in listOf("Horses","Iron","Uranium"))
|
|
||||||
amountToAdd *= 2
|
amountToAdd *= 2
|
||||||
if(resource.name=="Oil" && civInfo.nation.unique == UniqueAbility.TRADE_CARAVANS)
|
if (civInfo.nation.unique == UniqueAbility.SIBERIAN_RICHES && resource.name in listOf("Horses", "Iron", "Uranium"))
|
||||||
|
amountToAdd *= 2
|
||||||
|
if (resource.name == "Oil" && civInfo.nation.unique == UniqueAbility.TRADE_CARAVANS)
|
||||||
amountToAdd *= 2
|
amountToAdd *= 2
|
||||||
}
|
}
|
||||||
if(resource.resourceType == ResourceType.Luxury
|
if(resource.resourceType == ResourceType.Luxury
|
||||||
@ -260,12 +260,12 @@ class CityInfo {
|
|||||||
for(entry in stats){
|
for(entry in stats){
|
||||||
if(civInfo.nation.unique == UniqueAbility.INGENUITY)
|
if(civInfo.nation.unique == UniqueAbility.INGENUITY)
|
||||||
entry.value.science *= 1.5f
|
entry.value.science *= 1.5f
|
||||||
if (civInfo.policies.isAdopted("Entrepreneurship"))
|
if (civInfo.policies.hasEffect("Great Merchants are earned 25% faster, +1 Science from every Mint, Market, Bank and Stock Exchange."))
|
||||||
entry.value.gold *= 1.25f
|
entry.value.gold *= 1.25f
|
||||||
|
|
||||||
if (civInfo.containsBuildingUnique("+33% great person generation in all cities"))
|
if (civInfo.containsBuildingUnique("+33% great person generation in all cities"))
|
||||||
stats[entry.key] = stats[entry.key]!!.times(1.33f)
|
stats[entry.key] = stats[entry.key]!!.times(1.33f)
|
||||||
if (civInfo.policies.isAdopted("Freedom"))
|
if (civInfo.policies.hasEffect("+25% great people rate"))
|
||||||
stats[entry.key] = stats[entry.key]!!.times(1.25f)
|
stats[entry.key] = stats[entry.key]!!.times(1.25f)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,8 +46,7 @@ class PolicyManager {
|
|||||||
.flatMap { it.policies.asSequence()+sequenceOf(it) }
|
.flatMap { it.policies.asSequence()+sequenceOf(it) }
|
||||||
|
|
||||||
fun startTurn() {
|
fun startTurn() {
|
||||||
if (isAdopted("Legalism") && legalismState.size < 4)
|
tryAddLegalismBuildings()
|
||||||
tryAddLegalismBuildings()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun endTurn(culture: Int) {
|
fun endTurn(culture: Int) {
|
||||||
@ -63,9 +62,10 @@ class PolicyManager {
|
|||||||
// round down to nearest 5
|
// round down to nearest 5
|
||||||
fun getCultureNeededForNextPolicy(): Int {
|
fun getCultureNeededForNextPolicy(): Int {
|
||||||
var policyCultureCost = 25 + (numberOfAdoptedPolicies * 6).toDouble().pow(1.7)
|
var policyCultureCost = 25 + (numberOfAdoptedPolicies * 6).toDouble().pow(1.7)
|
||||||
var cityModifier = 0.3 * (civInfo.cities.count { !it.isPuppet } - 1)
|
var cityModifier = 0.3f * (civInfo.cities.count { !it.isPuppet } - 1)
|
||||||
|
|
||||||
if (isAdopted("Representation")) cityModifier *= (2 / 3f).toDouble()
|
if (hasEffect("Each city founded increases culture cost of policies 33% less than normal. Starts a golden age."))
|
||||||
|
cityModifier *= (2 / 3f)
|
||||||
if (isAdopted("Piety Complete")) policyCultureCost *= 0.9
|
if (isAdopted("Piety Complete")) policyCultureCost *= 0.9
|
||||||
if (civInfo.containsBuildingUnique("Culture cost of adopting new Policies reduced by 10%"))
|
if (civInfo.containsBuildingUnique("Culture cost of adopting new Policies reduced by 10%"))
|
||||||
policyCultureCost *= 0.9
|
policyCultureCost *= 0.9
|
||||||
@ -101,11 +101,11 @@ class PolicyManager {
|
|||||||
|
|
||||||
fun adopt(policy: Policy, branchCompletion: Boolean = false) {
|
fun adopt(policy: Policy, branchCompletion: Boolean = false) {
|
||||||
|
|
||||||
if(!branchCompletion) {
|
if (!branchCompletion) {
|
||||||
if (freePolicies > 0) freePolicies--
|
if (freePolicies > 0) freePolicies--
|
||||||
else {
|
else {
|
||||||
val cultureNeededForNextPolicy = getCultureNeededForNextPolicy()
|
val cultureNeededForNextPolicy = getCultureNeededForNextPolicy()
|
||||||
if(cultureNeededForNextPolicy > storedCulture)
|
if (cultureNeededForNextPolicy > storedCulture)
|
||||||
throw Exception("How is this possible??????")
|
throw Exception("How is this possible??????")
|
||||||
storedCulture -= cultureNeededForNextPolicy
|
storedCulture -= cultureNeededForNextPolicy
|
||||||
numberOfAdoptedPolicies++
|
numberOfAdoptedPolicies++
|
||||||
@ -122,22 +122,21 @@ class PolicyManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val hasCapital = civInfo.cities.any{it.isCapital()}
|
val hasCapital = civInfo.cities.any { it.isCapital() }
|
||||||
when (policy.name) {
|
when (policy.name) {
|
||||||
"Collective Rule" -> if(hasCapital && !civInfo.isOneCityChallenger())
|
"Collective Rule" -> if (hasCapital && !civInfo.isOneCityChallenger())
|
||||||
civInfo.placeUnitNearTile(civInfo.getCapital().location, Constants.settler)
|
civInfo.placeUnitNearTile(civInfo.getCapital().location, Constants.settler)
|
||||||
"Citizenship" -> if(hasCapital) civInfo.placeUnitNearTile(civInfo.getCapital().location, Constants.worker)
|
"Citizenship" -> if (hasCapital) civInfo.placeUnitNearTile(civInfo.getCapital().location, Constants.worker)
|
||||||
"Representation", "Reformation" -> civInfo.goldenAges.enterGoldenAge()
|
"Representation", "Reformation" -> civInfo.goldenAges.enterGoldenAge()
|
||||||
"Legalism" -> tryAddLegalismBuildings()
|
|
||||||
"Free Religion" -> freePolicies++
|
"Free Religion" -> freePolicies++
|
||||||
"Liberty Complete" -> {
|
"Liberty Complete" -> {
|
||||||
if (civInfo.isPlayerCivilization()) civInfo.greatPeople.freeGreatPeople++
|
if (civInfo.isPlayerCivilization()) civInfo.greatPeople.freeGreatPeople++
|
||||||
else {
|
else {
|
||||||
val preferredVictoryType = civInfo.victoryType()
|
val preferredVictoryType = civInfo.victoryType()
|
||||||
val greatPerson = when(preferredVictoryType) {
|
val greatPerson = when (preferredVictoryType) {
|
||||||
VictoryType.Cultural -> "Great Artist"
|
VictoryType.Cultural -> "Great Artist"
|
||||||
VictoryType.Scientific -> "Great Scientist"
|
VictoryType.Scientific -> "Great Scientist"
|
||||||
VictoryType.Domination,VictoryType.Neutral ->
|
VictoryType.Domination, VictoryType.Neutral ->
|
||||||
civInfo.gameInfo.ruleSet.units.keys.filter { it.startsWith("Great") }.random()
|
civInfo.gameInfo.ruleSet.units.keys.filter { it.startsWith("Great") }.random()
|
||||||
}
|
}
|
||||||
civInfo.addGreatPerson(greatPerson)
|
civInfo.addGreatPerson(greatPerson)
|
||||||
@ -145,15 +144,20 @@ class PolicyManager {
|
|||||||
}
|
}
|
||||||
"Autocracy Complete" -> autocracyCompletedTurns = 30
|
"Autocracy Complete" -> autocracyCompletedTurns = 30
|
||||||
}
|
}
|
||||||
|
tryAddLegalismBuildings()
|
||||||
|
|
||||||
// This ALSO has the side-effect of updating the CivInfo statForNextTurn so we don't need to call it explicitly
|
// This ALSO has the side-effect of updating the CivInfo statForNextTurn so we don't need to call it explicitly
|
||||||
for (cityInfo in civInfo.cities)
|
for (cityInfo in civInfo.cities)
|
||||||
cityInfo.cityStats.update()
|
cityInfo.cityStats.update()
|
||||||
|
|
||||||
if(!canAdoptPolicy()) shouldOpenPolicyPicker=false
|
if (!canAdoptPolicy()) shouldOpenPolicyPicker = false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun tryAddLegalismBuildings() {
|
fun tryAddLegalismBuildings() {
|
||||||
|
if(!civInfo.policies.hasEffect("Immediately creates a cheapest available cultural building in each of your first 4 cities for free"))
|
||||||
|
return
|
||||||
|
if(legalismState.size >= 4) return
|
||||||
|
|
||||||
val candidateCities = civInfo.cities
|
val candidateCities = civInfo.cities
|
||||||
.sortedBy { it.turnAcquired }
|
.sortedBy { it.turnAcquired }
|
||||||
.subList(0, min(4, civInfo.cities.size))
|
.subList(0, min(4, civInfo.cities.size))
|
||||||
|
@ -249,11 +249,14 @@ open class TileInfo {
|
|||||||
improvement.clone() // basic improvement
|
improvement.clone() // basic improvement
|
||||||
|
|
||||||
if (improvement.improvingTech != null && observingCiv.tech.isResearched(improvement.improvingTech!!)) stats.add(improvement.improvingTechStats!!) // eg Chemistry for mines
|
if (improvement.improvingTech != null && observingCiv.tech.isResearched(improvement.improvingTech!!)) stats.add(improvement.improvingTechStats!!) // eg Chemistry for mines
|
||||||
if (improvement.name == "Trading post" && city != null && city.civInfo.policies.isAdopted("Free Thought"))
|
if (improvement.name == "Trading post" && city != null
|
||||||
|
&& city.civInfo.policies.hasEffect("+1 science from every trading post, +17% science from universities"))
|
||||||
stats.science += 1f
|
stats.science += 1f
|
||||||
if (improvement.name == "Trading post" && city != null && city.civInfo.policies.isAdopted("Commerce Complete"))
|
if (improvement.name == "Trading post" && city != null
|
||||||
|
&& city.civInfo.policies.hasEffect("+1 gold from every trading post, double gold from Great Merchant trade missions"))
|
||||||
stats.gold += 1f
|
stats.gold += 1f
|
||||||
if (containsGreatImprovement() && observingCiv.policies.isAdopted("Freedom Complete"))
|
if (containsGreatImprovement()
|
||||||
|
&& observingCiv.policies.hasEffect("Tile yield from great improvement +100%, golden ages increase by 50%"))
|
||||||
stats.add(improvement) // again, for the double effect
|
stats.add(improvement) // again, for the double effect
|
||||||
if (containsGreatImprovement() && city != null && city.civInfo.nation.unique == UniqueAbility.SCHOLARS_OF_THE_JADE_HALL)
|
if (containsGreatImprovement() && city != null && city.civInfo.nation.unique == UniqueAbility.SCHOLARS_OF_THE_JADE_HALL)
|
||||||
stats.science += 2
|
stats.science += 2
|
||||||
|
@ -194,10 +194,10 @@ 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 && culture != 0f && civInfo.policies.isAdopted("Piety"))
|
if (!isWonder && culture != 0f && civInfo.policies.hasEffect("Building time of culture buildings reduced by 15%"))
|
||||||
productionCost *= 0.85f
|
productionCost *= 0.85f
|
||||||
|
|
||||||
if (name == "Courthouse" && civInfo.policies.isAdopted("Police State"))
|
if (name == "Courthouse" && civInfo.policies.hasEffect("+3 Happiness from every Courthouse. Build Courthouses in half the usual time."))
|
||||||
productionCost *= 0.5f
|
productionCost *= 0.5f
|
||||||
|
|
||||||
if (civInfo.isPlayerCivilization()) {
|
if (civInfo.isPlayerCivilization()) {
|
||||||
@ -217,11 +217,10 @@ class Building : NamedStats(), IConstruction{
|
|||||||
override fun getGoldCost(civInfo: CivilizationInfo): Int {
|
override fun getGoldCost(civInfo: CivilizationInfo): Int {
|
||||||
// https://forums.civfanatics.com/threads/rush-buying-formula.393892/
|
// https://forums.civfanatics.com/threads/rush-buying-formula.393892/
|
||||||
var cost = (30 * getProductionCost(civInfo)).toDouble().pow(0.75) * (1 + hurryCostModifier / 100)
|
var cost = (30 * getProductionCost(civInfo)).toDouble().pow(0.75) * (1 + hurryCostModifier / 100)
|
||||||
if (civInfo.policies.isAdopted("Mercantilism")) cost *= 0.75
|
if (civInfo.policies.hasEffect("-25% to purchasing items in cities")) cost *= 0.75
|
||||||
if (civInfo.containsBuildingUnique("-15% to purchasing items in cities")) cost *= 0.85
|
if (civInfo.containsBuildingUnique("-15% to purchasing items in cities")) cost *= 0.85
|
||||||
if (civInfo.policies.isAdopted("Patronage")
|
if (civInfo.policies.hasEffect( "Cost of purchasing culture buildings reduced by 50%")
|
||||||
&& listOf("Monument", "Temple", "Opera House", "Museum", "Broadcast Tower")
|
&& culture !=0f && !isWonder)
|
||||||
.map{civInfo.getEquivalentBuilding(it).name}.contains(name))
|
|
||||||
cost *= 0.5
|
cost *= 0.5
|
||||||
|
|
||||||
return (cost / 10).toInt() * 10
|
return (cost / 10).toInt() * 10
|
||||||
|
Loading…
x
Reference in New Issue
Block a user