Lint a few warnings and typos (#5293)

This commit is contained in:
SomeTroglodyte
2021-09-22 18:32:25 +02:00
committed by GitHub
parent 0771cb1fad
commit d1005327e7
6 changed files with 11 additions and 14 deletions

View File

@ -341,7 +341,7 @@ class QuestManager {
/** Increments [assignedQuest.assignee][AssignedQuest.assignee] influence on [civInfo] and adds a [Notification] */
private fun giveReward(assignedQuest: AssignedQuest) {
val rewardInfluence = civInfo.gameInfo.ruleSet.quests[assignedQuest.questName]!!.influece
val rewardInfluence = civInfo.gameInfo.ruleSet.quests[assignedQuest.questName]!!.influence
val assignee = civInfo.gameInfo.getCivilization(assignedQuest.assignee)
civInfo.getDiplomacyManager(assignedQuest.assignee).addInfluence(rewardInfluence)

View File

@ -910,7 +910,7 @@ class MapUnit {
}
}
// Otherwise fall back to the defined standard damage
return tile.getAllTerrains().sumBy { it.damagePerTurn }
return tile.getAllTerrains().sumOf { it.damagePerTurn }
}
private fun doCitadelDamage() {

View File

@ -25,20 +25,20 @@ class Quest : INamed {
/** Unique identifier name of the quest, it is also shown */
override var name: String = ""
/** Descrption of the quest shown to players */
/** Description of the quest shown to players */
var description: String = ""
/** [QuestType]: it is either Individual or Global */
var type: QuestType = QuestType.Individual
/** Influence reward gained on quest completion */
var influece: Float = 40f
var influence: Float = 40f
/** Maximum number of turns to complete the quest, 0 if there's no turn limit */
var duration: Int = 0
/**Minimum number of [CivInfo] needed to start the quest. It is meaningful only for [QuestType.Global]
* quests [type]. */
/** Minimum number of [CivInfo] needed to start the quest. It is meaningful only for [QuestType.Global]
* quests [type]. */
var minimumCivs: Int = 1
/** Checks if [this] is a Global quest */

View File

@ -147,7 +147,7 @@ class Terrain : NamedStats(), ICivilopediaText, IHasUniques {
}
fun setTransients() {
damagePerTurn = uniqueObjects.sumBy {
damagePerTurn = uniqueObjects.sumOf {
if (it.placeholderText == "Units ending their turn on this terrain take [] damage") it.params[0].toInt() else 0
}
}

View File

@ -195,12 +195,12 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() {
var friendBonusText = "{When Friends:} ".tr()
val friendBonusObjects = eraInfo.getCityStateBonuses(otherCiv.cityStateType, RelationshipLevel.Friend)
val friendBonusStrings = getAdjustedBonuses(friendBonusObjects)
friendBonusText += friendBonusStrings.joinToString(separator = ", ") { it.tr() } ?: ""
friendBonusText += friendBonusStrings.joinToString(separator = ", ") { it.tr() }
var allyBonusText = "{When Allies:} ".tr()
val allyBonusObjects = eraInfo.getCityStateBonuses(otherCiv.cityStateType, RelationshipLevel.Ally)
val allyBonusStrings = getAdjustedBonuses(allyBonusObjects)
allyBonusText += allyBonusStrings.joinToString(separator = ", ") { it.tr() } ?: ""
allyBonusText += allyBonusStrings.joinToString(separator = ", ") { it.tr() }
val relationLevel = otherCivDiplomacyManager.relationshipLevel()
if (relationLevel >= RelationshipLevel.Friend) {
@ -263,6 +263,7 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() {
improved = true
}
}
else -> Unit // To silence "exhaustive when" warning
}
}
// No matching unique, add it unmodified
@ -540,7 +541,7 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() {
val quest: Quest = viewingCiv.gameInfo.ruleSet.quests[assignedQuest.questName]!!
val remainingTurns: Int = assignedQuest.getRemainingTurns()
val title = "[${quest.name}] (+[${quest.influece.toInt()}] influence)"
val title = "[${quest.name}] (+[${quest.influence.toInt()}] influence)"
val description = assignedQuest.getDescription()
questTable.add(title.toLabel(fontSize = 24)).row()

View File

@ -3,7 +3,6 @@ package com.unciv.ui.worldscreen.mainmenu
import com.badlogic.gdx.Application
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.Input
import com.badlogic.gdx.files.FileHandle
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.Actor
import com.badlogic.gdx.scenes.scene2d.ui.*
@ -19,9 +18,7 @@ import com.unciv.models.ruleset.Ruleset.CheckModLinksStatus
import com.unciv.models.ruleset.RulesetCache
import com.unciv.models.tilesets.TileSetCache
import com.unciv.models.translations.TranslationFileWriter
import com.unciv.models.translations.Translations
import com.unciv.models.translations.tr
import com.unciv.ui.audio.MusicController
import com.unciv.ui.audio.MusicTrackChooserFlags
import com.unciv.ui.civilopedia.FormattedLine
import com.unciv.ui.civilopedia.MarkupRenderer
@ -33,7 +30,6 @@ import com.unciv.ui.worldscreen.WorldScreen
import java.util.*
import kotlin.concurrent.thread
import kotlin.math.floor
import kotlin.math.roundToInt
import com.badlogic.gdx.utils.Array as GdxArray
/**