mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-31 15:19:29 +07:00
Added the "crudely-drawn map" to ancient ruins outcomes (#1645)
* Added the "crudely-drawn map" to ancient ruins outcomes Closes #1640 * Extracted the constants for readability Co-authored-by: Yair Morgenstern <yairm210@hotmail.com>
This commit is contained in:
@ -15,6 +15,7 @@ import com.unciv.models.ruleset.tile.TerrainType
|
||||
import com.unciv.models.ruleset.unit.BaseUnit
|
||||
import com.unciv.models.ruleset.unit.UnitType
|
||||
import java.text.DecimalFormat
|
||||
import kotlin.random.Random
|
||||
|
||||
class MapUnit {
|
||||
|
||||
@ -63,6 +64,12 @@ class MapUnit {
|
||||
var promotions = UnitPromotions()
|
||||
var due: Boolean = true
|
||||
|
||||
companion object {
|
||||
private const val ANCIENT_RUIN_MAP_REVEAL_OFFSET = 4
|
||||
private const val ANCIENT_RUIN_MAP_REVEAL_RANGE = 4
|
||||
private const val ANCIENT_RUIN_MAP_REVEAL_CHANCE = 0.8f
|
||||
}
|
||||
|
||||
//region pure functions
|
||||
fun clone(): MapUnit {
|
||||
val toReturn = MapUnit()
|
||||
@ -507,6 +514,17 @@ class MapUnit {
|
||||
civInfo.addNotification("We have found a stash of [$amount] gold in the ruins!",tile.position, Color.GOLD)
|
||||
}
|
||||
|
||||
// Map of the surrounding area
|
||||
actions.add {
|
||||
val revealCenter = tile.getTilesAtDistance(ANCIENT_RUIN_MAP_REVEAL_OFFSET).random()
|
||||
val tilesToReveal = revealCenter
|
||||
.getTilesInDistance(ANCIENT_RUIN_MAP_REVEAL_RANGE)
|
||||
.filter { Random.nextFloat() < ANCIENT_RUIN_MAP_REVEAL_CHANCE }
|
||||
.map { it.position }
|
||||
civInfo.exploredTiles.addAll(tilesToReveal)
|
||||
civInfo.addNotification("We have found a crudely-drawn map in the ruins!", tile.position, Color.RED)
|
||||
}
|
||||
|
||||
(actions.random())()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user