mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-10 19:09:06 +07:00
Added civ-wide per-building stat bonus
This commit is contained in:
parent
ca58bb22ac
commit
8dfc147bb1
@ -831,7 +831,7 @@
|
||||
"gold": 6,
|
||||
"greatPersonPoints": {"gold": 1},
|
||||
"isWonder": true,
|
||||
"uniques": ["+1 happiness, +2 culture and +3 gold from every Castle",
|
||||
"uniques": ["[+1 Happiness, +2 Culture, +3 Gold] from every [Castle]",
|
||||
"Must have an owned mountain within 2 tiles"],
|
||||
"requiredTech": "Railroad",
|
||||
"quote": "'...the location is one of the most beautiful to be found, holy and unapproachable, a worthy temple for the divine friend who has brought salvation and true blessing to the world.' - King Ludwig II of Bavaria"
|
||||
|
@ -154,10 +154,13 @@
|
||||
"name": "Piety",
|
||||
"era": "Classical era",
|
||||
"effect": "Building time of culture buildings reduced by 15%",
|
||||
"uniques": ["Production cost of [Culture] buildings reduced by [15]%"],
|
||||
"policies": [
|
||||
{
|
||||
"name": "Organized Religion",
|
||||
"effect": "+1 happiness for each monument, temple and monastery",
|
||||
"uniques": ["[+1 happiness] from every [Monument]","[+1 happiness] from every [Temple]",
|
||||
"[+1 happiness] from every [Monastery]"]
|
||||
"row": 1,
|
||||
"column": 2
|
||||
},
|
||||
|
@ -137,8 +137,11 @@ class Building : NamedStats(), IConstruction{
|
||||
val adoptedPolicies = civInfo.policies.adoptedPolicies
|
||||
val baseBuildingName = getBaseBuilding(civInfo.gameInfo.ruleSet).name
|
||||
|
||||
if (adoptedPolicies.contains("Organized Religion") && cultureBuildings.contains(baseBuildingName ))
|
||||
stats.happiness += 1
|
||||
for(unique in civInfo.getMatchingUniques("[] from every []")) {
|
||||
val placeholderParams = unique.getPlaceholderParameters()
|
||||
if (placeholderParams[1] != baseBuildingName) continue
|
||||
stats.add(Stats.parse(placeholderParams[0]))
|
||||
}
|
||||
|
||||
if (adoptedPolicies.contains("Free Religion") && cultureBuildings.contains(baseBuildingName ))
|
||||
stats.culture += 1f
|
||||
@ -155,13 +158,6 @@ class Building : NamedStats(), IConstruction{
|
||||
if (adoptedPolicies.contains("Constitution") && isWonder)
|
||||
stats.culture += 2f
|
||||
|
||||
if (baseBuildingName == "Castle"
|
||||
&& civInfo.hasUnique("+1 happiness, +2 culture and +3 gold from every Castle")){
|
||||
stats.happiness+=1
|
||||
stats.culture+=2
|
||||
stats.gold+=3
|
||||
}
|
||||
|
||||
if (adoptedPolicies.contains("Police State") && baseBuildingName == "Courthouse")
|
||||
stats.happiness += 3
|
||||
|
||||
@ -196,8 +192,13 @@ class Building : NamedStats(), IConstruction{
|
||||
override fun getProductionCost(civInfo: CivilizationInfo): Int {
|
||||
var productionCost = cost.toFloat()
|
||||
|
||||
if (!isWonder && culture != 0f && civInfo.policies.hasEffect("Building time of culture buildings reduced by 15%"))
|
||||
productionCost *= 0.85f
|
||||
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
|
||||
|
@ -14,6 +14,7 @@ import com.unciv.models.ruleset.tile.TileImprovement
|
||||
import com.unciv.models.ruleset.tile.TileResource
|
||||
import com.unciv.models.ruleset.unit.BaseUnit
|
||||
import com.unciv.models.ruleset.unit.Promotion
|
||||
import com.unciv.models.stats.Stat
|
||||
import com.unciv.models.stats.Stats
|
||||
import com.unciv.ui.worldscreen.unit.UnitActions
|
||||
import java.lang.reflect.Field
|
||||
@ -201,6 +202,7 @@ object TranslationFileWriter {
|
||||
for(parameter in parameters) {
|
||||
val parameterName = when {
|
||||
parameter.toIntOrNull() != null -> "amount"
|
||||
Stat.values().any { it.name == parameter } -> "stat"
|
||||
RulesetCache.getBaseRuleset().terrains.containsKey(parameter) -> "terrain"
|
||||
RulesetCache.getBaseRuleset().units.containsKey(parameter) -> "unit"
|
||||
RulesetCache.getBaseRuleset().tileImprovements.containsKey(parameter) -> "tileImprovement"
|
||||
|
Loading…
Reference in New Issue
Block a user