Various Quest relted (#3206)

* Renamed some quests to better ones (Kill Camp -> Clear Barbarian Camp and Kill City State -> Conquer City State)
* Quests names are hardcoded in a enum class
* Quests.json translations automated
This commit is contained in:
Federico Luongo 2020-10-01 20:08:26 +02:00 committed by GitHub
parent a4d1232403
commit 300c7179e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 30 deletions

View File

@ -6,7 +6,7 @@
},
/*
{
"name": "Kill Camp",
"name": "Clear Barbarian Camp",
"description": "We feel threatened by a Barbarian Camp near our city. Please take care of it.",
"type": "Global",
"influence": 50,
@ -14,30 +14,30 @@
},
{
"name": "Connect Resource",
"description": "In order to make our civilizations stronger, connect [Resource] to your trade network."
"description": "In order to make our civilizations stronger, connect [tileResource] to your trade network."
},*/
{
"name": "Construct Wonder",
"description": "We recommend you to start building [Wonder] to show the whole world your civilization strength."
},/*
"description": "We recommend you to start building [wonder] to show the whole world your civilization strength."
}/*,
{
"name": "Great Person",
"description": "Great People can change the course of a Civilization! You will be rewarded for acquiring a new [Great Person]."
"name": "Acquire Great Person",
"description": "Great People can change the course of a Civilization! You will be rewarded for acquiring a new [greatPerson]."
},
{
"name": "Kill City State",
"description": "You will be rewarded for destroying the city state of [Target]!",
"name": "Conquer City State",
"description": "You will be rewarded for conquering the city state of [cityState]!",
"influence": 80
},
{
"name": "Find Player",
"description": "You have yet to discover where [Civilization] set up their cities. You will be rewarded for finding their territories.",
"description": "You have yet to discover where [civName] set up their cities. You will be rewarded for finding their territories.",
"influence": 35
},
{
"name": "Find Natural Wonder",
"description": "Send your best explorers on a quest to discover Natural Wonders. Nobody knows the location of [Natural Wonder] yet."
},*/
"description": "Send your best explorers on a quest to discover Natural Wonders. Nobody knows the location of [naturalWonder] yet."
}*/
/* G&K */
/*
{
@ -52,23 +52,20 @@
"influence": 20,
"duration": 30
},
*/
/*
{
"name": "Contest Culture",
"description": "The civilization with the largest Culture growth will gain a reward.",
"type": "Global",
"duration": 30,
"minimumCivs": 3
},*/
/*
},
{
"name": "Contest Faith",
"description": "",
"type": "Global",
"duration": 30,
"minimumCivs": 3
},*/
},
{
"name": "Contest Techs",
"description": "The civilization with the largest number of new Technologies researched will gain a reward.",
@ -76,7 +73,6 @@
"duration": 30,
"minimumCivs": 3
},
/*
{
"name": "Invest",
"description": "",
@ -94,15 +90,12 @@
"name": "Denounce Civilization",
"description": "",
"duration": 30
}
*/
/*
},
{
"name": "Spread Religion",
"description": ""
},
*/
/* BNW */
/*
{

View File

@ -7,6 +7,7 @@ import com.unciv.logic.GameInfo
import com.unciv.logic.map.TileInfo
import com.unciv.models.ruleset.Building
import com.unciv.models.ruleset.Quest
import com.unciv.models.ruleset.QuestName
import com.unciv.models.ruleset.tile.ResourceType
import com.unciv.models.ruleset.tile.TileResource
import com.unciv.models.ruleset.unit.BaseUnit
@ -245,8 +246,7 @@ class QuestManager {
var data2 = ""
when (quest.name) {
"Construct Wonder" -> data1 = getWonderToBuildForQuest(assignee)!!.name
"Contest Techs" -> data1 = assignee.tech.getNumberOfTechsResearched().toString()
QuestName.ConstructWonder.value -> data1 = getWonderToBuildForQuest(assignee)!!.name
}
val newQuest = AssignedQuest(
@ -281,8 +281,8 @@ class QuestManager {
return false
return when (quest.name) {
"Route" -> civInfo.hasEverBeenFriendWith(challenger) && !civInfo.isCapitalConnectedToCity(challenger.getCapital())
"Construct Wonder" -> civInfo.hasEverBeenFriendWith(challenger) && getWonderToBuildForQuest(challenger) != null
QuestName.Route.value -> civInfo.hasEverBeenFriendWith(challenger) && !civInfo.isCapitalConnectedToCity(challenger.getCapital())
QuestName.ConstructWonder.value -> civInfo.hasEverBeenFriendWith(challenger) && getWonderToBuildForQuest(challenger) != null
else -> true
}
}
@ -291,8 +291,8 @@ class QuestManager {
private fun isComplete(assignedQuest: AssignedQuest): Boolean {
val assignee = civInfo.gameInfo.getCivilization(assignedQuest.assignee)
return when (assignedQuest.questName) {
"Route" -> civInfo.isCapitalConnectedToCity(assignee.getCapital())
"Construct Wonder" -> assignee.cities.any { it.cityConstructions.isBuilt(assignedQuest.data1) }
QuestName.Route.value -> civInfo.isCapitalConnectedToCity(assignee.getCapital())
QuestName.ConstructWonder.value -> assignee.cities.any { it.cityConstructions.isBuilt(assignedQuest.data1) }
else -> false
}
}
@ -301,7 +301,7 @@ class QuestManager {
private fun isObsolete(assignedQuest: AssignedQuest): Boolean {
val assignee = civInfo.gameInfo.getCivilization(assignedQuest.assignee)
return when (assignedQuest.questName) {
"Construct Wonder" -> civInfo.gameInfo.getCities().any { it.civInfo != assignee && it.cityConstructions.isBuilt(assignedQuest.data1) }
QuestName.ConstructWonder.value -> civInfo.gameInfo.getCities().any { it.civInfo != assignee && it.cityConstructions.isBuilt(assignedQuest.data1) }
else -> false
}
}
@ -320,7 +320,7 @@ class QuestManager {
private fun getScoreForQuest(assignedQuest: AssignedQuest): Int {
val assignee = civInfo.gameInfo.getCivilization(assignedQuest.assignee)
return when (assignedQuest.questName) {
"Contest Techs" -> assignee.tech.getNumberOfTechsResearched() - assignedQuest.data1.toInt()
// Waiting for contest quests
else -> 0
}
}
@ -369,7 +369,7 @@ class AssignedQuest(val questName: String = "",
val game = UncivGame.Current
when (questName) {
"Route" -> {
QuestName.Route.value -> {
game.setWorldScreen()
game.worldScreen.mapHolder.setCenterPosition(gameInfo.getCivilization(assigner).getCapital().location, selectUnit = false)
}

View File

@ -2,6 +2,18 @@ package com.unciv.models.ruleset
import com.unciv.models.stats.INamed
enum class QuestName(val value: String) {
Route("Route"),
ClearBarbarianCamp("Clear Barbarian Camp"),
ConstructWonder("Construct Wonder"),
ConnectResource("Connect Resource"),
GreatPerson("Acquire Great Person"),
ConquerCityState("Conquer City State"),
FindPlayer("Find Player"),
FindNaturalWonder("Find Natural Wonder"),
None("")
}
enum class QuestType {
Individual,
Global

View File

@ -289,6 +289,7 @@ object TranslationFileWriter {
"GreatPeopleNames" -> this.javaClass // dummy value
"Nations" -> emptyArray<Nation>().javaClass
"Policies" -> emptyArray<PolicyBranch>().javaClass
"Quests" -> emptyArray<Quest>().javaClass
"Techs" -> emptyArray<TechColumn>().javaClass
"Terrains" -> emptyArray<Terrain>().javaClass
"TileImprovements" -> emptyArray<TileImprovement>().javaClass