Multiple promotions with the same effect (e.g. Barrage I and II) will now both activate - kudos Philn3v!

This commit is contained in:
Yair Morgenstern 2018-12-12 23:05:14 +02:00
parent 406fa60f61
commit 9e8930c263
2 changed files with 6 additions and 5 deletions

View file

@ -312,7 +312,7 @@ BuildingIcons/Palace
orig: 100, 100
offset: 0, 0
index: -1
BuildingIcons/Paper maker
BuildingIcons/Paper Maker
rotate: false
xy: 1660, 1127
size: 100, 100

View file

@ -13,7 +13,6 @@ import com.unciv.ui.utils.getRandom
import java.text.DecimalFormat
import java.util.*
import kotlin.collections.ArrayList
import kotlin.collections.HashSet
class MapUnit {
@Transient lateinit var civInfo: CivilizationInfo
@ -68,14 +67,16 @@ class MapUnit {
return movementAlgs().getDistanceToTilesWithinTurn(tile.position,currentMovement)
}
@Transient var tempUniques= HashSet<String>()
// This SHOULD NOT be a hashset, because if it is, thenn promotions with the same text (e.g. barrage I, barrage II)
// will not get counted twice!
@Transient var tempUniques= ArrayList<String>()
fun getUniques(): HashSet<String> {
fun getUniques(): ArrayList<String> {
return tempUniques
}
fun updateUniques(){
val uniques = HashSet<String>()
val uniques = ArrayList<String>()
val baseUnit = baseUnit()
uniques.addAll(baseUnit.uniques)
uniques.addAll(promotions.promotions.map { GameBasics.UnitPromotions[it]!!.effect })