From aa73fa130ea4df41772ba02e7d8971393864b480 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Thu, 12 Dec 2019 23:57:02 +0200 Subject: [PATCH] More tutorial tasks --- core/src/com/unciv/logic/battle/Battle.kt | 5 ++++- .../src/com/unciv/models/metadata/GameSettings.kt | 4 ++-- .../src/com/unciv/ui/worldscreen/TileMapHolder.kt | 2 ++ core/src/com/unciv/ui/worldscreen/WorldScreen.kt | 15 ++++++++++++++- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/core/src/com/unciv/logic/battle/Battle.kt b/core/src/com/unciv/logic/battle/Battle.kt index d5a909cd46..7af682c8d8 100644 --- a/core/src/com/unciv/logic/battle/Battle.kt +++ b/core/src/com/unciv/logic/battle/Battle.kt @@ -2,6 +2,7 @@ package com.unciv.logic.battle import com.badlogic.gdx.graphics.Color import com.unciv.Constants +import com.unciv.UncivGame import com.unciv.logic.GameInfo import com.unciv.logic.automation.UnitAutomation import com.unciv.logic.city.CityInfo @@ -254,8 +255,10 @@ class Battle(val gameInfo:GameInfo) { return } - if (attackerCiv.isPlayerCivilization()) + if (attackerCiv.isPlayerCivilization()) { attackerCiv.popupAlerts.add(PopupAlert(AlertType.CityConquered, city.name)) + UncivGame.Current.settings.addCompletedTutorialTask("Conquer a city") + } else { city.puppetCity(attackerCiv) if (city.population.population < 4) { diff --git a/core/src/com/unciv/models/metadata/GameSettings.kt b/core/src/com/unciv/models/metadata/GameSettings.kt index 568e33b57c..49e33acf05 100644 --- a/core/src/com/unciv/models/metadata/GameSettings.kt +++ b/core/src/com/unciv/models/metadata/GameSettings.kt @@ -9,8 +9,8 @@ class GameSettings { var singleTapMove: Boolean = false var language: String = "English" var resolution: String = "900x600" - var tutorialsShown = ArrayList() - var tutorialTasksCompleted = ArrayList() + var tutorialsShown = HashSet() + var tutorialTasksCompleted = HashSet() var hasCrashedRecently = false var soundEffectsVolume = 0.5f var musicVolume = 0.5f diff --git a/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt b/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt index 9f39f40075..4e06dd8148 100644 --- a/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt +++ b/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt @@ -205,6 +205,8 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap: if (dto.unit.currentMovement > 0) moveHereButton.onClick(""){ UncivGame.Current.settings.addCompletedTutorialTask("Move unit") + if(dto.unit.type.isAirUnit()) + UncivGame.Current.settings.addCompletedTutorialTask("Move an air unit") UnitContextMenu(this, dto.unit, dto.tileInfo).onMoveButtonClick() } diff --git a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt index b7f8184bea..278a7b0008 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt @@ -223,7 +223,8 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() { if(!completedTasks.contains("Enter city screen")) return "Enter the city screen!\nClick the city button twice" if(!completedTasks.contains("Pick technology")) - return "Pick a technology to research!\nClick on the tech button (greenish, top left) > \n select technology > click 'Research' (bottom right)" + return "Pick a technology to research!\nClick on the tech button (greenish, top left) > " + + "\n select technology > click 'Research' (bottom right)" if(!completedTasks.contains("Pick construction")) return "Pick a construction!\nEnter city screen > Click on a unit or building (left side)" if(!completedTasks.contains("Pass a turn")) @@ -239,6 +240,18 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() { return "Construct an improvement!\nConstruct a Worker unit > Move to a Plains or Grassland tile > " + "\n Choose 'Create improvement' > Choose the farm > " + "\n Leave the worker there until it's finished" + if(!completedTasks.contains("Create a trade route") + && viewingCiv.citiesConnectedToCapital.any { it.civInfo==viewingCiv }) + game.settings.addCompletedTutorialTask("Create a trade route") + if(viewingCiv.cities.size>1 && !completedTasks.contains("Create a trade route")) + return "Create a trade route!\nConstruct roads between your capital and another city" + + "\nOr, automate your worker and let him get to that eventually" + if(viewingCiv.isAtWar() && !completedTasks.contains("Conquer a city")) + return "Conquer a city!\nBring an enemy city down to low health > " + + "\nEnter the city with a melee unit" + if(viewingCiv.getCivUnits().any { it.type.isAirUnit() } && !completedTasks.contains("Move an air unit")) + return "Move an air unit!\nSelect an air unit > select another city withing range > " + + "\nMove the unit to the other city" return "" }