mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-09 15:29:32 +07:00
Can now use [stats]
unique to add happiness globally
This commit is contained in:
@ -331,6 +331,12 @@ class CivInfoStats(val civInfo: CivilizationInfo) {
|
||||
|
||||
if (cityStatesHappiness > 0) statMap[Constants.cityStates] = cityStatesHappiness
|
||||
|
||||
for (unique in civInfo.getMatchingUniques(UniqueType.Stats))
|
||||
if (unique.sourceObjectType != UniqueTarget.Building && unique.sourceObjectType != UniqueTarget.Wonder && unique.stats.happiness != 0f){
|
||||
if (!statMap.containsKey(unique.sourceObjectName)) statMap[unique.sourceObjectName!!] = unique.stats.happiness
|
||||
else statMap[unique.sourceObjectName!!] = statMap[unique.sourceObjectName]!! + unique.stats.happiness
|
||||
}
|
||||
|
||||
return statMap
|
||||
}
|
||||
|
||||
|
@ -46,6 +46,13 @@ class GlobalUniquesTests {
|
||||
Assert.assertTrue(civInfo.statsForNextTurn.equals(Stats(gold=2f)))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun statsHappinessNotOnBuilding() {
|
||||
val civInfo = game.addCiv("[+7 Happiness]")
|
||||
civInfo.updateStatsForNextTurn()
|
||||
Assert.assertTrue(civInfo.happinessForNextTurn == civInfo.getDifficulty().baseHappiness + 7)
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
fun statsPerCity() {
|
||||
|
Reference in New Issue
Block a user