mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-05 21:11:35 +07:00
Units now unsleep after moving
This commit is contained in:
parent
e16ea5c803
commit
c71f320731
@ -214,12 +214,15 @@ class CivilizationInfo {
|
||||
viewableTiles.asSequence().map { it.position }
|
||||
.filterNot { exploredTiles.contains(it) }.toCollection(exploredTiles)
|
||||
|
||||
val viewedCivs = viewableTiles
|
||||
.flatMap { it.getUnits().map { unit->unit.civInfo }.union(listOf(it.getOwner())) }
|
||||
// we can meet a civ either by meeting its unit, or its tile
|
||||
.asSequence().filterNotNull().filterNot { it==this || it.isBarbarianCivilization() }
|
||||
|
||||
for(otherCiv in viewedCivs)
|
||||
val viewedCivs = HashSet<CivilizationInfo>()
|
||||
for(tile in viewableTiles){
|
||||
val tileOwner = tile.getOwner()
|
||||
if(tileOwner!=null) viewedCivs+=tileOwner
|
||||
for(unit in tile.getUnits()) viewedCivs+=unit.civInfo
|
||||
}
|
||||
|
||||
for(otherCiv in viewedCivs.filterNot { it==this || it.isBarbarianCivilization() })
|
||||
if(!diplomacy.containsKey(otherCiv.civName)){
|
||||
meetCivilization(otherCiv)
|
||||
addNotification("We have encountered [${otherCiv.civName}]!".tr(),null, Color.GOLD)
|
||||
|
@ -12,6 +12,7 @@ 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
|
||||
@ -63,14 +64,14 @@ class MapUnit {
|
||||
return movementAlgs().getDistanceToTilesWithinTurn(tile.position,currentMovement)
|
||||
}
|
||||
|
||||
@Transient var tempUniques: List<String> = ArrayList()
|
||||
@Transient var tempUniques= HashSet<String>()
|
||||
|
||||
fun getUniques(): List<String> {
|
||||
fun getUniques(): HashSet<String> {
|
||||
return tempUniques
|
||||
}
|
||||
|
||||
fun updateUniques(){
|
||||
val uniques = ArrayList<String>()
|
||||
val uniques = HashSet<String>()
|
||||
val baseUnit = baseUnit()
|
||||
uniques.addAll(baseUnit.uniques)
|
||||
uniques.addAll(promotions.promotions.map { GameBasics.UnitPromotions[it]!!.effect })
|
||||
@ -274,7 +275,7 @@ class MapUnit {
|
||||
|
||||
currentMovement -= distanceToTiles[otherTile]!!
|
||||
if (currentMovement < 0.1) currentMovement = 0f // silly floats which are "almost zero"
|
||||
if(isFortified() || action=="Set Up") action=null // unfortify/setup after moving
|
||||
if(isFortified() || action=="Set Up" || action=="Sleep") action=null // unfortify/setup after moving
|
||||
removeFromTile()
|
||||
putInTile(otherTile)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user