Victory screen now contains Conquest victory

This commit is contained in:
Yair Morgenstern 2018-05-06 18:15:44 +03:00
parent be5cd0c334
commit 3eaf1afef4
2 changed files with 24 additions and 5 deletions

View File

@ -184,4 +184,6 @@ class CivilizationInfo {
}
override fun toString(): String {return civName} // for debug
fun isDefeated()= cities.isEmpty() && !getCivUnits().any{it.name=="Settler"}
}

View File

@ -17,24 +17,31 @@ class VictoryScreen : PickerScreen() {
topTable.defaults().pad(10f)
topTable.add("Science victory")
topTable.add("Cultural victory")
topTable.add("Conquest victory")
topTable.row()
topTable.add(scienceVictoryColumn())
topTable.add(culturalVictoryColumn())
topTable.add(conquestVictoryColumn())
topTable.row()
topTable.add("Complete all the spaceship parts to win!")
topTable.add("Complete 4 policy branches to win!")
topTable.add("Complete all the spaceship parts\n to win!")
topTable.add("Complete 4 policy branches\n to win!")
topTable.add("Destroy all enemies\n to win!")
rightSideButton.isVisible=false
if(civInfo.scienceVictory.hasWon()){
rightSideButton.setText("Start new game")
rightSideButton.isVisible=true
closeButton.isVisible=false
descriptionLabel.setText("You have won a scientific victory!")
won()
}
if(civInfo.policies.adoptedPolicies.count{it.endsWith("Complete")} > 3){
descriptionLabel.setText("You have won a cultural victory!")
won()
}
if(civInfo.gameInfo.civilizations.all { it.isPlayerCivilization() || it.isDefeated() }){
descriptionLabel.setText("You have won a cultural victory!")
won()
}
}
@ -69,6 +76,16 @@ class VictoryScreen : PickerScreen() {
return t
}
fun conquestVictoryColumn():Table{
val t=Table()
t.defaults().pad(5f)
for (civ in civInfo.gameInfo.civilizations){
if(civ.isPlayerCivilization() || civ == civInfo.gameInfo.getBarbarianCivilization()) continue
t.add(getMilestone("Destroy "+civ.civName, civ.isDefeated())).row()
}
return t
}
fun getMilestone(text:String, achieved:Boolean): TextButton {
val TB = TextButton(text,skin)
if(achieved) TB.setColor(Color.GREEN)