Added custom victory conditions

This commit is contained in:
Yair Morgenstern 2021-02-05 16:06:58 +02:00
parent 84c200bd32
commit b0bf18afa0
4 changed files with 19 additions and 11 deletions

View File

@ -89,7 +89,8 @@
{
"name": "Honor",
"era": "Ancient era",
"uniques": ["+25% bonus vs Barbarians", "Earn [100]% of [Barbarian] opponent's [Strength] as [Culture] for kills", "Notified of new Barbarian encampments"],
"uniques": ["+25% bonus vs Barbarians", "Earn [100]% of [Barbarian] opponent's [Strength] as [Culture] for kills",
"Notified of new Barbarian encampments"],
"policies": [
{
"name": "Warrior Code",
@ -112,7 +113,7 @@
},
{
"name": "Military Caste",
"uniques": ["[+1 Happiness, +2 Culture] in all cities with a garrison"],
"uniques": ["[+1 Happiness, +2 Culture] [in all cities with a garrison]"],
"requires": ["Discipline"],
"row": 2,
"column": 4

View File

@ -694,9 +694,11 @@ Destroy all enemies\n to win! =
You have won a scientific victory! =
You have won a cultural victory! =
You have won a domination victory! =
You have won! =
You have achieved victory through the awesome power of your Culture. Your civilization's greatness - the magnificence of its monuments and the power of its artists - have astounded the world! Poets will honor you as long as beauty brings gladness to a weary heart. =
The world has been convulsed by war. Many great and powerful civilizations have fallen, but you have survived - and emerged victorious! The world will long remember your glorious triumph! =
You have achieved victory through mastery of Science! You have conquered the mysteries of nature and led your people on a voyage to a brave new world! Your triumph will be remembered as long as the stars burn in the night sky! =
Your civilization stands above all others! The exploits of your people shall be remembered until the end of civilizaton itself! =
You have been defeated. Your civilization has been overwhelmed by its many foes. But your people do not despair, for they know that one day you shall return - and lead them forward to victory! =
One more turn...! =
Built Apollo Program =

View File

@ -4,7 +4,8 @@ import com.unciv.models.Counter
import com.unciv.models.ruleset.VictoryType
class VictoryManager {
@Transient lateinit var civInfo: CivilizationInfo
@Transient
lateinit var civInfo: CivilizationInfo
var requiredSpaceshipParts = Counter<String>()
var currentsSpaceshipParts = Counter<String>()
@ -32,10 +33,10 @@ class VictoryManager {
private fun hasVictoryType(victoryType: VictoryType) = civInfo.gameInfo.gameParameters.victoryTypes.contains(victoryType)
fun hasWonScientificVictory() = hasVictoryType(VictoryType.Scientific) && spaceshipPartsRemaining()==0
fun hasWonScientificVictory() = hasVictoryType(VictoryType.Scientific) && spaceshipPartsRemaining() == 0
fun hasWonCulturalVictory() = hasVictoryType(VictoryType.Cultural)
&& civInfo.policies.adoptedPolicies.count{it.endsWith("Complete")} > 4
&& civInfo.policies.adoptedPolicies.count { it.endsWith("Complete") } > 4
fun hasWonDominationVictory(): Boolean {
return (hasVictoryType(VictoryType.Domination) || hasVictoryType(VictoryType.Scenario)) &&
@ -43,12 +44,13 @@ class VictoryManager {
}
fun hasWonVictoryType(): VictoryType? {
if(!civInfo.isMajorCiv()) return null
if(hasWonDominationVictory()) return VictoryType.Domination
if(hasWonScientificVictory()) return VictoryType.Scientific
if(hasWonCulturalVictory()) return VictoryType.Cultural
if (!civInfo.isMajorCiv()) return null
if (hasWonDominationVictory()) return VictoryType.Domination
if (hasWonScientificVictory()) return VictoryType.Scientific
if (hasWonCulturalVictory()) return VictoryType.Cultural
if (civInfo.hasUnique("Triggers victory")) return VictoryType.Neutral
return null
}
fun hasWon() = hasWonVictoryType()!=null
}
fun hasWon() = hasWonVictoryType() != null
}

View File

@ -58,6 +58,7 @@ class VictoryScreen(val worldScreen: WorldScreen) : PickerScreen() {
VictoryType.Cultural -> wonOrLost("You have won a cultural victory!")
VictoryType.Domination -> wonOrLost("You have won a domination victory!") // todo change translation
VictoryType.Scientific -> wonOrLost("You have won a scientific victory!")
VictoryType.Neutral -> wonOrLost("You have won!")
}
}
for (civ in game.gameInfo.civilizations.filter { it.isMajorCiv() && it != playerCivInfo }) {
@ -69,6 +70,7 @@ class VictoryScreen(val worldScreen: WorldScreen) : PickerScreen() {
VictoryType.Cultural -> wonOrLost("[$winningCivName] has won a cultural victory!")
VictoryType.Domination -> wonOrLost("[$winningCivName] has won a domination victory!")
VictoryType.Scientific -> wonOrLost("[$winningCivName] has won a scientific victory!")
VictoryType.Neutral -> wonOrLost("[$winningCivName] has won!")
}
}
}
@ -88,6 +90,7 @@ class VictoryScreen(val worldScreen: WorldScreen) : PickerScreen() {
"You have won a cultural victory!" -> "You have achieved victory through the awesome power of your Culture. Your civilization's greatness - the magnificence of its monuments and the power of its artists - have astounded the world! Poets will honor you as long as beauty brings gladness to a weary heart."
"You have won a domination victory!" -> "The world has been convulsed by war. Many great and powerful civilizations have fallen, but you have survived - and emerged victorious! The world will long remember your glorious triumph!"
"You have won a scientific victory!" -> "You have achieved victory through mastery of Science! You have conquered the mysteries of nature and led your people on a voyage to a brave new world! Your triumph will be remembered as long as the stars burn in the night sky!"
"You have won!" -> "Your civilization stands above all others! The exploits of your people shall be remembered until the end of civilizaton itself!"
else -> "You have been defeated. Your civilization has been overwhelmed by its many foes. But your people do not despair, for they know that one day you shall return - and lead them forward to victory!"
}