More policy conversions, only 3 trees left!

This commit is contained in:
Yair Morgenstern
2020-07-30 22:07:05 +03:00
parent 0444a28657
commit 362ca7c1e3
10 changed files with 44 additions and 25 deletions

View File

@ -756,7 +756,7 @@
"gold": 4,
"greatPersonPoints": {"gold": 2},
"isWonder": true,
"uniques": ["-15% to purchasing items in cities"],
"uniques": ["Cost of purchasing items in cities reduced by [15]%"],
"requiredTech": "Industrialization",
"quote": "'To achieve great things, two things are needed: a plan, and not quite enough time.' - Leonard Bernstein"
},

View File

@ -3,7 +3,7 @@
"name": "Tradition",
"era": "Ancient era",
"effect": "+3 culture in capital and increased rate of border expansion",
"uniques": ["+3 culture in capital", "Increased rate of border expansion"],
"uniques": ["[+3 Culture] in capital", "Increased rate of border expansion"],
"policies": [
{
"name": "Aristocracy",
@ -198,7 +198,8 @@
},
{
"name": "Piety Complete",
"effect": "Reduce culture cost of future policies by 10%"
"effect": "Reduce culture cost of future policies by 10%",
"uniques": ["Culture cost of adopting new Policies reduced by 10%"]
}
]
},/*{
@ -248,23 +249,28 @@
{
"name": "Commerce",
"effect": "+25% gold in capital",
"uniques": ["+25% gold in capital"],
"era": "Medieval era",
"policies": [
{
"name": "Trade Unions",
"effect": "Maintenance on roads & railroads reduced by 33%, +2 gold from all trade routes",
"uniques": ["Maintenance on roads & railroads reduced by 33%", "+2 Gold from all trade routes"]
"row": 1,
"column": 2
},
{
"name": "Mercantilism",
"effect": "-25% to purchasing items in cities",
"uniques": ["Cost of purchasing items in cities reduced by [25]%"]
"row": 1,
"column": 5
},
{
"name": "Entrepreneurship",
"effect": "Great Merchants are earned 25% faster, +1 Science from every Mint, Market, Bank and Stock Exchange.",
"uniques": ["Great Merchants are earned 25% faster", "[+1 Science] from every [Mint]", "[+1 Science] from every [Market]",
"[+1 Science] from every [Bank]", "[+1 Science] from every [Stock Exchange]" ],
"requires": ["Trade Unions"],
"row": 2,
"column": 2
@ -272,6 +278,7 @@
{
"name": "Patronage",
"effect": "Cost of purchasing culture buildings reduced by 50%",
"uniques": ["Cost of purchasing [Culture] buildings reduced by [50]%"]
"requires": ["Mercantilism"],
"row": 2,
"column": 5
@ -279,13 +286,16 @@
{
"name": "Protectionism",
"effect": "+1 happiness from each luxury resource",
"uniques": ["+1 happiness from each luxury resource"],
"requires": ["Entrepreneurship","Patronage"],
"row": 3,
"column": 3
},
{
"name": "Commerce Complete",
"effect": "+1 gold from every trading post, double gold from Great Merchant trade missions"
"effect": "+1 gold from every trading post, double gold from Great Merchant trade missions",
"uniques": ["[+1 Gold] from every [Trading post]", "Double gold from Great Merchant trade missions"]
"uniques": "+1
}
]
},

View File

@ -260,7 +260,7 @@ class CityInfo {
for(entry in stats){
if(civInfo.nation.unique == UniqueAbility.INGENUITY)
entry.value.science *= 1.5f
if (civInfo.policies.hasEffect("Great Merchants are earned 25% faster, +1 Science from every Mint, Market, Bank and Stock Exchange."))
if (civInfo.hasUnique("Great Merchants are earned 25% faster"))
entry.value.gold *= 1.25f
if (civInfo.hasUnique("+33% great person generation in all cities"))

View File

@ -53,7 +53,7 @@ class CityStats {
val civInfo = cityInfo.civInfo
var goldFromTradeRoute = civInfo.getCapital().population.population * 0.15 + cityInfo.population.population * 1.1 - 1 // Calculated by http://civilization.wikia.com/wiki/Trade_route_(Civ5)
if (civInfo.nation.unique == UniqueAbility.TRADE_CARAVANS) goldFromTradeRoute += 1
if (civInfo.policies.hasEffect("Maintenance on roads & railroads reduced by 33%, +2 gold from all trade routes")) goldFromTradeRoute += 2
if (civInfo.hasUnique("+2 Gold from all trade routes")) goldFromTradeRoute += 2
if (civInfo.hasUnique("Gold from all trade routes +25%")) goldFromTradeRoute *= 1.25 // Machu Pichu speciality
stats.gold += goldFromTradeRoute.toFloat()
}
@ -358,7 +358,7 @@ class CityStats {
if (cityConstructions.getBuiltBuildings().any { it.isWonder }
&& cityInfo.civInfo.hasUnique("+33% culture in all cities with a world wonder"))
stats.culture += 33f
if (policies.contains("Commerce") && cityInfo.isCapital())
if (cityInfo.civInfo.hasUnique("+25% gold in capital") && cityInfo.isCapital())
stats.gold += 25f
if (policies.contains("Sovereignty") && cityInfo.civInfo.getHappiness() >= 0)
stats.science += 15f

View File

@ -118,7 +118,8 @@ class CivInfoStats(val civInfo: CivilizationInfo){
// TODO - happinessPerUnique should be difficulty-dependent, 5 on Settler and Chieftian and 4 on other difficulties (should be parameter, not in code)
var happinessPerUniqueLuxury = 4f + civInfo.getDifficulty().extraHappinessPerLuxury
if (civInfo.policies.hasEffect("+1 happiness from each luxury resource")) happinessPerUniqueLuxury += 1
for(unique in civInfo.getMatchingUniques("+1 happiness from each luxury resource"))
happinessPerUniqueLuxury += 1
statMap["Luxury resources"]= civInfo.getCivResources().map { it.resource }
.count { it.resourceType === ResourceType.Luxury } * happinessPerUniqueLuxury

View File

@ -72,8 +72,7 @@ class PolicyManager {
if (civInfo.hasUnique("Each city founded increases culture cost of policies 33% less than normal"))
cityModifier *= (2 / 3f)
if (isAdopted("Piety Complete")) policyCultureCost *= 0.9
if (civInfo.hasUnique("Culture cost of adopting new Policies reduced by 10%"))
for(unique in civInfo.getMatchingUniques("Culture cost of adopting new Policies reduced by 10%"))
policyCultureCost *= 0.9
if (civInfo.isPlayerCivilization())
policyCultureCost *= civInfo.getDifficulty().policyCostModifier

View File

@ -249,13 +249,20 @@ open class TileInfo {
if (hasViewableResource(observingCiv) && getTileResource().improvement == improvement.name)
stats.add(getTileResource().improvementStats!!.clone()) // resource-specific 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(city!=null)
for(unique in city.civInfo.getMatchingUniques("[] from every []")) {
val placeholderParams = unique.getPlaceholderParameters()
if (unique == placeholderParams[1])
stats.add(Stats.parse(placeholderParams[0]))
}
if (improvement.name == Constants.tradingPost && city != null
&& city.civInfo.policies.hasEffect("+1 science from every trading post, +17% science from universities"))
stats.science += 1f
if (improvement.name == Constants.tradingPost && city != null
&& city.civInfo.policies.hasEffect("+1 gold from every trading post, double gold from Great Merchant trade missions"))
stats.gold += 1f
if (containsGreatImprovement()
&& observingCiv.policies.hasEffect("Tile yield from great improvement +100%, golden ages increase by 50%"))
stats.add(improvement) // again, for the double effect

View File

@ -143,9 +143,6 @@ class Building : NamedStats(), IConstruction{
stats.add(Stats.parse(placeholderParams[0]))
}
if (adoptedPolicies.contains("Entrepreneurship") && hashSetOf("Mint", "Market", "Bank", "Stock Market").contains(baseBuildingName ))
stats.science += 1f
if (adoptedPolicies.contains("Humanism") && hashSetOf("University", "Observatory", "Public School").contains(baseBuildingName ))
stats.happiness += 1f
@ -207,11 +204,15 @@ class Building : NamedStats(), IConstruction{
override fun getGoldCost(civInfo: CivilizationInfo): Int {
// https://forums.civfanatics.com/threads/rush-buying-formula.393892/
var cost = (30 * getProductionCost(civInfo)).toDouble().pow(0.75) * (1 + hurryCostModifier / 100)
if (civInfo.policies.hasEffect("-25% to purchasing items in cities")) cost *= 0.75
if (civInfo.hasUnique("-15% to purchasing items in cities")) cost *= 0.85
if (civInfo.policies.hasEffect( "Cost of purchasing culture buildings reduced by 50%")
&& culture !=0f && !isWonder)
cost *= 0.5
for (unique in civInfo.getMatchingUniques("Cost of purchasing items in cities reduced by []%"))
cost *= 1 - (unique.getPlaceholderParameters()[0].toFloat())
for (unique in civInfo.getMatchingUniques("Cost of purchasing [] buildings reduced by []%")) {
val placeholderParams = unique.getPlaceholderParameters()
if (isStatRelated(Stat.valueOf(placeholderParams[0])))
cost *= 1 - (placeholderParams[1].toFloat() / 100)
}
return (cost / 10).toInt() * 10
}

View File

@ -9,6 +9,7 @@ import com.unciv.models.ruleset.Ruleset
import com.unciv.models.translations.Translations
import com.unciv.models.translations.tr
import com.unciv.models.stats.INamed
import com.unciv.models.translations.getPlaceholderParameters
// This is BaseUnit because Unit is already a base Kotlin class and to avoid mixing the two up
@ -102,9 +103,9 @@ class BaseUnit : INamed, IConstruction {
override fun getGoldCost(civInfo: CivilizationInfo): Int {
var cost = getBaseGoldCost()
if (civInfo.policies.adoptedPolicies.contains("Mercantilism")) cost *= 0.75
if (civInfo.policies.adoptedPolicies.contains("Militarism")) cost *= 0.66f
if (civInfo.hasUnique("-15% to purchasing items in cities")) cost *= 0.85
for(unique in civInfo.getMatchingUniques("Cost of purchasing items in cities reduced by []%"))
cost *= 1-(unique.getPlaceholderParameters()[0].toFloat())
return (cost / 10).toInt() * 10 // rounded down o nearest ten
}

View File

@ -340,7 +340,7 @@ object UnitActions {
action = {
// http://civilization.wikia.com/wiki/Great_Merchant_(Civ5)
var goldEarned = (350 + 50 * unit.civInfo.getEraNumber()) * unit.civInfo.gameInfo.gameParameters.gameSpeed.modifier
if (unit.civInfo.policies.isAdopted("Commerce Complete"))
if (unit.civInfo.hasUnique("Double gold from Great Merchant trade missions"))
goldEarned *= 2
unit.civInfo.gold += goldEarned.toInt()
val relevantUnique = unit.getUniques().first { it.startsWith(CAN_UNDERTAKE) }