mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-21 13:18:56 +07:00
Reorganized the way city states grant resources & rounded a float to an int (#6210)
* Reorganized the way city states grant resources & rounded a float to an int * Reworded a string so it sounds nicer
This commit is contained in:
@ -237,15 +237,20 @@ Hostile =
|
|||||||
Irrational =
|
Irrational =
|
||||||
Personality =
|
Personality =
|
||||||
Influence =
|
Influence =
|
||||||
|
|
||||||
|
Ally: [civilization] with [amount] Influence =
|
||||||
Reach 30 for friendship. =
|
Reach 30 for friendship. =
|
||||||
Reach highest influence above 60 for alliance. =
|
Reach highest influence above 60 for alliance. =
|
||||||
When Friends: =
|
When Friends: =
|
||||||
When Allies: =
|
When Allies: =
|
||||||
The unique luxury is one of: =
|
The unique luxury is one of: =
|
||||||
|
|
||||||
Demand Tribute =
|
Demand Tribute =
|
||||||
Tribute Willingness =
|
Tribute Willingness =
|
||||||
At least 0 to take gold, at least 30 and size 4 city for worker =
|
At least 0 to take gold, at least 30 and size 4 city for worker =
|
||||||
|
Take [amount] gold (-15 Influence) =
|
||||||
|
Take worker (-50 Influence) =
|
||||||
|
[civName] is afraid of your military power! =
|
||||||
|
|
||||||
Major Civ =
|
Major Civ =
|
||||||
No Cities =
|
No Cities =
|
||||||
Base value =
|
Base value =
|
||||||
@ -259,9 +264,7 @@ Influence below -30 =
|
|||||||
Military Rank =
|
Military Rank =
|
||||||
Military near City-State =
|
Military near City-State =
|
||||||
Sum: =
|
Sum: =
|
||||||
Take [amount] gold (-15 Influence) =
|
|
||||||
Take worker (-50 Influence) =
|
|
||||||
[civName] is afraid of your military power! =
|
|
||||||
|
|
||||||
|
|
||||||
# Trades
|
# Trades
|
||||||
|
@ -4,6 +4,7 @@ import com.unciv.logic.automation.NextTurnAutomation
|
|||||||
import com.unciv.logic.civilization.diplomacy.*
|
import com.unciv.logic.civilization.diplomacy.*
|
||||||
import com.unciv.models.metadata.GameSpeed
|
import com.unciv.models.metadata.GameSpeed
|
||||||
import com.unciv.models.ruleset.Ruleset
|
import com.unciv.models.ruleset.Ruleset
|
||||||
|
import com.unciv.models.ruleset.tile.ResourceSupplyList
|
||||||
import com.unciv.models.ruleset.unique.Unique
|
import com.unciv.models.ruleset.unique.Unique
|
||||||
import com.unciv.models.ruleset.unique.UniqueType
|
import com.unciv.models.ruleset.unique.UniqueType
|
||||||
import com.unciv.models.stats.Stat
|
import com.unciv.models.stats.Stat
|
||||||
@ -650,5 +651,14 @@ class CityStateFunctions(val civInfo: CivilizationInfo) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getCityStateResourcesForAlly(): ResourceSupplyList {
|
||||||
|
val newDetailedCivResources = ResourceSupplyList()
|
||||||
|
for (city in civInfo.cities) {
|
||||||
|
for (resourceSupply in city.getCityResources())
|
||||||
|
if (resourceSupply.amount > 0) // IGNORE the fact that they consume their own resources - #4769
|
||||||
|
newDetailedCivResources.add(resourceSupply.resource, resourceSupply.amount, "City-States")
|
||||||
|
}
|
||||||
|
return newDetailedCivResources
|
||||||
|
}
|
||||||
}
|
}
|
@ -172,14 +172,12 @@ class CivInfoTransientUpdater(val civInfo: CivilizationInfo) {
|
|||||||
var resourceBonusPercentage = 1f
|
var resourceBonusPercentage = 1f
|
||||||
for (unique in civInfo.getMatchingUniques(UniqueType.CityStateResources))
|
for (unique in civInfo.getMatchingUniques(UniqueType.CityStateResources))
|
||||||
resourceBonusPercentage += unique.params[0].toFloat() / 100
|
resourceBonusPercentage += unique.params[0].toFloat() / 100
|
||||||
for (city in civInfo.getKnownCivs().filter { it.getAllyCiv() == civInfo.civName }
|
for (cityStateAlly in civInfo.getKnownCivs().filter { it.getAllyCiv() == civInfo.civName }) {
|
||||||
.flatMap { it.cities }) {
|
for (resource in CityStateFunctions(cityStateAlly).getCityStateResourcesForAlly()) {
|
||||||
for (resourceSupply in city.getCityResources())
|
newDetailedCivResources.add(
|
||||||
if (resourceSupply.origin != "Buildings") // IGNORE the fact that they consume their own resources - #4769
|
resource.apply { amount = (amount * resourceBonusPercentage).toInt() }
|
||||||
newDetailedCivResources.add(
|
)
|
||||||
resourceSupply.resource,
|
}
|
||||||
(resourceSupply.amount * resourceBonusPercentage).toInt(), "City-States"
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +146,9 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo): BaseScreen() {
|
|||||||
if (otherCiv.detailedCivResources.any { it.resource.resourceType != ResourceType.Bonus }) {
|
if (otherCiv.detailedCivResources.any { it.resource.resourceType != ResourceType.Bonus }) {
|
||||||
val resourcesTable = Table()
|
val resourcesTable = Table()
|
||||||
resourcesTable.add("{Resources}: ".toLabel()).padRight(10f)
|
resourcesTable.add("{Resources}: ".toLabel()).padRight(10f)
|
||||||
for (supplyList in otherCiv.detailedCivResources) {
|
val cityStateResources = CityStateFunctions(otherCiv)
|
||||||
|
.getCityStateResourcesForAlly()
|
||||||
|
for (supplyList in cityStateResources) {
|
||||||
if (supplyList.resource.resourceType == ResourceType.Bonus)
|
if (supplyList.resource.resourceType == ResourceType.Bonus)
|
||||||
continue
|
continue
|
||||||
val name = supplyList.resource.name
|
val name = supplyList.resource.name
|
||||||
@ -172,9 +174,10 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo): BaseScreen() {
|
|||||||
otherCiv.updateAllyCivForCityState()
|
otherCiv.updateAllyCivForCityState()
|
||||||
val ally = otherCiv.getAllyCiv()
|
val ally = otherCiv.getAllyCiv()
|
||||||
if (ally != null) {
|
if (ally != null) {
|
||||||
val allyString = "{Ally}: {$ally} {Influence}: ".tr() +
|
val allyInfluence = otherCiv.getDiplomacyManager(ally).influence.toInt()
|
||||||
otherCiv.getDiplomacyManager(ally).influence.toString()
|
diplomacyTable
|
||||||
diplomacyTable.add(allyString.toLabel()).row()
|
.add("Ally: [$ally] with [$allyInfluence] Influence".toLabel())
|
||||||
|
.row()
|
||||||
}
|
}
|
||||||
|
|
||||||
val protectors = otherCiv.getProtectorCivs()
|
val protectors = otherCiv.getProtectorCivs()
|
||||||
|
Reference in New Issue
Block a user