mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-31 07:09:26 +07:00
City state resources (#4755)
* Ai now cares about distance from it's cities * Ai now cares about distance from it's cities * Ai now cares about distance from it's cities * Ai will pay extra pay extra for bordering cities or surrounding cities * Ai will pay extra pay extra for bordering cities or surrounding cities * Ai will pay extra for cities that are closer to their territory * The code is cleaner * The code is cleaner * The code is cleaner * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * You can now gift improvements to the ai * You can now gift improvements to the ai * You can now gift improvements to the ai * Ai now cares about distance from it's cities * Ai now cares about distance from it's cities * Ai will pay extra pay extra for bordering cities or surrounding cities * Ai will pay extra pay extra for bordering cities or surrounding cities * Ai will pay extra for cities that are closer to their territory * The code is cleaner * The code is cleaner * The code is cleaner * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * You can now gift improvements to the ai * You can now gift improvements to the ai * You can now gift improvements to the ai * You can now gift improvements to the ai * Ai now cares about distance from it's cities * Ai now cares about distance from it's cities * Ai now cares about distance from it's cities * Ai will pay extra pay extra for bordering cities or surrounding cities * Ai will pay extra pay extra for bordering cities or surrounding cities * Ai will pay extra for cities that are closer to their territory * The code is cleaner * The code is cleaner * The code is cleaner * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * Ai now values distance * You can now gift improvements to the ai * You can now gift improvements to the ai * You can now gift improvements to the ai * You can now gift improvements to the ai * You can now gift improvements to the ai * You can now gift improvements to the ai * You can now gift improvements to the ai * You can now gift improvements to the ai * You can now gift improvements to the ai * You can now gift improvements to the ai * You can now gift improvements to the ai * You can now gift improvements to the ai * You can now gift improvements to the ai * You can now gift improvements to the ai * You can now gift improvements to the ai * You can now gift improvements to the ai * You can now gift improvements to the ai * Update template.properties
This commit is contained in:
@ -158,6 +158,9 @@ Protected by =
|
||||
Revoke Protection =
|
||||
Pledge to protect =
|
||||
Declare Protection of [cityStateName]? =
|
||||
Build [improvementName] on [resourceName] (200 Gold) =
|
||||
Gift Improvement =
|
||||
|
||||
|
||||
Cultured =
|
||||
Maritime =
|
||||
|
@ -667,6 +667,8 @@ class CityInfo {
|
||||
.map { it.getOwner()?.civName }.filterNotNull().toSet()
|
||||
.distinct().toList()
|
||||
}
|
||||
fun getImprovableTiles(): Sequence<TileInfo> = getTiles()
|
||||
.filter {it.hasViewableResource(civInfo) && it.improvement == null}
|
||||
|
||||
|
||||
//endregion
|
||||
|
@ -175,6 +175,29 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() {
|
||||
diplomacyTable.add(giveGiftButton).row()
|
||||
if (isNotPlayersTurn()) giveGiftButton.disable()
|
||||
|
||||
val improvableTiles = otherCiv.getCapital().getImprovableTiles().filterNot {it.getTileResource().resourceType == ResourceType.Bonus}.toList()
|
||||
val improvements = otherCiv.gameInfo.ruleSet.tileImprovements.filter { it.value.turnsToBuild != 0 }
|
||||
var needsImprovements = false
|
||||
|
||||
for (improvableTile in improvableTiles)
|
||||
for (tileImprovement in improvements.values)
|
||||
if (improvableTile.canBuildImprovement(tileImprovement, otherCiv) && improvableTile.getTileResource().improvement == tileImprovement.name)
|
||||
needsImprovements = true
|
||||
|
||||
|
||||
val improveTileButton = "Gift Improvement".toTextButton()
|
||||
improveTileButton.onClick {
|
||||
rightSideTable.clear()
|
||||
rightSideTable.add(ScrollPane(getImprovementGiftTable(otherCiv)))
|
||||
}
|
||||
|
||||
|
||||
if (isNotPlayersTurn() || otherCivDiplomacyManager.influence < 60 || !needsImprovements)
|
||||
improveTileButton.disable()
|
||||
|
||||
|
||||
|
||||
diplomacyTable.add(improveTileButton).row()
|
||||
if (otherCivDiplomacyManager.diplomaticStatus == DiplomaticStatus.Protector){
|
||||
val revokeProtectionButton = "Revoke Protection".toTextButton()
|
||||
revokeProtectionButton.onClick {
|
||||
@ -258,6 +281,39 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() {
|
||||
diplomacyTable.add(backButton)
|
||||
return diplomacyTable
|
||||
}
|
||||
private fun getImprovementGiftTable(otherCiv: CivilizationInfo): Table{
|
||||
val improvementGiftTable = getCityStateDiplomacyTableHeader(otherCiv)
|
||||
improvementGiftTable.addSeparator()
|
||||
|
||||
val improvableTiles = otherCiv.getCapital().getImprovableTiles().filterNot {it.getTileResource().resourceType == ResourceType.Bonus}.toList()
|
||||
val tileImprovements = otherCiv.gameInfo.ruleSet.tileImprovements.filter { it.value.turnsToBuild != 0 }
|
||||
|
||||
for (improvableTile in improvableTiles){
|
||||
for (tileImprovement in tileImprovements.values){
|
||||
if (improvableTile.canBuildImprovement(tileImprovement, otherCiv) && improvableTile.getTileResource().improvement == tileImprovement.name){
|
||||
val improveTileButton = "Build [${tileImprovement}] on [${improvableTile.getTileResource()}] (200 Gold)".toTextButton()
|
||||
improveTileButton.onClick {
|
||||
viewingCiv.giveGoldGift(otherCiv, 200)
|
||||
improvableTile.improvement = tileImprovement.name
|
||||
rightSideTable.clear()
|
||||
rightSideTable.add(ScrollPane(getCityStateDiplomacyTable(otherCiv)))
|
||||
}
|
||||
if (viewingCiv.gold < 200)
|
||||
improveTileButton.disable()
|
||||
improvementGiftTable.add(improveTileButton).row()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val backButton = "Back".toTextButton()
|
||||
backButton.onClick {
|
||||
rightSideTable.clear()
|
||||
rightSideTable.add(ScrollPane(getCityStateDiplomacyTable(otherCiv)))
|
||||
}
|
||||
improvementGiftTable.add(backButton)
|
||||
return improvementGiftTable
|
||||
|
||||
}
|
||||
|
||||
private fun getQuestTable(assignedQuest: AssignedQuest): Table {
|
||||
val questTable = Table()
|
||||
|
Reference in New Issue
Block a user