Can no longer adopt policies after being defeated

This commit is contained in:
Yair Morgenstern
2019-09-07 21:24:28 +03:00
parent 53aaceb06b
commit c9f6ba958f
6 changed files with 22 additions and 12 deletions

View File

@ -395,7 +395,12 @@ class CivilizationInfo {
notifications.add(Notification(text, color, action))
}
fun addGreatPerson(greatPerson: String, city:CityInfo = cities.random()) {
fun addGreatPerson(greatPerson: String){
if(cities.isEmpty()) return
addGreatPerson(greatPerson, cities.random())
}
fun addGreatPerson(greatPerson: String, city:CityInfo) {
placeUnitNearTile(city.location, greatPerson)
addNotification("A [$greatPerson] has been born!".tr(), city.location, Color.GOLD)
}

View File

@ -118,13 +118,13 @@ class VictoryScreen : PickerScreen() {
fun scienceVictoryColumn():Table{
val t = Table()
t.defaults().pad(5f)
t.add(getMilestone("Built Apollo Program".tr(),playerCivInfo.containsBuildingUnique("Enables construction of Spaceship parts"))).row()
t.add(getMilestone("Built Apollo Program",playerCivInfo.containsBuildingUnique("Enables construction of Spaceship parts"))).row()
val victoryManager= playerCivInfo.victoryManager
for (key in victoryManager.requiredSpaceshipParts.keys)
for (i in 0 until victoryManager.requiredSpaceshipParts[key]!!)
t.add(getMilestone(key.tr(), victoryManager.currentsSpaceshipParts[key]!! > i)).row() //(key, builtSpaceshipParts)
t.add(getMilestone(key, victoryManager.currentsSpaceshipParts[key]!! > i)).row() //(key, builtSpaceshipParts)
return t
}
@ -134,7 +134,7 @@ class VictoryScreen : PickerScreen() {
t.defaults().pad(5f)
for(branch in GameBasics.PolicyBranches.values) {
val finisher = branch.policies.last().name
t.add(getMilestone(finisher.tr(), playerCivInfo.policies.isAdopted(finisher))).row()
t.add(getMilestone(finisher, playerCivInfo.policies.isAdopted(finisher))).row()
}
return t
}
@ -147,13 +147,13 @@ class VictoryScreen : PickerScreen() {
val civName =
if (playerCivInfo.diplomacy.containsKey(civ.civName)) civ.civName
else "???"
table.add(getMilestone("Destroy [$civName]".tr(), civ.isDefeated())).row()
table.add(getMilestone("Destroy [$civName]", civ.isDefeated())).row()
}
return table
}
fun getMilestone(text:String, achieved:Boolean): TextButton {
val textButton = TextButton(text,skin)
val textButton = TextButton(text.tr(),skin)
if(achieved) textButton.color = Color.GREEN
else textButton.color = Color.GRAY
return textButton
@ -175,7 +175,7 @@ class VictoryScreen : PickerScreen() {
private fun getGlobalDominationVictoryColumn(majorCivs: List<CivilizationInfo>): Table {
val dominationVictoryColumn = Table().apply { defaults().pad(10f) }
dominationVictoryColumn.add("Undefeated civs".tr().toLabel()).row()
dominationVictoryColumn.add("Undefeated civs".toLabel()).row()
dominationVictoryColumn.addSeparator()
for (civ in majorCivs.filter { !it.isDefeated() })
@ -189,7 +189,7 @@ class VictoryScreen : PickerScreen() {
private fun getGlobalCulturalVictoryColumn(majorCivs: List<CivilizationInfo>): Table {
val policyVictoryColumn = Table().apply { defaults().pad(10f) }
policyVictoryColumn.add("Branches completed".tr().toLabel()).row()
policyVictoryColumn.add("Branches completed".toLabel()).row()
policyVictoryColumn.addSeparator()
data class civToBranchesCompleted(val civ: CivilizationInfo, val branchesCompleted: Int)
@ -206,7 +206,7 @@ class VictoryScreen : PickerScreen() {
private fun getGlobalScientificVictoryColumn(majorCivs: List<CivilizationInfo>): Table {
val scientificVictoryColumn = Table().apply { defaults().pad(10f) }
scientificVictoryColumn.add("Spaceship parts remaining".tr().toLabel()).row()
scientificVictoryColumn.add("Spaceship parts remaining".toLabel()).row()
scientificVictoryColumn.addSeparator()
data class civToSpaceshipPartsRemaining(val civ: CivilizationInfo, val partsRemaining: Int)

View File

@ -80,6 +80,7 @@ class PolicyPickerScreen(val worldScreen: WorldScreen) : PickerScreen() {
private fun pickPolicy(policy: Policy) {
if (!worldScreen.isPlayersTurn
|| viewingCiv.isDefeated()
|| viewingCiv.policies.isAdopted(policy.name)
|| policy.name.endsWith("Complete")
|| !viewingCiv.policies.isAdoptable(policy)

View File

@ -111,7 +111,7 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() {
if (otherCivDiplomacyManager.relationshipLevel() >= RelationshipLevel.Friend) {
friendBonusLabel.setFontColor(Color.GREEN)
val turnsToRelationshipChange = otherCivDiplomacyManager.influence.toInt() - 30 + 1
diplomacyTable.add("Relationship changes in another [$turnsToRelationshipChange] turns".tr().toLabel()).row()
diplomacyTable.add("Relationship changes in another [$turnsToRelationshipChange] turns".toLabel()).row()
} else
friendBonusLabel.setFontColor(Color.GRAY)

View File

@ -27,8 +27,8 @@ class TradePopup(worldScreen: WorldScreen): PopupTable(worldScreen){
val trade = tradeRequest.trade
val tradeOffersTable = Table().apply { defaults().pad(10f) }
tradeOffersTable.add("[${translatedNation.getNameTranslation()}]'s trade offer".tr().toLabel())
tradeOffersTable.add("Our trade offer".tr().toLabel())
tradeOffersTable.add("[${translatedNation.getNameTranslation()}]'s trade offer".toLabel())
tradeOffersTable.add("Our trade offer".toLabel())
tradeOffersTable.row()
for(i in 0..max(trade.theirOffers.lastIndex, trade.ourOffers.lastIndex)){
if(trade.theirOffers.lastIndex>=i) tradeOffersTable.add(trade.theirOffers[i].getOfferText().toLabel())