mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-31 01:44:45 +07:00
Displayed Great Person point requirements always take game speed into account
This commit is contained in:
parent
48bf588b48
commit
002dd951f6
@ -847,6 +847,7 @@ class CivilizationInfo : IsPartOfGameInfoSerialization {
|
||||
|
||||
fun setTransients() {
|
||||
goldenAges.civInfo = this
|
||||
greatPeople.civInfo = this
|
||||
|
||||
civConstructions.setTransients(civInfo = this)
|
||||
|
||||
@ -956,7 +957,7 @@ class CivilizationInfo : IsPartOfGameInfoSerialization {
|
||||
// Generate great people at the start of the turn,
|
||||
// so they won't be generated out in the open and vulnerable to enemy attacks before you can control them
|
||||
if (cities.isNotEmpty()) { //if no city available, addGreatPerson will throw exception
|
||||
val greatPerson = greatPeople.getNewGreatPerson(gameInfo.speed.modifier)
|
||||
val greatPerson = greatPeople.getNewGreatPerson()
|
||||
if (greatPerson != null && gameInfo.ruleSet.units.containsKey(greatPerson)) addUnit(greatPerson)
|
||||
religionManager.startTurn()
|
||||
if (isLongCountActive())
|
||||
|
@ -8,7 +8,12 @@ import com.unciv.models.Counter
|
||||
// todo: GP from Maya long count should increase threshold as well - implement together
|
||||
|
||||
class GreatPersonManager : IsPartOfGameInfoSerialization {
|
||||
var pointsForNextGreatPerson = 100
|
||||
|
||||
@Transient
|
||||
lateinit var civInfo: CivilizationInfo
|
||||
|
||||
/** Base points, without speed modifier */
|
||||
private var pointsForNextGreatPerson = 100
|
||||
var pointsForNextGreatGeneral = 200
|
||||
|
||||
var greatPersonPointsCounter = Counter<String>()
|
||||
@ -31,7 +36,9 @@ class GreatPersonManager : IsPartOfGameInfoSerialization {
|
||||
return toReturn
|
||||
}
|
||||
|
||||
fun getNewGreatPerson(gameSpeedModifier:Float): String? {
|
||||
fun getPointsRequiredForGreatPerson() = (pointsForNextGreatPerson * civInfo.gameInfo.speed.modifier).toInt()
|
||||
|
||||
fun getNewGreatPerson(): String? {
|
||||
if (greatGeneralPoints > pointsForNextGreatGeneral) {
|
||||
greatGeneralPoints -= pointsForNextGreatGeneral
|
||||
pointsForNextGreatGeneral += 50
|
||||
@ -39,7 +46,7 @@ class GreatPersonManager : IsPartOfGameInfoSerialization {
|
||||
}
|
||||
|
||||
for ((key, value) in greatPersonPointsCounter) {
|
||||
val requiredPoints = (pointsForNextGreatPerson * gameSpeedModifier).toInt()
|
||||
val requiredPoints = getPointsRequiredForGreatPerson()
|
||||
if (value >= requiredPoints) {
|
||||
greatPersonPointsCounter.add(key, -requiredPoints)
|
||||
pointsForNextGreatPerson *= 2
|
||||
|
@ -354,7 +354,7 @@ class CityStatsTable(val cityScreen: CityScreen): Table() {
|
||||
info.add("{$greatPersonName} (+$gppPerTurn)".toLabel()).left().padBottom(4f).expandX().row()
|
||||
|
||||
val gppCurrent = cityInfo.civInfo.greatPeople.greatPersonPointsCounter[greatPersonName]
|
||||
val gppNeeded = cityInfo.civInfo.greatPeople.pointsForNextGreatPerson
|
||||
val gppNeeded = cityInfo.civInfo.greatPeople.getPointsRequiredForGreatPerson()
|
||||
|
||||
val percent = gppCurrent!! / gppNeeded.toFloat()
|
||||
|
||||
|
@ -159,7 +159,7 @@ class StatsOverviewTab(
|
||||
|
||||
val greatPersonPoints = viewingPlayer.greatPeople.greatPersonPointsCounter
|
||||
val greatPersonPointsPerTurn = viewingPlayer.getGreatPersonPointsForNextTurn()
|
||||
val pointsToGreatPerson = viewingPlayer.greatPeople.pointsForNextGreatPerson
|
||||
val pointsToGreatPerson = viewingPlayer.greatPeople.getPointsRequiredForGreatPerson()
|
||||
for ((greatPerson, points) in greatPersonPoints) {
|
||||
add(greatPerson.toLabel()).left()
|
||||
add("$points/$pointsToGreatPerson".toLabel())
|
||||
|
Loading…
Reference in New Issue
Block a user