mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-24 03:53:12 -04:00
chore(purity): Added readonlys required for #13801
This commit is contained in:
parent
9d439f1500
commit
9ea47acdec
@ -168,7 +168,7 @@ class PolicyManager : IsPartOfGameInfoSerialization {
|
||||
return cost - (cost % 5)
|
||||
}
|
||||
|
||||
fun getAdoptedPolicies(): HashSet<String> = adoptedPolicies
|
||||
@Readonly fun getAdoptedPolicies(): HashSet<String> = adoptedPolicies
|
||||
|
||||
/** Uncached, use carefully */
|
||||
@Readonly
|
||||
|
@ -30,6 +30,7 @@ class CivInfoStatsForNextTurn(val civInfo: Civilization) {
|
||||
@Transient
|
||||
var statsForNextTurn = Stats()
|
||||
|
||||
@Readonly
|
||||
private fun getUnitMaintenance(): Int {
|
||||
val baseUnitCost = 0.5f
|
||||
var freeUnits = 3
|
||||
@ -84,6 +85,7 @@ class CivInfoStatsForNextTurn(val civInfo: Civilization) {
|
||||
return cost.toInt()
|
||||
}
|
||||
|
||||
@Readonly
|
||||
private fun getTransportationUpkeep(): Stats {
|
||||
val transportationUpkeep = Stats()
|
||||
// we no longer use .flatMap, because there are a lot of tiles and keeping them all in a list
|
||||
@ -165,6 +167,7 @@ class CivInfoStatsForNextTurn(val civInfo: Civilization) {
|
||||
/** Per each supply missing, a player gets -10% production. Capped at -70%. */
|
||||
@Readonly fun getUnitSupplyProductionPenalty(): Float = -min(getUnitSupplyDeficit() * 10f, 70f)
|
||||
|
||||
@Readonly
|
||||
fun getStatMapForNextTurn(): StatMap {
|
||||
val statMap = StatMap()
|
||||
for (city in civInfo.cities) {
|
||||
@ -178,12 +181,14 @@ class CivInfoStatsForNextTurn(val civInfo: Civilization) {
|
||||
if (otherCiv.getDiplomacyManager(civInfo.civName)!!.relationshipIgnoreAfraid() != RelationshipLevel.Ally)
|
||||
continue
|
||||
for (unique in civInfo.getMatchingUniques(UniqueType.CityStateStatPercent)) {
|
||||
val stats = Stats()
|
||||
stats.add(
|
||||
Stat.valueOf(unique.params[0]),
|
||||
otherCiv.stats.statsForNextTurn[Stat.valueOf(unique.params[0])] * unique.params[1].toFloat() / 100f
|
||||
)
|
||||
statMap.add(
|
||||
Constants.cityStates,
|
||||
Stats().add(
|
||||
Stat.valueOf(unique.params[0]),
|
||||
otherCiv.stats.statsForNextTurn[Stat.valueOf(unique.params[0])] * unique.params[1].toFloat() / 100f
|
||||
)
|
||||
stats
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -287,6 +292,7 @@ class CivInfoStatsForNextTurn(val civInfo: Civilization) {
|
||||
return statMap
|
||||
}
|
||||
|
||||
@Readonly
|
||||
private fun getGlobalStatsFromUniques():StatMap {
|
||||
val statMap = StatMap()
|
||||
if (civInfo.religionManager.religion != null) {
|
||||
|
@ -150,7 +150,7 @@ open class Stats(
|
||||
|
||||
/** **Non-Mutating function**
|
||||
* @return a new [Stats] instance */
|
||||
operator fun div(number: Float) = times(1/number)
|
||||
@Readonly operator fun div(number: Float) = times(1/number)
|
||||
|
||||
/** **Mutating function**
|
||||
* Apply weighting for Production Ranking */
|
||||
|
Loading…
x
Reference in New Issue
Block a user