Resolved #2929 - Can no longer destroy original capitals by nuke

This commit is contained in:
Yair Morgenstern 2020-08-02 16:17:20 +03:00
parent 01d6698b7a
commit 04d4c9c9bf
4 changed files with 28 additions and 21 deletions

View file

@ -59,6 +59,7 @@
"outerColor": [181, 232, 232],
"innerColor": [68,142,249],
"unique": "HELLENIC_LEAGUE",
"uniques": ["City-State Influence degrades at half rate", "City-State Influence recovers at twice the normal rate"]
"cities": ["Athens","Sparta","Corinth","Argos","Knossos","Mycenae","Pharsalos","Ephesus","Halicarnassus","Rhodes",
"Eretria","Pergamon","Miletos","Megara","Phocaea","Sicyon","Tiryns","Samos","Mytilene","Chios",
"Paros","Elis","Syracuse","Herakleia","Gortyn","Chalkis","Pylos","Pella","Naxos","Sicyon",
@ -83,6 +84,7 @@
"outerColor": [9, 112, 84],
"innerColor": [255,255,255],
"unique": "ART_OF_WAR",
"uniques": ["Great General provides double combat bonus", "[Great General] is earned [50]% faster"]
"cities": ["Beijing","Shanghai","Guangzhou","Nanjing","Xian","Chengdu","Hangzhou","Tianjin","Macau","Shandong",
"Kaifeng","Ningbo","Baoding","Yangzhou","Harbin","Chongqing","Luoyang","Kunming","Taipei","Shenyang",
"Taiyuan","Tainan","Dalian","Lijiang","Wuxi","Suzhou","Maoming","Shaoguan","Yangjiang","Heyuan","Huangshi",
@ -111,6 +113,7 @@
"outerColor": [ 231, 213, 0],
"innerColor": [98,10,210],
"unique": "MONUMENT_BUILDERS",
"uniques": ["+[20]% Production when constructing [Wonders]"]
"cities": ["Thebes","Memphis","Heliopolis","Elephantine","Alexandria","Pi-Ramesses","Giza","Byblos","Akhetaten",
"Hieraconpolis","Abydos","Asyut","Avaris","Lisht","Buto","Edfu","Pithom","Busiris","Kahun","Athribis",
"Mendes","Elashmunein","Tanis","Bubastis","Oryx","Sebennytus","Akhmin","Karnak","Luxor","El Kab","Armant",

View file

@ -245,7 +245,8 @@ object Battle {
if(thisCombatant.getCivInfo().isMajorCiv()) {
var greatGeneralPointsModifier = 1f
if (thisCombatant.getCivInfo().nation.unique == UniqueAbility.ART_OF_WAR)
// Yeah sue me I didn't parse these params
if (thisCombatant.getCivInfo().hasUnique("[Great General] is earned [50]% faster"))
greatGeneralPointsModifier += 0.5f
if (thisCombatant.unit.hasUnique("Combat very likely to create Great Generals"))
greatGeneralPointsModifier += 1f
@ -336,10 +337,10 @@ object Battle {
val city = tile.getCity()
if (city != null && city.location == tile.position) {
city.health = 1
if (city.population.population <= 5) {
if (city.population.population <= 5 && city.isOriginalCapital) {
city.destroyCity()
} else {
city.population.population -= 5
city.population.population = max(city.population.population-5, 1)
city.population.unassignExtraPopulation()
continue
}

View file

@ -330,10 +330,10 @@ class CityStats {
return stats
}
private fun getStatPercentBonusesFromPolicies(cityConstructions: CityConstructions): Stats {
private fun getStatPercentBonusesFromPolicies(): Stats {
val stats = Stats()
val currentConstruction = cityConstructions.getCurrentConstruction()
val currentConstruction = cityInfo.cityConstructions.getCurrentConstruction()
if (currentConstruction.name == Constants.settler && cityInfo.isCapital()
&& cityInfo.civInfo.hasUnique("Training of settlers increased +50% in capital"))
stats.production += 50f
@ -353,12 +353,13 @@ class CityStats {
val placeholderParams = unique.getPlaceholderParameters()
val filter = placeholderParams[1]
if (currentConstruction.name == filter
|| (filter=="military units" && currentConstruction is BaseUnit && !currentConstruction.unitType.isCivilian())
|| (filter=="Buildings" && currentConstruction is Building && !currentConstruction.isWonder))
|| (filter == "military units" && currentConstruction is BaseUnit && !currentConstruction.unitType.isCivilian())
|| (filter == "Buildings" && currentConstruction is Building && !currentConstruction.isWonder)
|| (filter == "Wonders" && currentConstruction is Building && currentConstruction.isWonder))
stats.production += placeholderParams[0].toInt()
}
if (cityConstructions.getBuiltBuildings().any { it.isWonder }
if (cityInfo.cityConstructions.getBuiltBuildings().any { it.isWonder }
&& cityInfo.civInfo.hasUnique("+33% culture in all cities with a world wonder"))
stats.culture += 33f
if (cityInfo.civInfo.hasUnique("+25% gold in capital") && cityInfo.isCapital())
@ -406,7 +407,7 @@ class CityStats {
fun updateStatPercentBonusList() {
val newStatPercentBonusList = LinkedHashMap<String, Stats>()
newStatPercentBonusList["Golden Age"] = getStatPercentBonusesFromGoldenAge(cityInfo.civInfo.goldenAges.isGoldenAge())
newStatPercentBonusList["Policies"] = getStatPercentBonusesFromPolicies(cityInfo.cityConstructions)
newStatPercentBonusList["Policies"] = getStatPercentBonusesFromPolicies()
newStatPercentBonusList["Buildings"] = getStatPercentBonusesFromBuildings()
newStatPercentBonusList["Railroad"] = getStatPercentBonusesFromRailroad()
newStatPercentBonusList["Marble"] = getStatPercentBonusesFromMarble()

View file

@ -167,19 +167,22 @@ class DiplomacyManager() {
return otherCivDiplomacy().getTurnsToRelationshipChange()
if (civInfo.isCityState() && !otherCiv().isCityState()) {
val hasCityStateInfluenceBonus = otherCiv().nation.unique == UniqueAbility.HELLENIC_LEAGUE
val dropPerTurn = if(hasCityStateInfluenceBonus) .5f else 1f
if (relationshipLevel() >= RelationshipLevel.Ally)
return ceil((influence - 60f) / dropPerTurn).toInt() + 1
else if (relationshipLevel() >= RelationshipLevel.Friend)
return ceil((influence - 30f) / dropPerTurn).toInt() + 1
else
return 0
val dropPerTurn = getCityStateInfluenceDegradeRate()
when {
relationshipLevel() >= RelationshipLevel.Ally -> return ceil((influence - 60f) / dropPerTurn).toInt() + 1
relationshipLevel() >= RelationshipLevel.Friend -> return ceil((influence - 30f) / dropPerTurn).toInt() + 1
else -> return 0
}
}
return 0
}
fun getCityStateInfluenceDegradeRate(): Float {
if(otherCiv().hasUnique("City-State Influence degrades at half rate"))
return .5f
else return 1f
}
fun canDeclareWar() = turnsToPeaceTreaty()==0 && diplomaticStatus != DiplomaticStatus.War
//Used for nuke
fun canAttack() = turnsToPeaceTreaty()==0
@ -288,9 +291,8 @@ class DiplomacyManager() {
private fun nextTurnCityStateInfluence() {
val initialRelationshipLevel = relationshipLevel()
val hasCityStateInfluenceBonus = otherCiv().nation.unique == UniqueAbility.HELLENIC_LEAGUE
val increment = if (hasCityStateInfluenceBonus) 2f else 1f
val decrement = if (hasCityStateInfluenceBonus) .5f else 1f
val increment = if (otherCiv().hasUnique("City-State Influence recovers at twice the normal rate")) 2f else 1f
val decrement = getCityStateInfluenceDegradeRate()
if (influence > restingPoint)
influence = max(restingPoint, influence - decrement)