mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 13:55:54 -04:00
Deprecated Stats as viable values for Great Person points
This commit is contained in:
parent
7e0b7f0007
commit
b554a6db93
@ -342,13 +342,6 @@ class GameInfo {
|
||||
cityInfo.cityStats.update()
|
||||
}
|
||||
|
||||
if(!civInfo.greatPeople.greatPersonPoints.isEmpty()) {
|
||||
civInfo.greatPeople.greatPersonPointsCounter.add(
|
||||
GreatPersonManager.statsToGreatPersonCounter(civInfo.greatPeople.greatPersonPoints)
|
||||
)
|
||||
civInfo.greatPeople.greatPersonPoints.clear()
|
||||
}
|
||||
|
||||
if (civInfo.hasEverOwnedOriginalCapital == null) {
|
||||
civInfo.hasEverOwnedOriginalCapital = civInfo.cities.any { it.isOriginalCapital }
|
||||
}
|
||||
|
@ -385,20 +385,6 @@ class CityInfo {
|
||||
gppCounter.add(unitName, gppCounter[unitName]!! * allGppPercentageBonus / 100)
|
||||
}
|
||||
|
||||
// Since existing buildings and specialists have *stat names* rather than Great Person names
|
||||
// as the keys, convert every stat name to the appropriate Great Person name instead
|
||||
|
||||
for (counter in sourceToGPP.values)
|
||||
for ((key, gppAmount) in counter.toMap()) { // since we're removing, copy to avoid concurrency problems
|
||||
val relevantStatEntry = GreatPersonManager.statToGreatPersonMapping
|
||||
.entries.firstOrNull { it.key.name.equals(key, true) }
|
||||
if (relevantStatEntry == null) continue
|
||||
|
||||
counter.add(relevantStatEntry.value, gppAmount)
|
||||
counter.remove(key)
|
||||
}
|
||||
|
||||
|
||||
return sourceToGPP
|
||||
}
|
||||
|
||||
|
@ -8,37 +8,10 @@ class GreatPersonManager {
|
||||
var pointsForNextGreatPerson = 100
|
||||
var pointsForNextGreatGeneral = 30
|
||||
|
||||
@Deprecated("As of 3.15.15 - Should be converted to greatPersonPointsCounter")
|
||||
var greatPersonPoints = Stats()
|
||||
var greatPersonPointsCounter = Counter<String>()
|
||||
var greatGeneralPoints = 0
|
||||
var freeGreatPeople = 0
|
||||
|
||||
companion object {
|
||||
val statToGreatPersonMapping = hashMapOf<Stat, String>(
|
||||
Stat.Science to "Great Scientist",
|
||||
Stat.Production to "Great Engineer",
|
||||
Stat.Gold to "Great Merchant",
|
||||
Stat.Culture to "Great Artist",
|
||||
)
|
||||
|
||||
fun statsToGreatPersonCounter(stats: Stats): Counter<String> {
|
||||
val counter = Counter<String>()
|
||||
for ((key, value) in stats)
|
||||
if (statToGreatPersonMapping.containsKey(key))
|
||||
counter.add(statToGreatPersonMapping[key]!!, value.toInt())
|
||||
return counter
|
||||
}
|
||||
|
||||
fun greatPersonCounterToStats(counter: Counter<String>): Stats {
|
||||
val stats = Stats()
|
||||
for ((key, value) in counter) {
|
||||
val stat = statToGreatPersonMapping.entries.firstOrNull { it.value == key }?.key
|
||||
if (stat != null) stats.add(stat, value.toFloat())
|
||||
}
|
||||
return stats
|
||||
}
|
||||
}
|
||||
|
||||
fun clone(): GreatPersonManager {
|
||||
val toReturn = GreatPersonManager()
|
||||
|
@ -16,7 +16,7 @@ class Difficulty: INamed, ICivilopediaText {
|
||||
var policyCostModifier:Float = 1f
|
||||
var unhappinessModifier:Float = 1f
|
||||
var barbarianBonus:Float = 0f
|
||||
var startingUnits = ArrayList<String>() // Deprecated since 3.15.8
|
||||
var startingUnits = ArrayList<String>() // Deprecated since 3.15.8 - with eras
|
||||
var playerBonusStartingUnits = ArrayList<String>()
|
||||
|
||||
var aiCityGrowthModifier:Float = 1f
|
||||
@ -26,7 +26,7 @@ class Difficulty: INamed, ICivilopediaText {
|
||||
var aiBuildingMaintenanceModifier:Float = 1f
|
||||
var aiUnitMaintenanceModifier = 1f
|
||||
var aiFreeTechs = ArrayList<String>()
|
||||
var aiMajorCivStartingUnits = ArrayList<String>() // Deprecated since 3.15.8
|
||||
var aiMajorCivStartingUnits = ArrayList<String>() // Deprecated since 3.15.8 - with eras
|
||||
var aiMajorCivBonusStartingUnits = ArrayList<String>()
|
||||
var aiCityStateStartingUnits = ArrayList<String>() // Deprecated since 3.15.8
|
||||
var aiCityStateBonusStartingUnits = ArrayList<String>()
|
||||
|
@ -184,9 +184,6 @@ class CivilopediaScreen(
|
||||
&& !(uniqueObjects.filter { unique -> unique.placeholderText == "Hidden when [] Victory is disabled"}.any {
|
||||
unique -> !game.gameInfo.gameParameters.victoryTypes.contains(VictoryType.valueOf(unique.params[0] ))
|
||||
})
|
||||
// Deprecated since 3.15.14
|
||||
&& !(noCulturalVictory && "Hidden when cultural victory is disabled" in uniques)
|
||||
//
|
||||
}
|
||||
|
||||
fun getCategoryIterator(category: CivilopediaCategories): Collection<ICivilopediaText> =
|
||||
|
@ -106,12 +106,6 @@ class StatsOverviewTable (
|
||||
private fun getGreatPeopleTable(): Table {
|
||||
val greatPeopleTable = Table(CameraStageBaseScreen.skin)
|
||||
|
||||
val greatPersonPoints = GreatPersonManager
|
||||
.greatPersonCounterToStats(viewingPlayer.greatPeople.greatPersonPointsCounter)
|
||||
val greatPersonPointsPerTurn = GreatPersonManager
|
||||
.greatPersonCounterToStats(viewingPlayer.getGreatPersonPointsForNextTurn())
|
||||
val pointsToGreatPerson = viewingPlayer.greatPeople.pointsForNextGreatPerson
|
||||
|
||||
greatPeopleTable.defaults().pad(5f)
|
||||
val greatPeopleHeader = Table(CameraStageBaseScreen.skin)
|
||||
val greatPeopleIcon = ImageGetter.getStatIcon("Specialist")
|
||||
@ -124,11 +118,14 @@ class StatsOverviewTable (
|
||||
greatPeopleTable.add("Current points".tr())
|
||||
greatPeopleTable.add("Points per turn".tr()).row()
|
||||
|
||||
val mapping = GreatPersonManager.statToGreatPersonMapping
|
||||
for(entry in mapping){
|
||||
greatPeopleTable.add(entry.value.tr())
|
||||
greatPeopleTable.add(greatPersonPoints[entry.key].toInt().toString()+"/"+pointsToGreatPerson)
|
||||
greatPeopleTable.add(greatPersonPointsPerTurn[entry.key].toInt().toString()).row()
|
||||
val greatPersonPoints = viewingPlayer.greatPeople.greatPersonPointsCounter
|
||||
val greatPersonPointsPerTurn = viewingPlayer.getGreatPersonPointsForNextTurn()
|
||||
val pointsToGreatPerson = viewingPlayer.greatPeople.pointsForNextGreatPerson
|
||||
|
||||
for((greatPerson, points) in greatPersonPoints) {
|
||||
greatPeopleTable.add(greatPerson.tr())
|
||||
greatPeopleTable.add("$points/$pointsToGreatPerson")
|
||||
greatPeopleTable.add(greatPersonPointsPerTurn[greatPerson].toString()).row()
|
||||
}
|
||||
val pointsForGreatGeneral = viewingPlayer.greatPeople.greatGeneralPoints
|
||||
val pointsForNextGreatGeneral = viewingPlayer.greatPeople.pointsForNextGreatGeneral
|
||||
|
Loading…
x
Reference in New Issue
Block a user