mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 22:06:05 -04: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:
parent
8394930d6d
commit
2a3395882f
@ -158,6 +158,9 @@ Protected by =
|
|||||||
Revoke Protection =
|
Revoke Protection =
|
||||||
Pledge to protect =
|
Pledge to protect =
|
||||||
Declare Protection of [cityStateName]? =
|
Declare Protection of [cityStateName]? =
|
||||||
|
Build [improvementName] on [resourceName] (200 Gold) =
|
||||||
|
Gift Improvement =
|
||||||
|
|
||||||
|
|
||||||
Cultured =
|
Cultured =
|
||||||
Maritime =
|
Maritime =
|
||||||
|
@ -667,6 +667,8 @@ class CityInfo {
|
|||||||
.map { it.getOwner()?.civName }.filterNotNull().toSet()
|
.map { it.getOwner()?.civName }.filterNotNull().toSet()
|
||||||
.distinct().toList()
|
.distinct().toList()
|
||||||
}
|
}
|
||||||
|
fun getImprovableTiles(): Sequence<TileInfo> = getTiles()
|
||||||
|
.filter {it.hasViewableResource(civInfo) && it.improvement == null}
|
||||||
|
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
|
@ -175,6 +175,29 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() {
|
|||||||
diplomacyTable.add(giveGiftButton).row()
|
diplomacyTable.add(giveGiftButton).row()
|
||||||
if (isNotPlayersTurn()) giveGiftButton.disable()
|
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){
|
if (otherCivDiplomacyManager.diplomaticStatus == DiplomaticStatus.Protector){
|
||||||
val revokeProtectionButton = "Revoke Protection".toTextButton()
|
val revokeProtectionButton = "Revoke Protection".toTextButton()
|
||||||
revokeProtectionButton.onClick {
|
revokeProtectionButton.onClick {
|
||||||
@ -258,6 +281,39 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() {
|
|||||||
diplomacyTable.add(backButton)
|
diplomacyTable.add(backButton)
|
||||||
return diplomacyTable
|
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 {
|
private fun getQuestTable(assignedQuest: AssignedQuest): Table {
|
||||||
val questTable = Table()
|
val questTable = Table()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user