mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-23 11:34:54 -04:00
Resolved #13058 - Science points no longer 're-bonused' on overflow
This commit is contained in:
parent
3ce2399841
commit
6c351fbae6
@ -97,10 +97,7 @@ class TechManager : IsPartOfGameInfoSerialization {
|
||||
|
||||
fun getNumberOfTechsResearched(): Int = techsResearched.size
|
||||
|
||||
fun getOverflowScience(techName: String): Int {
|
||||
return if (overflowScience == 0) 0
|
||||
else (getScienceModifier(techName) * overflowScience).toInt()
|
||||
}
|
||||
fun getOverflowScience(): Int = overflowScience
|
||||
|
||||
private fun getScienceModifier(techName: String): Float { // https://forums.civfanatics.com/threads/the-mechanics-of-overflow-inflation.517970/
|
||||
val numberOfCivsResearchedThisTech = civInfo.getKnownCivs()
|
||||
@ -140,7 +137,7 @@ class TechManager : IsPartOfGameInfoSerialization {
|
||||
// Was once duplicated as fun scienceSpentOnTech(tech: String): Int
|
||||
|
||||
fun remainingScienceToTech(techName: String): Int {
|
||||
val spareScience = if (canBeResearched(techName)) getOverflowScience(techName) else 0
|
||||
val spareScience = if (canBeResearched(techName)) getOverflowScience() else 0
|
||||
return costOfTech(techName) - researchOfTech(techName) - spareScience
|
||||
}
|
||||
|
||||
@ -253,7 +250,7 @@ class TechManager : IsPartOfGameInfoSerialization {
|
||||
NotificationIcon.Science)
|
||||
}
|
||||
if (overflowScience != 0) {
|
||||
finalScienceToAdd += getOverflowScience(currentTechnologyName()!!)
|
||||
finalScienceToAdd += getOverflowScience()
|
||||
overflowScience = 0
|
||||
}
|
||||
|
||||
@ -279,7 +276,7 @@ class TechManager : IsPartOfGameInfoSerialization {
|
||||
*/
|
||||
fun updateResearchProgress() {
|
||||
val currentTechnology = currentTechnologyName() ?: return
|
||||
val realOverflow = getOverflowScience(currentTechnology)
|
||||
val realOverflow = getOverflowScience()
|
||||
val scienceSpent = researchOfTech(currentTechnology) + realOverflow
|
||||
if (scienceSpent >= costOfTech(currentTechnology)) {
|
||||
overflowScience = 0
|
||||
|
@ -442,7 +442,7 @@ class TechPickerScreen(
|
||||
}
|
||||
|
||||
private fun getTechProgressLabel(techs: List<String>): String {
|
||||
val progress = techs.sumOf { tech -> civTech.researchOfTech(tech) } + civTech.getOverflowScience(techs.first())
|
||||
val progress = techs.sumOf { tech -> civTech.researchOfTech(tech) } + civTech.getOverflowScience()
|
||||
val techCost = techs.sumOf { tech -> civInfo.tech.costOfTech(tech) }
|
||||
return "(${progress}/${techCost})"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user