Merge remote-tracking branch 'origin/master'

This commit is contained in:
yairm210 2021-09-02 20:38:16 +03:00
commit e418f1b8ca
23 changed files with 799 additions and 694 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 964 KiB

After

Width:  |  Height:  |  Size: 967 KiB

View File

@ -701,6 +701,8 @@ Worked by [cityName] =
Lock =
Unlock =
Move to city =
Invalid input! Please enter a different string. =
Please enter some text =
# Technology UI
@ -766,7 +768,6 @@ Spread [religionName] =
Remove Heresy =
Found a Religion =
Enhance a Religion =
Enhance [religionName] =
Your citizens have been happy with your rule for so long that the empire enters a Golden Age! =
You have entered the [newEra]! =
[civName] has entered the [eraName]! =
@ -1024,8 +1025,10 @@ Policy branch: [branchName] =
# Religions
Choose an Icon and name for your Religion =
Choose a name for your religion =
Choose a [beliefType] belief! =
Found [religionName] =
Enhance [religionName] =
Choose a pantheon =
Found Religion =
Found Pantheon =

View File

@ -330,7 +330,7 @@ object NextTurnAutomation {
private fun foundReligion(civInfo: CivilizationInfo) {
if (civInfo.religionManager.religionState != ReligionState.FoundingReligion) return
val religionIcon = civInfo.gameInfo.ruleSet.religions
.filterNot { civInfo.gameInfo.religions.values.map { religion -> religion.iconName }.contains(it) }
.filterNot { civInfo.gameInfo.religions.values.map { religion -> religion.name }.contains(it) }
.randomOrNull()
?: return // Wait what? How did we pass the checking when using a great prophet but not this?
val chosenBeliefs = chooseBeliefs(civInfo, civInfo.religionManager.getBeliefsToChooseAtFounding()).toList()

View File

@ -1,6 +1,5 @@
package com.unciv.logic.civilization
import com.unciv.Constants
import com.unciv.logic.map.MapUnit
import com.unciv.models.Religion
import com.unciv.models.ruleset.Belief
@ -34,17 +33,18 @@ class ReligionManager {
var religionState = ReligionState.None
private set
@Transient
// These cannot be transient, as saving and loading after using a great prophet but before
// founding a religion would break :(
private var foundingCityId: String? = null
// Only used for keeping track of the city a prophet was used when founding a religion
@Transient
private var shouldChoosePantheonBelief: Boolean = false
fun clone(): ReligionManager {
val clone = ReligionManager()
clone.foundingCityId = foundingCityId
clone.shouldChoosePantheonBelief = shouldChoosePantheonBelief
clone.storedFaith = storedFaith
clone.religionState = religionState
clone.greatProphetsEarned = greatProphetsEarned
@ -200,9 +200,9 @@ class ReligionManager {
}
fun foundReligion(iconName: String, name: String, beliefs: List<Belief>) {
fun foundReligion(displayName: String, name: String, beliefs: List<Belief>) {
val newReligion = Religion(name, civInfo.gameInfo, civInfo.civName)
newReligion.iconName = iconName
newReligion.displayName = displayName
if (religion != null) {
newReligion.followerBeliefs.addAll(religion!!.followerBeliefs)
newReligion.founderBeliefs.addAll(religion!!.founderBeliefs)

View File

@ -101,15 +101,17 @@ class MapUnit {
/**
* Name which should be displayed in UI
*
*
* Note this is translated after being returned from this function, so let's pay
* attention to combined names (renamed units, religion).
*/
fun displayName(): String {
val name = if (instanceName == null) name
else "$instanceName ({${name}})"
return if (religion != null) "[$name] ([$religion])"
else name
val baseName =
if (instanceName == null) "[$name]"
else "instanceName ([$name])"
return if (religion == null) baseName
else "$baseName ([${getReligionDisplayName()}])"
}
var currentMovement: Float = 0f
@ -969,6 +971,11 @@ class MapUnit {
return matchingUniques.any { improvement.matchesFilter(it.params[0]) || tile.matchesTerrainFilter(it.params[0]) }
}
fun getReligionDisplayName(): String? {
if (religion == null) return null
return civInfo.gameInfo.religions[religion]!!.displayName ?: religion
}
fun religiousActionsUnitCanDo(): Sequence<String> {
return getMatchingUniques("Can [] [] times")
.map { it.params[0] }

View File

@ -10,7 +10,7 @@ import com.unciv.models.stats.INamed
class Religion() : INamed {
override lateinit var name: String
var iconName: String = "Pantheon"
var displayName: String? = null
lateinit var foundingCivName: String
var founderBeliefs: HashSet<String> = hashSetOf()
@ -21,13 +21,14 @@ class Religion() : INamed {
constructor(name: String, gameInfo: GameInfo, foundingCivName: String) : this() {
this.name = name
this.displayName = name
this.foundingCivName = foundingCivName
this.gameInfo = gameInfo
}
fun clone(): Religion {
val toReturn = Religion(name, gameInfo, foundingCivName)
toReturn.iconName = iconName
toReturn.displayName = displayName
toReturn.founderBeliefs.addAll(founderBeliefs)
toReturn.followerBeliefs.addAll(followerBeliefs)
return toReturn
@ -37,6 +38,10 @@ class Religion() : INamed {
this.gameInfo = gameInfo
}
fun getIconName() =
if (isPantheon()) "Pantheon"
else name
private fun mapToExistingBeliefs(beliefs: HashSet<String>): List<Belief> {
val rulesetBeliefs = gameInfo.ruleSet.beliefs
return beliefs.mapNotNull {

View File

@ -215,7 +215,7 @@ class BaseUnit : INamed, INonPerpetualConstruction, ICivilopediaText {
}
override fun canBePurchasedWithStat(cityInfo: CityInfo?, stat: Stat): Boolean {
// May buy [unitFilter] units for [amount] [Stat] starting from the [eraName] at an increasing price ([amount])
// May buy [unitFilter] units for [amount] [Stat] [cityFilter] starting from the [eraName] at an increasing price ([amount])
if (cityInfo != null && cityInfo.civInfo.getMatchingUniques("May buy [] units for [] [] [] starting from the [] at an increasing price ([])")
.any {
matchesFilter(it.params[0])

View File

@ -51,18 +51,16 @@ class CityScreenCityPickerTable(private val cityScreen: CityScreen) : Table() {
val currentCityLabel = city.name.toLabel(fontSize = 30, fontColor = civInfo.nation.getInnerColor())
if (cityScreen.canChangeState) currentCityLabel.onClick {
val editCityNamePopup = Popup(cityScreen)
val textArea = TextField(city.name, CameraStageBaseScreen.skin)
textArea.alignment = Align.center
editCityNamePopup.add(textArea).colspan(2).row()
//editCityNamePopup.name = "CityNamePopup" // debug help
editCityNamePopup.addButtonInRow("Save", KeyCharAndCode.RETURN) {
city.name = textArea.text
cityScreen.game.setScreen(CityScreen(city))
}
editCityNamePopup.addCloseButton("Cancel")
editCityNamePopup.keyboardFocus = textArea
editCityNamePopup.open()
AskTextPopup(
cityScreen,
label = "Please enter a new name for your city",
defaultText = city.name,
actionOnOk = { text ->
city.name = text
cityScreen.game.setScreen(CityScreen(city))
true
}
).open()
}
cityNameTable.add(currentCityLabel)

View File

@ -83,9 +83,11 @@ class CityStatsTable(val cityScreen: CityScreen): Table() {
}
private fun addReligionInfo() {
val label = cityInfo.religion.getMajorityReligion()?.iconName
val label = cityInfo.religion.getMajorityReligion()?.displayName
?: "None"
val icon = if (label == "None") "Religion" else label
val icon =
if (label == "None") "Religion"
else cityInfo.religion.getMajorityReligion()!!.name
val expanderTab =
ExpanderTab(
title = "Majority Religion: [$label]",
@ -104,7 +106,9 @@ class CityStatsTable(val cityScreen: CityScreen): Table() {
if (cityInfo.religion.religionThisIsTheHolyCityOf != null) {
// I want this to be centered, but `.center()` doesn't seem to do anything,
// regardless of where I place it :(
it.add("Holy city of: [${cityInfo.religion.religionThisIsTheHolyCityOf!!}]".toLabel()).center().colspan(2).pad(5f).row()
it.add(
"Holy city of: [${cityInfo.civInfo.gameInfo.religions[cityInfo.religion.religionThisIsTheHolyCityOf!!]!!.displayName}]".toLabel()
).center().colspan(2).pad(5f).row()
}
it.add(getReligionsTable()).colspan(2).pad(5f)
}
@ -128,7 +132,7 @@ class CityStatsTable(val cityScreen: CityScreen): Table() {
for ((religion, followerCount) in followers) {
religionsTable.add(
ImageGetter.getCircledReligionIcon(cityInfo.civInfo.gameInfo.religions[religion]!!.iconName, 30f)
ImageGetter.getCircledReligionIcon(cityInfo.civInfo.gameInfo.religions[religion]!!.getIconName(), 30f)
).pad(5f)
religionsTable.addSeparatorVertical(gridColor)
religionsTable.add(followerCount.toLabel()).pad(5f)

View File

@ -45,7 +45,7 @@ class ReligionOverviewTable(
button = Button(image, CameraStageBaseScreen.skin)
} else {
button = Button(
ImageGetter.getCircledReligionIcon(religion.iconName, 60f),
ImageGetter.getCircledReligionIcon(religion.getIconName(), 60f),
CameraStageBaseScreen.skin
)
}
@ -66,13 +66,13 @@ class ReligionOverviewTable(
private fun loadReligion(religion: Religion) {
statsTable.clear()
beliefsTable.clear()
topButtonLabel.setText(religion.name.tr())
topButtonLabel.setText(religion.displayName!!.tr())
for (belief in religion.getAllBeliefsOrdered()) {
beliefsTable.add(createBeliefDescription(belief)).pad(10f).row()
}
statsTable.add("Religion Name:".toLabel())
statsTable.add(religion.name.toLabel()).pad(5f).row()
statsTable.add(religion.displayName!!.toLabel()).pad(5f).row()
statsTable.add("Founding Civ:".toLabel())
val foundingCivName =
if (viewingPlayer.knows(religion.foundingCivName) || viewingPlayer.civName == religion.foundingCivName)

View File

@ -47,21 +47,34 @@ class PromotionPickerScreen(val unit: MapUnit) : PickerScreen() {
val unitType = unit.type
val promotionsForUnitType = unit.civInfo.gameInfo.ruleSet.unitPromotions.values.filter {
it.unitTypes.contains(unitType.name)
|| unit.promotions.promotions.contains(it.name) }
it.unitTypes.contains(unitType.name) || unit.promotions.promotions.contains(it.name)
}
val unitAvailablePromotions = unit.promotions.getAvailablePromotions()
if(canPromoteNow && unit.instanceName == null) {
if (canPromoteNow && unit.instanceName == null) {
val renameButton = "Choose name for [${unit.name}]".toTextButton()
renameButton.isEnabled = true
renameButton.onClick {
RenameUnitPopup(unit, this).open()
AskTextPopup(
this,
label = "Choose name for [${unit.baseUnit.name}]",
icon = ImageGetter.getUnitIcon(unit.name).surroundWithCircle(80f),
defaultText = unit.name,
actionOnOk = { userInput ->
if (userInput == unit.name)
return@AskTextPopup false
unit.instanceName = userInput
this.game.setScreen(PromotionPickerScreen(unit))
return@AskTextPopup true
}
).open()
}
availablePromotionsGroup.add(renameButton)
availablePromotionsGroup.row()
}
for (promotion in promotionsForUnitType) {
if(promotion.name=="Heal Instantly" && unit.health==100) continue
if (promotion.uniqueObjects.any { it.placeholderText == "Heal this unit by [] HP" } && unit.health == 100) continue
val isPromotionAvailable = promotion in unitAvailablePromotions
val unitHasPromotion = unit.promotions.promotions.contains(promotion.name)

View File

@ -1,7 +1,9 @@
package com.unciv.ui.pickerscreens
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.ui.*
import com.badlogic.gdx.utils.Align
import com.unciv.Constants
import com.unciv.UncivGame
import com.unciv.logic.GameInfo
import com.unciv.logic.civilization.CivilizationInfo
@ -16,7 +18,7 @@ class ReligiousBeliefsPickerScreen (
private val choosingCiv: CivilizationInfo,
private val gameInfo: GameInfo,
private val beliefsContainer: BeliefContainer,
private val pickIcon: Boolean
private val pickIconAndName: Boolean
): PickerScreen(disableScroll = true) {
// Roughly follows the layout of the original (although I am not very good at UI designing, so please improve this)
@ -27,14 +29,14 @@ class ReligiousBeliefsPickerScreen (
private val middlePanes = Table()
private var previouslySelectedIcon: Button? = null
private var iconName: String? = null
private var displayName: String? = null
private var religionName: String? = null
init {
closeButton.isVisible = true
setDefaultCloseAction()
if (pickIcon) setupChoosableReligionIcons()
if (pickIconAndName) setupChoosableReligionIcons()
else setupVisibleReligionIcons()
updateLeftTable()
@ -47,25 +49,37 @@ class ReligiousBeliefsPickerScreen (
topTable.addSeparator()
topTable.add(middlePanes)
rightSideButton.label = "Choose a religion".toLabel()
if (pickIconAndName) rightSideButton.label = "Choose a religion".toLabel()
else rightSideButton.label = "Enhance [${choosingCiv.religionManager.religion!!.displayName}]".toLabel()
rightSideButton.onClick(UncivSound.Choir) {
choosingCiv.religionManager.chooseBeliefs(iconName, religionName, beliefsContainer.chosenBeliefs.map { it!! })
choosingCiv.religionManager.chooseBeliefs(displayName, religionName, beliefsContainer.chosenBeliefs.map { it!! })
UncivGame.Current.setWorldScreen()
}
}
private fun checkAndEnableRightSideButton() {
if (pickIcon && (religionName == null || iconName == null)) return
if (pickIconAndName && (religionName == null || displayName == null)) return
if (beliefsContainer.chosenBeliefs.any { it == null }) return
rightSideButton.enable()
}
private fun setupChoosableReligionIcons() {
topReligionIcons.clear()
// This should later be replaced with a user-modifiable text field, but not in this PR
// Note that this would require replacing 'religion.name' with 'religion.iconName' at many spots
val descriptionLabel = "Choose an Icon and name for your Religion".toLabel()
val descriptionLabel = "Choose an Icon and name for your Religion".toLabel()
fun changeDisplayedReligionName(newReligionName: String) {
displayName = newReligionName
rightSideButton.label = "Found [$newReligionName]".toLabel()
descriptionLabel.setText(newReligionName)
}
val changeReligionNameButton = Button(
ImageGetter.getImage("OtherIcons/Pencil").apply { this.color = Color.BLACK }.surroundWithCircle(30f),
skin
)
val iconsTable = Table()
iconsTable.align(Align.center)
@ -74,25 +88,48 @@ class ReligiousBeliefsPickerScreen (
ImageGetter.getCircledReligionIcon(religionName, 60f),
skin
)
val translatedReligionName = religionName.tr()
button.onClick {
if (previouslySelectedIcon != null) {
previouslySelectedIcon!!.enable()
}
iconName = religionName
this.religionName = religionName
previouslySelectedIcon = button
button.disable()
descriptionLabel.setText(translatedReligionName)
rightSideButton.label = "Found [$translatedReligionName]".toLabel()
checkAndEnableRightSideButton()
changeDisplayedReligionName(religionName)
this.religionName = religionName
changeReligionNameButton.enable()
}
if (religionName == this.religionName || gameInfo.religions.keys.any { it == religionName }) button.disable()
iconsTable.add(button).pad(5f)
}
iconsTable.row()
topReligionIcons.add(iconsTable).padBottom(10f).row()
topReligionIcons.add(descriptionLabel).center().padBottom(5f)
topReligionIcons.add(iconsTable).pad(5f).row()
val labelTable = Table()
labelTable.add(descriptionLabel).pad(5f)
labelTable.add(changeReligionNameButton).pad(5f).row()
topReligionIcons.add(labelTable).center().pad(5f).row()
changeReligionNameButton.onClick {
AskTextPopup(
this,
label = "Choose a name for your religion",
icon = ImageGetter.getCircledReligionIcon(religionName!!, 80f),
defaultText = religionName!!,
actionOnOk = { religionName ->
if (religionName == Constants.noReligionName
|| gameInfo.ruleSet.religions.any { it == religionName }
|| gameInfo.religions.any { it.value.name == religionName }
) {
return@AskTextPopup false
}
changeDisplayedReligionName(religionName)
return@AskTextPopup true
}
).open()
}
changeReligionNameButton.disable()
}
private fun setupVisibleReligionIcons() {
@ -178,7 +215,7 @@ class ReligiousBeliefsPickerScreen (
data class BeliefContainer(val pantheonBeliefCount: Int = 0, val founderBeliefCount: Int = 0, val followerBeliefCount: Int = 0, val enhancerBeliefCount: Int = 0) {
val chosenBeliefs: MutableList<Belief?> = MutableList(pantheonBeliefCount + founderBeliefCount + followerBeliefCount + enhancerBeliefCount) { null }
val chosenBeliefs: Array<Belief?> = Array(pantheonBeliefCount + founderBeliefCount + followerBeliefCount + enhancerBeliefCount) { null }
fun getBeliefTypeFromIndex(index: Int): BeliefType {
return when {

View File

@ -1,32 +0,0 @@
package com.unciv.ui.pickerscreens
import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.badlogic.gdx.scenes.scene2d.ui.TextField
import com.unciv.logic.map.MapUnit
import com.unciv.ui.utils.*
class RenameUnitPopup(unit: MapUnit, screen: CameraStageBaseScreen): Popup(screen) {
init {
val wrapper = Table()
wrapper.add(ImageGetter.getUnitIcon(unit.name).surroundWithCircle(80f)).padRight(10f)
wrapper.add("Choose name for [${unit.baseUnit.name}]".toLabel())
add(wrapper).colspan(2).row()
val nameField = TextField("", skin)
// Disallowed special characters - used by tr() or simply precaution
val illegalChars = "[]{}\"\\<>"
nameField.textFieldFilter = TextField.TextFieldFilter { _, char -> char !in illegalChars}
nameField.maxLength = unit.civInfo.gameInfo.ruleSet.units.values.maxOf { it.name.length }
add(nameField).growX().colspan(2).row()
addOKButton {
if (nameField.text != "" && nameField.text != unit.name) {
unit.instanceName = nameField.text
}
screen.game.setScreen(PromotionPickerScreen(unit))
}
addCloseButton()
equalizeLastTwoButtonWidths()
keyboardFocus = nameField
}
}

View File

@ -255,7 +255,7 @@ class CityButton(val city: CityInfo, private val tileGroup: WorldTileGroup): Tab
val cityReligion = city.religion.getMajorityReligion()
if (cityReligion != null) {
val religionImage = ImageGetter.getReligionImage(cityReligion.iconName)
val religionImage = ImageGetter.getReligionImage(cityReligion.getIconName())
iconTable.add(religionImage).size(20f).padLeft(5f).fillY()
}

View File

@ -0,0 +1,54 @@
package com.unciv.ui.utils
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.badlogic.gdx.scenes.scene2d.ui.TextField
/** Simple class for showing a prompt for a string to the user
* @param screen The previous screen the user was on
* @param label A line of text shown to the user
* @param icon Icon at the top, should have size 80f
* @param defaultText The text that should be in the prompt at the start
* @param errorText Text that will be shown when an error is detected
* @param maxLength The maximal amount of characters the user may input
* @param actionOnOk Lambda that will be executed after pressing 'OK'.
* Gets the text the user inputted as a parameter. Should return `true` if ready to close,
* `false` if `errorText` is to be displayed
*/
class AskTextPopup(
screen: CameraStageBaseScreen,
label: String = "Please enter some text",
icon: IconCircleGroup = ImageGetter.getImage("OtherIcons/Pencil").apply { this.color = Color.BLACK }.surroundWithCircle(80f),
defaultText: String = "",
errorText: String = "Invalid input! Please enter a different string.",
maxLength: Int = 32,
actionOnOk: (input: String) -> Boolean = { true },
) : Popup(screen) {
val illegalChars = "[]{}\"\\<>"
init {
val wrapper = Table()
wrapper.add(icon).padRight(10f)
wrapper.add(label.toLabel())
add(wrapper).colspan(2).row()
val nameField = TextField(defaultText, skin)
nameField.textFieldFilter = TextField.TextFieldFilter { _, char -> char !in illegalChars}
nameField.maxLength = maxLength
add(nameField).growX().colspan(2).row()
val errorLabel = errorText.toLabel()
errorLabel.color = Color.RED
addOKButton(automaticallyCloseOnPress = false) {
if (nameField.text == "" || !actionOnOk(nameField.text))
add(errorLabel).colspan(2).center()
else close()
}
addCloseButton()
equalizeLastTwoButtonWidths()
keyboardFocus = nameField
}
}

View File

@ -142,18 +142,24 @@ open class Popup(val screen: CameraStageBaseScreen): Table(CameraStageBaseScreen
}
/**
* Adds a [TextButton] that closes the popup, with [RETURN][KeyCharAndCode.RETURN] already mapped.
* Adds a [TextButton] that can close the popup, with [RETURN][KeyCharAndCode.RETURN] already mapped.
* @param text The button's caption, defaults to "OK".
* @param additionalKey An additional key that should act like a click.
* @param automaticallyCloseOnPress Whether the popup should be closed when pressing this button.
* @param action A lambda to be executed after closing the popup when the button is clicked.
* @return The new [Cell], NOT marked as end of row.
*/
fun addOKButton(
text: String = Constants.OK,
additionalKey: KeyCharAndCode? = null,
action: (()->Unit)
automaticallyCloseOnPress: Boolean = true,
action: (()->Unit),
): Cell<TextButton> {
val okAction = { close(); action() }
val okAction = {
if (automaticallyCloseOnPress)
close()
action()
}
keyPressDispatcher[KeyCharAndCode.RETURN] = okAction
return addButtonInRow(text, additionalKey, okAction)
}

View File

@ -24,7 +24,7 @@ open class YesNoPopup (
init {
promptLabel.setAlignment(Align.center)
add(promptLabel).colspan(2).row()
addOKButton(Constants.yes, KeyCharAndCode('y'), action)
addOKButton(Constants.yes, KeyCharAndCode('y'), action = action)
addCloseButton(Constants.no, KeyCharAndCode('n'), restoreDefault)
equalizeLastTwoButtonWidths()
}

View File

@ -721,7 +721,7 @@ class WorldScreen(val gameInfo: GameInfo, val viewingCiv:CivilizationInfo) : Cam
viewingCiv,
gameInfo,
viewingCiv.religionManager.getBeliefsToChooseAtFounding(),
pickIcon = true
pickIconAndName = true
))
}
@ -731,7 +731,7 @@ class WorldScreen(val gameInfo: GameInfo, val viewingCiv:CivilizationInfo) : Cam
viewingCiv,
gameInfo,
viewingCiv.religionManager.getBeliefsToChooseAtEnhancing(),
pickIcon = false
pickIconAndName = false
))
}

View File

@ -503,7 +503,7 @@ object UnitActions {
if (!unit.hasUnique("May enhance a religion")) return
if (!unit.civInfo.religionManager.mayEnhanceReligionAtAll(unit)) return
actionList += UnitAction(UnitActionType.EnhanceReligion,
title = "Enhance [${unit.civInfo.religionManager.religion!!.name}]",
title = "Enhance [${unit.civInfo.religionManager.religion!!.displayName}]",
action = getEnhanceReligionAction(unit).takeIf { unit.civInfo.religionManager.mayEnhanceReligionNow(unit) }
)
}
@ -550,7 +550,7 @@ object UnitActions {
&& it.religion != unit.religion
}
actionList += UnitAction(UnitActionType.SpreadReligion,
title = "Spread [${unit.religion!!}]",
title = "Spread [${unit.getReligionDisplayName()!!}]",
action = {
val followersOfOtherReligions = city.religion.getFollowersOfOtherReligionsThan(unit.religion!!)
for (unique in unit.getMatchingUniques("When spreading religion to a city, gain [] times the amount of followers of other religions as []")) {

View File

@ -632,6 +632,7 @@ Unless otherwise specified, all the following are from [the Noun Project](https:
* [Hourglass](https://thenounproject.com/search/?q=hourglass&i=142268) by I Create Stuff for the 'Turn' icon
* [Shield](https://thenounproject.com/search/?q=shield&i=813568) by Gregor Cresnar for Religious Strength
* [skill sword flame](https://thenounproject.com/term/skill-sword-flame/2360212/) by Maxicons) for Remove Heresy
* [Pencil](https://thenounproject.com/search/?q=pencil&i=4195852) by Muhamad Aldi Maulana for Enter Text Prompt Button / Pencil
## Main menu

View File

@ -48,12 +48,14 @@ class TranslationTests {
fun allUnitActionsHaveTranslation() {
val actions: MutableSet<String> = HashSet()
for (action in UnitActionType.values()) {
actions.add( when(action) {
UnitActionType.Upgrade -> "Upgrade to [unitType] ([goldCost] gold)"
UnitActionType.Create -> "Create [improvement]"
UnitActionType.SpreadReligion -> "Spread [religionName]"
else -> action.value
})
actions.add(
when(action) {
UnitActionType.Upgrade -> "Upgrade to [unitType] ([goldCost] gold)"
UnitActionType.Create -> "Create [improvement]"
UnitActionType.SpreadReligion -> "Spread [religionName]"
else -> action.value
}
)
}
val allUnitActionsHaveTranslation = allStringAreTranslated(actions)
Assert.assertTrue("This test will only pass when there is a translation for all unit actions",