Civ uniques done up till Egypt
This commit is contained in:
parent
04d4c9c9bf
commit
5aaab7e137
8 changed files with 23 additions and 31 deletions
|
@ -139,6 +139,7 @@
|
|||
"outerColor": [ 114, 0, 0],
|
||||
"innerColor": [255,255,255],
|
||||
"unique": "SUN_NEVER_SETS",
|
||||
"uniques": []
|
||||
"cities": ["London","York","Nottingham","Hastings","Canterbury","Coventry","Warwick","Newcastle","Oxford","Liverpool",
|
||||
"Dover","Brighton","Norwich","Leeds","Reading","Birmingham","Richmond","Exeter","Cambridge","Gloucester",
|
||||
"Manchester","Bristol","Leicester","Carlisle","Ipswich","Portsmouth","Berwick","Bath","Mumbles","Southampton",
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
{
|
||||
"name": "Aristocracy",
|
||||
"effect": "+15% production when constructing wonders, +1 happiness for every 10 citizens in a city",
|
||||
"uniques": ["+15% production when constructing wonders", "+1 happiness for every 10 citizens in a city"],
|
||||
"uniques": ["+[15]% Production when constructing [Wonders]", "+1 happiness for every 10 citizens in a city"],
|
||||
"row": 1,
|
||||
"column": 1
|
||||
},
|
||||
|
@ -109,7 +109,7 @@
|
|||
{
|
||||
"name": "Warrior Code",
|
||||
"effect": "+20% production when training melee units",
|
||||
"uniques":["+20% production when training melee units"],
|
||||
"uniques":["+[20]% Production when constructing [melee units]"],
|
||||
"row": 1,
|
||||
"column": 2
|
||||
},
|
||||
|
|
|
@ -678,6 +678,7 @@ Occupied City =
|
|||
Buildings =
|
||||
# For the "when constructing [military units]" translation
|
||||
military units =
|
||||
melee units =
|
||||
Wonders =
|
||||
Base values =
|
||||
Bonuses =
|
||||
|
|
|
@ -87,7 +87,7 @@ object BattleDamage {
|
|||
.filter { it.civilianUnit?.civInfo == combatant.unit.civInfo }
|
||||
.map { it.civilianUnit }
|
||||
if (nearbyCivUnits.any { it!!.hasUnique("Bonus for units in 2 tile radius 15%") }) {
|
||||
val greatGeneralModifier = if (combatant.unit.civInfo.nation.unique == UniqueAbility.ART_OF_WAR) 0.3f else 0.15f
|
||||
val greatGeneralModifier = if (combatant.unit.civInfo.hasUnique("Great General provides double combat bonus")) 0.3f else 0.15f
|
||||
modifiers["Great General"] = greatGeneralModifier
|
||||
}
|
||||
|
||||
|
|
|
@ -273,11 +273,6 @@ class CityInfo {
|
|||
if (stat != null) entry.value.add(stat, entry.value.get(stat) * params[1].toInt())
|
||||
}
|
||||
|
||||
if (civInfo.nation.unique == UniqueAbility.INGENUITY)
|
||||
entry.value.science *= 1.5f
|
||||
if (civInfo.hasUnique("Great Merchants are earned 25% faster"))
|
||||
entry.value.gold *= 1.25f
|
||||
|
||||
for (unique in civInfo.getMatchingUniques("+[]% great person generation in all cities"))
|
||||
stats[entry.key] = stats[entry.key]!!.times(1 + (unique.getPlaceholderParameters()[0].toFloat() / 100))
|
||||
}
|
||||
|
|
|
@ -143,6 +143,8 @@ class CityStats {
|
|||
private fun getStatPercentBonusesFromNationUnique(): Stats {
|
||||
val stats = Stats()
|
||||
|
||||
stats.add(getStatPercentBonusesFromUniques(cityInfo.civInfo.nation.uniques))
|
||||
|
||||
val civUnique = cityInfo.civInfo.nation.unique
|
||||
val currentConstruction = cityInfo.cityConstructions.getCurrentConstruction()
|
||||
if (civUnique == UniqueAbility.GLORY_OF_ROME
|
||||
|
@ -151,10 +153,6 @@ class CityStats {
|
|||
.contains(currentConstruction.name))
|
||||
stats.production += 25f
|
||||
|
||||
if (civUnique == UniqueAbility.MONUMENT_BUILDERS
|
||||
&& currentConstruction is Building && currentConstruction.isWonder)
|
||||
stats.production += 20
|
||||
|
||||
return stats
|
||||
}
|
||||
|
||||
|
@ -303,6 +301,8 @@ class CityStats {
|
|||
val stats = cityInfo.cityConstructions.getStatPercentBonuses()
|
||||
val currentConstruction = cityInfo.cityConstructions.getCurrentConstruction()
|
||||
|
||||
stats.add(getStatPercentBonusesFromUniques(cityInfo.civInfo.getBuildingUniques().toHashSet()))
|
||||
|
||||
if (cityInfo.civInfo.hasUnique("Culture in all cities increased by 25%"))
|
||||
stats.culture += 25f
|
||||
|
||||
|
@ -330,46 +330,40 @@ class CityStats {
|
|||
return stats
|
||||
}
|
||||
|
||||
private fun getStatPercentBonusesFromPolicies(): Stats {
|
||||
private fun getStatPercentBonusesFromUniques(uniques: HashSet<String>): Stats {
|
||||
val stats = Stats()
|
||||
|
||||
val currentConstruction = cityInfo.cityConstructions.getCurrentConstruction()
|
||||
if (currentConstruction.name == Constants.settler && cityInfo.isCapital()
|
||||
&& cityInfo.civInfo.hasUnique("Training of settlers increased +50% in capital"))
|
||||
&& uniques.contains("Training of settlers increased +50% in capital"))
|
||||
stats.production += 50f
|
||||
if (cityInfo.civInfo.hasUnique("+20% production when training melee units")
|
||||
&& currentConstruction is BaseUnit && currentConstruction.unitType.isMelee())
|
||||
stats.production += 20
|
||||
|
||||
if(currentConstruction is Building && !currentConstruction.isWonder)
|
||||
for(unique in cityInfo.civInfo.getMatchingUniques("+[]% Production when constructing [] buildings")){
|
||||
for(unique in uniques.filter { it.equalsPlaceholderText("+[]% Production when constructing [] buildings")}) {
|
||||
val placeholderParams = unique.getPlaceholderParameters()
|
||||
val stat = Stat.valueOf(placeholderParams[1])
|
||||
if(currentConstruction.isStatRelated(stat))
|
||||
if (currentConstruction.isStatRelated(stat))
|
||||
stats.production += placeholderParams[0].toInt()
|
||||
}
|
||||
|
||||
for(unique in cityInfo.civInfo.getMatchingUniques("+[]% Production when constructing []")) {
|
||||
for(unique in uniques.filter { it.equalsPlaceholderText("+[]% Production when constructing []")}) {
|
||||
val placeholderParams = unique.getPlaceholderParameters()
|
||||
val filter = placeholderParams[1]
|
||||
if (currentConstruction.name == filter
|
||||
|| (filter == "military units" && currentConstruction is BaseUnit && !currentConstruction.unitType.isCivilian())
|
||||
|| (filter == "melee units" && currentConstruction is BaseUnit && !currentConstruction.unitType.isMelee())
|
||||
|| (filter == "Buildings" && currentConstruction is Building && !currentConstruction.isWonder)
|
||||
|| (filter == "Wonders" && currentConstruction is Building && currentConstruction.isWonder))
|
||||
stats.production += placeholderParams[0].toInt()
|
||||
}
|
||||
|
||||
if (cityInfo.cityConstructions.getBuiltBuildings().any { it.isWonder }
|
||||
&& cityInfo.civInfo.hasUnique("+33% culture in all cities with a world wonder"))
|
||||
&& uniques.contains("+33% culture in all cities with a world wonder"))
|
||||
stats.culture += 33f
|
||||
if (cityInfo.civInfo.hasUnique("+25% gold in capital") && cityInfo.isCapital())
|
||||
if (uniques.contains("+25% gold in capital") && cityInfo.isCapital())
|
||||
stats.gold += 25f
|
||||
if (cityInfo.civInfo.getHappiness() >= 0 && cityInfo.civInfo.hasUnique("+15% science while empire is happy"))
|
||||
if (cityInfo.civInfo.getHappiness() >= 0 && uniques.contains("+15% science while empire is happy"))
|
||||
stats.science += 15f
|
||||
if (cityInfo.civInfo.hasUnique("+15% production when constructing wonders")
|
||||
&& currentConstruction is Building
|
||||
&& currentConstruction.isWonder)
|
||||
stats.production += 15f
|
||||
|
||||
return stats
|
||||
}
|
||||
|
@ -407,7 +401,7 @@ class CityStats {
|
|||
fun updateStatPercentBonusList() {
|
||||
val newStatPercentBonusList = LinkedHashMap<String, Stats>()
|
||||
newStatPercentBonusList["Golden Age"] = getStatPercentBonusesFromGoldenAge(cityInfo.civInfo.goldenAges.isGoldenAge())
|
||||
newStatPercentBonusList["Policies"] = getStatPercentBonusesFromPolicies()
|
||||
newStatPercentBonusList["Policies"] = getStatPercentBonusesFromUniques(cityInfo.civInfo.policies.policyEffects)
|
||||
newStatPercentBonusList["Buildings"] = getStatPercentBonusesFromBuildings()
|
||||
newStatPercentBonusList["Railroad"] = getStatPercentBonusesFromRailroad()
|
||||
newStatPercentBonusList["Marble"] = getStatPercentBonusesFromMarble()
|
||||
|
|
|
@ -178,8 +178,9 @@ class CivilizationInfo {
|
|||
|
||||
fun hasResource(resourceName:String): Boolean = getCivResourcesByName()[resourceName]!!>0
|
||||
|
||||
private fun getCivUniques() = nation.uniques.asSequence() + policies.policyEffects.asSequence() +
|
||||
cities.asSequence().flatMap { it.getBuildingUniques() }
|
||||
fun getBuildingUniques() = cities.asSequence().flatMap { it.getBuildingUniques() }
|
||||
|
||||
private fun getCivUniques() = nation.uniques.asSequence() + policies.policyEffects.asSequence() + getBuildingUniques()
|
||||
|
||||
fun hasUnique(unique:String) = getCivUniques().contains(unique)
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class Nation : INamed {
|
|||
|
||||
lateinit var outerColor: List<Int>
|
||||
var unique: UniqueAbility? = null
|
||||
val uniques = ArrayList<String>()
|
||||
val uniques = HashSet<String>()
|
||||
var innerColor: List<Int>? = null
|
||||
var startBias = ArrayList<String>()
|
||||
|
||||
|
|
Loading…
Reference in a new issue