From bf823f58835af60483d9f8b1b4dd97a8a254a044 Mon Sep 17 00:00:00 2001 From: Jack Rainy Date: Sat, 11 Apr 2020 21:44:34 +0300 Subject: [PATCH] Display the "Natural Wonders" tutorial (#2371) * Update Tutorials.json Added tutorial for Natural Wonders * Enable displaying the Natural Wonders tutorial * Display the tutorial when the wonder is found automatically * Minor performance optimization * Removing debug leftovers See also 33da0e3a7fde87857b6c7112f4aec3daf5c76608 Co-authored-by: Giuseppe D'Addio <41149920+Smashfanful@users.noreply.github.com> --- android/assets/jsons/Tutorials.json | 3 +++ core/src/com/unciv/models/Tutorial.kt | 1 + core/src/com/unciv/ui/worldscreen/WorldScreen.kt | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/android/assets/jsons/Tutorials.json b/android/assets/jsons/Tutorials.json index b8874d7421..58a590f6e8 100644 --- a/android/assets/jsons/Tutorials.json +++ b/android/assets/jsons/Tutorials.json @@ -177,4 +177,7 @@ "Instead, diplomatic relations with city-states are determined by Influence - a meter of 'how much the City-state likes you'.\nInfluence can be increased by attacking their enemies, liberating their city, and giving them sums of gold.", "Certain bonuses are given when you are at above 30 influence.\nWhen you have above 60 Influence, and you have the highest influence with them of all civilizations, you are considered their 'Ally', and gain further bonuses and access to the Luxury and Strategic resources in their lands." ] + Natural_Wonders: [ + "Natural Wonders, such as the Mt. Fuji, the Rock of Gibraltar and the Great Barrier Reef, are unique, impassable terrain features, masterpieces of mother Nature, which possess exceptional qualities that make them very different from the average terrain.\nThey benefit by giving you large sums of Culture, Science, Gold or Production if worked by your Cities, which is why you might need to bring them under your empire as soon as possible." + ] } diff --git a/core/src/com/unciv/models/Tutorial.kt b/core/src/com/unciv/models/Tutorial.kt index 33ef0af8d9..517c89a8c4 100644 --- a/core/src/com/unciv/models/Tutorial.kt +++ b/core/src/com/unciv/models/Tutorial.kt @@ -31,6 +31,7 @@ enum class Tutorial(val value: String, val isCivilopedia: Boolean = !value.start Combat("Combat"), ResearchAgreements("Research_Agreements"), CityStates("City-States"), + NaturalWonders("Natural_Wonders"), ; companion object { diff --git a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt index bf828b785d..2f32abad9e 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt @@ -572,6 +572,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() { } private fun showTutorialsOnNextTurn(){ + if (!UncivGame.Current.settings.showTutorials) return displayTutorial(Tutorial.SlowStart) displayTutorial(Tutorial.BarbarianEncountered) { viewingCiv.viewableTiles.any { it.getUnits().any { unit -> unit.civInfo.isBarbarian() } } } displayTutorial(Tutorial.RoadsAndRailroads) { viewingCiv.cities.size > 2 } @@ -581,7 +582,6 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() { displayTutorial(Tutorial.IdleUnits) { gameInfo.turns >= 50 && UncivGame.Current.settings.checkForDueUnits } displayTutorial(Tutorial.ContactMe) { gameInfo.turns >= 100 } val resources = viewingCiv.detailedCivResources.asSequence().filter { it.origin == "All" } // Avoid full list copy - val test = viewingCiv.getCivResources() displayTutorial(Tutorial.LuxuryResource) { resources.any { it.resource.resourceType==ResourceType.Luxury } } displayTutorial(Tutorial.StrategicResource) { resources.any { it.resource.resourceType==ResourceType.Strategic} } displayTutorial(Tutorial.EnemyCity) { @@ -591,6 +591,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() { displayTutorial(Tutorial.ApolloProgram) { viewingCiv.containsBuildingUnique("Enables construction of Spaceship parts") } displayTutorial(Tutorial.SiegeUnits) { viewingCiv.getCivUnits().any { it.type == UnitType.Siege } } displayTutorial(Tutorial.Embarking) { viewingCiv.tech.getTechUniques().contains("Enables embarkation for land units") } + displayTutorial(Tutorial.NaturalWonders) { viewingCiv.naturalWonders.size > 0 } } private fun backButtonAndESCHandler() {