mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-13 09:18:43 +07:00
Removed our getRandom() extension, because it now comes built-in in Kotlin, yay!
This commit is contained in:
@ -4727,6 +4727,7 @@
|
||||
German:"Kartentyp"
|
||||
Dutch:"Kaarttype"
|
||||
}
|
||||
"No barbarians":{}
|
||||
|
||||
// Diplomacy!
|
||||
|
||||
|
@ -8,11 +8,10 @@ import com.unciv.logic.map.MapType
|
||||
import com.unciv.logic.map.TileInfo
|
||||
import com.unciv.logic.map.TileMap
|
||||
import com.unciv.models.gamebasics.GameBasics
|
||||
import com.unciv.ui.utils.getRandom
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
import kotlin.math.min
|
||||
|
||||
|
||||
class GameParameters{
|
||||
var difficulty="Prince"
|
||||
var mapRadius=20
|
||||
@ -76,15 +75,18 @@ class GameStarter{
|
||||
}
|
||||
|
||||
fun getStartingLocations(numberOfPlayers:Int,tileMap: TileMap): Stack<TileInfo> {
|
||||
val landTiles = tileMap.values
|
||||
.filter { it.isLand() && !it.getBaseTerrain().impassable}
|
||||
|
||||
for(minimumDistanceBetweenStartingLocations in tileMap.tileMatrix.size/2 downTo 0){
|
||||
val freeTiles = tileMap.values
|
||||
.filter { it.isLand() && vectorIsWithinNTilesOfEdge(it.position,min(3,minimumDistanceBetweenStartingLocations),tileMap)}
|
||||
val freeTiles = landTiles
|
||||
.filter { vectorIsWithinNTilesOfEdge(it.position,min(3,minimumDistanceBetweenStartingLocations),tileMap)}
|
||||
.toMutableList()
|
||||
|
||||
val startingLocations = ArrayList<TileInfo>()
|
||||
for(player in 0..numberOfPlayers){
|
||||
if(freeTiles.isEmpty()) break // we failed to get all the starting locations with this minimum distance
|
||||
val randomLocation = freeTiles.getRandom()
|
||||
val randomLocation = freeTiles.random()
|
||||
startingLocations.add(randomLocation)
|
||||
freeTiles.removeAll(tileMap.getTilesInDistance(randomLocation.position,minimumDistanceBetweenStartingLocations))
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ import com.unciv.logic.civilization.PlayerType
|
||||
import com.unciv.logic.map.TileInfo
|
||||
import com.unciv.logic.map.TileMap
|
||||
import com.unciv.models.gamebasics.GameBasics
|
||||
import com.unciv.ui.utils.getRandom
|
||||
|
||||
class GameInfo {
|
||||
var civilizations = mutableListOf<CivilizationInfo>()
|
||||
@ -89,7 +88,7 @@ class GameInfo {
|
||||
.flatMap { it.viewableTiles }.toHashSet()
|
||||
val viableTiles = tileMap.values.filterNot { allViewableTiles.contains(it) || it.militaryUnit != null || it.civilianUnit != null }
|
||||
if (viableTiles.isEmpty()) return // no place for more barbs =(
|
||||
tile = viableTiles.getRandom()
|
||||
tile = viableTiles.random()
|
||||
}
|
||||
|
||||
// if we don't make this into a separate list then the retain() will happen on the Tech keys,
|
||||
@ -101,7 +100,7 @@ class GameInfo {
|
||||
val unitList = GameBasics.Units.values.filter { !it.unitType.isCivilian() && it.uniqueTo == null }
|
||||
.filter{ allResearchedTechs.contains(it.requiredTech)
|
||||
&& (it.obsoleteTech == null || !allResearchedTechs.contains(it.obsoleteTech!!)) }
|
||||
val unit = if (unitList.isEmpty()) "Warrior" else unitList.getRandom().name
|
||||
val unit = if (unitList.isEmpty()) "Warrior" else unitList.random().name
|
||||
|
||||
tileMap.placeUnitNearTile(tile!!.position, unit, getBarbarianCivilization())
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import com.unciv.logic.map.TileInfo
|
||||
import com.unciv.models.gamebasics.unit.BaseUnit
|
||||
import com.unciv.models.gamebasics.unit.UnitType
|
||||
import com.unciv.models.stats.Stats
|
||||
import com.unciv.ui.utils.getRandom
|
||||
import kotlin.math.max
|
||||
import kotlin.math.sqrt
|
||||
|
||||
@ -58,7 +57,7 @@ class Automation {
|
||||
chosenUnit = militaryUnits.filter { it.unitType== UnitType.Ranged }.maxBy { it.cost }!!
|
||||
|
||||
else{ // randomize type of unit and take the most expensive of its kind
|
||||
val chosenUnitType = militaryUnits.map { it.unitType }.distinct().filterNot{it==UnitType.Scout}.getRandom()
|
||||
val chosenUnitType = militaryUnits.map { it.unitType }.distinct().filterNot{it==UnitType.Scout}.random()
|
||||
chosenUnit = militaryUnits.filter { it.unitType==chosenUnitType }.maxBy { it.cost }!!
|
||||
}
|
||||
return chosenUnit.name
|
||||
@ -141,7 +140,7 @@ class Automation {
|
||||
if (buildableWonders.isNotEmpty()) {
|
||||
val citiesBuildingWonders = cityInfo.civInfo.cities
|
||||
.count { it.cityConstructions.isBuildingWonder() }
|
||||
val wonder = buildableWonders.getRandom()
|
||||
val wonder = buildableWonders.random()
|
||||
relativeCostEffectiveness.add(ConstructionChoice(wonder.name,5f / (citiesBuildingWonders + 1)))
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,6 @@ import com.unciv.logic.trade.TradeType
|
||||
import com.unciv.models.gamebasics.GameBasics
|
||||
import com.unciv.models.gamebasics.tech.Technology
|
||||
import com.unciv.models.gamebasics.tr
|
||||
import com.unciv.ui.utils.getRandom
|
||||
import kotlin.math.min
|
||||
|
||||
class NextTurnAutomation{
|
||||
@ -62,7 +61,7 @@ class NextTurnAutomation{
|
||||
&& !tradeLogic.currentTrade.ourOffers.contains(it) }
|
||||
|
||||
if (ourOfferList.isNotEmpty()) {
|
||||
tradeLogic.currentTrade.ourOffers.add(ourOfferList.getRandom())
|
||||
tradeLogic.currentTrade.ourOffers.add(ourOfferList.random())
|
||||
tradeLogic.currentTrade.theirOffers.add(theirOffer)
|
||||
} else {
|
||||
//try to buy tech with money, not spending more than 1/3 of treasury
|
||||
@ -96,11 +95,11 @@ class NextTurnAutomation{
|
||||
val techsCheapest = techsGroups[costs[0]]!!
|
||||
//Do not consider advanced techs if only one tech left in cheapest groupe
|
||||
if (techsCheapest.size == 1 || costs.size == 1) {
|
||||
tech = techsCheapest.getRandom()
|
||||
tech = techsCheapest.random()
|
||||
} else {
|
||||
//Choose randomly between cheapest and second cheapest groupe
|
||||
val techsAdvanced = techsGroups[costs[1]]!!
|
||||
tech = (techsCheapest + techsAdvanced).getRandom()
|
||||
tech = (techsCheapest + techsAdvanced).random()
|
||||
}
|
||||
|
||||
civInfo.tech.techsToResearch.add(tech.name)
|
||||
@ -111,7 +110,7 @@ class NextTurnAutomation{
|
||||
while (civInfo.policies.canAdoptPolicy()) {
|
||||
val adoptablePolicies = GameBasics.PolicyBranches.values.flatMap { it.policies.union(listOf(it)) }
|
||||
.filter { civInfo.policies.isAdoptable(it) }
|
||||
val policyToAdopt = adoptablePolicies.getRandom()
|
||||
val policyToAdopt = adoptablePolicies.random()
|
||||
civInfo.policies.adopt(policyToAdopt)
|
||||
}
|
||||
}
|
||||
@ -213,7 +212,7 @@ class NextTurnAutomation{
|
||||
if (unit.promotions.canBePromoted()) {
|
||||
val availablePromotions = unit.promotions.getAvailablePromotions()
|
||||
if (availablePromotions.isNotEmpty())
|
||||
unit.promotions.addPromotion(availablePromotions.getRandom().name)
|
||||
unit.promotions.addPromotion(availablePromotions.random().name)
|
||||
}
|
||||
|
||||
when {
|
||||
|
@ -8,7 +8,6 @@ import com.unciv.logic.civilization.diplomacy.DiplomaticStatus
|
||||
import com.unciv.logic.map.MapUnit
|
||||
import com.unciv.logic.map.TileInfo
|
||||
import com.unciv.models.gamebasics.GameBasics
|
||||
import com.unciv.ui.utils.getRandom
|
||||
import com.unciv.ui.worldscreen.unit.UnitAction
|
||||
import com.unciv.ui.worldscreen.unit.UnitActions
|
||||
|
||||
@ -417,8 +416,8 @@ class UnitAutomation{
|
||||
.filter { unit.canMoveTo(it.key) && unit.movementAlgs().canReach(it.key) }
|
||||
|
||||
val reachableTilesMaxWalkingDistance = reachableTiles.filter { it.value == unit.currentMovement }
|
||||
if (reachableTilesMaxWalkingDistance.any()) unit.moveToTile(reachableTilesMaxWalkingDistance.toList().getRandom().first)
|
||||
else if (reachableTiles.any()) unit.moveToTile(reachableTiles.toList().getRandom().first)
|
||||
if (reachableTilesMaxWalkingDistance.any()) unit.moveToTile(reachableTilesMaxWalkingDistance.toList().random().first)
|
||||
else if (reachableTiles.any()) unit.moveToTile(reachableTiles.toList().random().first)
|
||||
}
|
||||
|
||||
fun automatedExplore(unit:MapUnit){
|
||||
@ -435,7 +434,7 @@ class UnitAutomation{
|
||||
.filter { unit.canMoveTo(it) && it.position !in unit.civInfo.exploredTiles
|
||||
&& unit.movementAlgs().canReach(it) }
|
||||
if(unexploredTilesAtDistance.isNotEmpty()){
|
||||
unit.movementAlgs().headTowards(unexploredTilesAtDistance.getRandom())
|
||||
unit.movementAlgs().headTowards(unexploredTilesAtDistance.random())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ import com.unciv.models.gamebasics.tile.ResourceType
|
||||
import com.unciv.models.gamebasics.tile.TileResource
|
||||
import com.unciv.models.gamebasics.tr
|
||||
import com.unciv.models.stats.Stats
|
||||
import com.unciv.ui.utils.getRandom
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
import kotlin.collections.HashMap
|
||||
@ -430,7 +429,7 @@ class CivilizationInfo {
|
||||
notifications.add(Notification(text, location,color))
|
||||
}
|
||||
|
||||
fun addGreatPerson(greatPerson: String, city:CityInfo = cities.getRandom()) {
|
||||
fun addGreatPerson(greatPerson: String, city:CityInfo = cities.random()) {
|
||||
placeUnitNearTile(city.location, greatPerson)
|
||||
addNotification("A [$greatPerson] has been born!".tr(), city.location, Color.GOLD)
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package com.unciv.logic.civilization
|
||||
|
||||
import com.unciv.models.gamebasics.GameBasics
|
||||
import com.unciv.models.gamebasics.Policy
|
||||
import com.unciv.ui.utils.getRandom
|
||||
|
||||
|
||||
class PolicyManager {
|
||||
@ -75,7 +74,7 @@ class PolicyManager {
|
||||
"Free Religion" -> freePolicies++
|
||||
"Liberty Complete" -> {
|
||||
if (civInfo.isPlayerCivilization()) civInfo.greatPeople.freeGreatPeople++
|
||||
else civInfo.addGreatPerson(GameBasics.Units.keys.filter { it.startsWith("Great") }.getRandom())
|
||||
else civInfo.addGreatPerson(GameBasics.Units.keys.filter { it.startsWith("Great") }.random())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,6 @@ import com.unciv.models.gamebasics.tech.TechEra
|
||||
import com.unciv.models.gamebasics.tile.TerrainType
|
||||
import com.unciv.models.gamebasics.unit.BaseUnit
|
||||
import com.unciv.models.gamebasics.unit.UnitType
|
||||
import com.unciv.ui.utils.getRandom
|
||||
import java.text.DecimalFormat
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
@ -419,7 +418,7 @@ class MapUnit {
|
||||
currentTile.improvement=null
|
||||
val actions: ArrayList<() -> Unit> = ArrayList()
|
||||
if(civInfo.cities.isNotEmpty()) actions.add {
|
||||
val city = civInfo.cities.getRandom()
|
||||
val city = civInfo.cities.random()
|
||||
city.population.population++
|
||||
city.population.autoAssignPopulation()
|
||||
civInfo.addNotification("We have found survivors the ruins - population added to ["+city.name+"]",currentTile.position, Color.GREEN)
|
||||
@ -432,13 +431,13 @@ class MapUnit {
|
||||
}
|
||||
if(researchableAncientEraTechs.isNotEmpty())
|
||||
actions.add {
|
||||
val tech = researchableAncientEraTechs.getRandom().name
|
||||
val tech = researchableAncientEraTechs.random().name
|
||||
civInfo.tech.addTechnology(tech)
|
||||
civInfo.addNotification("We have discovered the lost technology of [$tech] in the ruins!",currentTile.position, Color.BLUE)
|
||||
}
|
||||
|
||||
actions.add {
|
||||
val chosenUnit = listOf("Settler","Worker","Warrior").getRandom()
|
||||
val chosenUnit = listOf("Settler","Worker","Warrior").random()
|
||||
civInfo.placeUnitNearTile(currentTile.position,chosenUnit)
|
||||
civInfo.addNotification("A [$chosenUnit] has joined us!",currentTile.position, Color.BROWN)
|
||||
}
|
||||
@ -450,12 +449,12 @@ class MapUnit {
|
||||
}
|
||||
|
||||
actions.add {
|
||||
val amount = listOf(25,60,100).getRandom()
|
||||
val amount = listOf(25,60,100).random()
|
||||
civInfo.gold+=amount
|
||||
civInfo.addNotification("We have found a stash of [$amount] gold in the ruins!",currentTile.position, Color.GOLD)
|
||||
}
|
||||
|
||||
(actions.getRandom())()
|
||||
(actions.random())()
|
||||
}
|
||||
|
||||
fun assignOwner(civInfo:CivilizationInfo){
|
||||
|
@ -6,7 +6,6 @@ import com.unciv.models.gamebasics.GameBasics
|
||||
import com.unciv.models.gamebasics.tile.ResourceType
|
||||
import com.unciv.models.gamebasics.tile.TerrainType
|
||||
import com.unciv.models.gamebasics.tile.TileResource
|
||||
import com.unciv.ui.utils.getRandom
|
||||
import java.util.*
|
||||
import kotlin.collections.HashMap
|
||||
import kotlin.math.abs
|
||||
@ -113,13 +112,13 @@ class CelluarAutomataRandomMapGenerator(): SeedRandomMapGenerator() {
|
||||
val tilesInArea = ArrayList<Vector2>()
|
||||
val tilesToCheck = ArrayList<Vector2>()
|
||||
while (waterTiles.isNotEmpty()) {
|
||||
val initialWaterTile = waterTiles.getRandom()
|
||||
val initialWaterTile = waterTiles.random()
|
||||
tilesInArea += initialWaterTile
|
||||
tilesToCheck += initialWaterTile
|
||||
waterTiles -= initialWaterTile
|
||||
|
||||
while (tilesToCheck.isNotEmpty()) {
|
||||
val tileChecking = tilesToCheck.getRandom()
|
||||
val tileChecking = tilesToCheck.random()
|
||||
for (vector in HexMath().getVectorsAtDistance(tileChecking,1)
|
||||
.filter { !tilesInArea.contains(it) and waterTiles.contains(it) }) {
|
||||
tilesInArea += vector
|
||||
@ -175,9 +174,9 @@ class CelluarAutomataRandomMapGenerator(): SeedRandomMapGenerator() {
|
||||
val maxLatitude = abs(getLatitude(Vector2(distance.toFloat(), distance.toFloat())))
|
||||
|
||||
for (i in 0 until numberOfSeeds) {
|
||||
var terrain = if (Math.random() > waterPercent) terrains.getRandom().name
|
||||
var terrain = if (Math.random() > waterPercent) terrains.random().name
|
||||
else "Ocean"
|
||||
val tile = emptyTiles.getRandom()
|
||||
val tile = emptyTiles.random()
|
||||
|
||||
//change grassland to desert or tundra based on y
|
||||
if (abs(getLatitude(tile.position)) < maxLatitude * 0.1) {
|
||||
@ -266,13 +265,13 @@ class AlexanderRandomMapGenerator:RandomMapGenerator(){
|
||||
val grassland = "Grassland"
|
||||
val ocean = "Ocean"
|
||||
for(i in 0..distance*distance/6){
|
||||
val location = map.filter { it.value==null }.map { it.key }.getRandom()
|
||||
val location = map.filter { it.value==null }.map { it.key }.random()
|
||||
map[location] = TileInfo().apply { baseTerrain= grassland}
|
||||
sparkList.add(location)
|
||||
}
|
||||
|
||||
while(sparkList.any()){
|
||||
val currentSpark = sparkList.getRandom()
|
||||
val currentSpark = sparkList.random()
|
||||
val emptyTilesAroundSpark = HexMath().getAdjacentVectors(currentSpark)
|
||||
.filter { map.containsKey(it) && map[it]==null }
|
||||
if(map[currentSpark]!!.baseTerrain==grassland){
|
||||
@ -353,10 +352,10 @@ open class SeedRandomMapGenerator : RandomMapGenerator() {
|
||||
val numberOfSeeds = ceil(emptyTiles.size / averageTilesPerArea.toFloat()).toInt()
|
||||
|
||||
for (i in 0 until numberOfSeeds) {
|
||||
val terrain = if (Math.random() > waterPercent) terrains.getRandom().name
|
||||
val terrain = if (Math.random() > waterPercent) terrains.random().name
|
||||
else "Ocean"
|
||||
val area = Area(terrain)
|
||||
val tile = emptyTiles.getRandom()
|
||||
val tile = emptyTiles.random()
|
||||
emptyTiles -= tile
|
||||
area.addTile(tile)
|
||||
areas += area
|
||||
@ -377,7 +376,7 @@ open class SeedRandomMapGenerator : RandomMapGenerator() {
|
||||
fun expandAreas(areas: ArrayList<Area>, map: HashMap<Vector2, TileInfo>) {
|
||||
val expandableAreas = ArrayList<Area>(areas)
|
||||
while (expandableAreas.isNotEmpty()) {
|
||||
val areaToExpand = expandableAreas.getRandom()
|
||||
val areaToExpand = expandableAreas.random()
|
||||
if(areaToExpand.locations.size>=20){
|
||||
expandableAreas -= areaToExpand
|
||||
continue
|
||||
@ -387,7 +386,7 @@ open class SeedRandomMapGenerator : RandomMapGenerator() {
|
||||
.filter { map.containsKey(it) && map[it]!!.baseTerrain=="" }.toList()
|
||||
if (availableExpansionVectors.isEmpty()) expandableAreas -= areaToExpand
|
||||
else {
|
||||
val expansionVector = availableExpansionVectors.getRandom()
|
||||
val expansionVector = availableExpansionVectors.random()
|
||||
areaToExpand.addTile(map[expansionVector]!!)
|
||||
|
||||
val neighbors = HexMath().getAdjacentVectors(expansionVector)
|
||||
@ -420,7 +419,7 @@ open class RandomMapGenerator {
|
||||
tileInfo.position = position
|
||||
val terrains = GameBasics.Terrains.values
|
||||
|
||||
val baseTerrain = terrains.filter { it.type === TerrainType.Land && it.name != "Lakes" }.getRandom()
|
||||
val baseTerrain = terrains.filter { it.type === TerrainType.Land && it.name != "Lakes" }.random()
|
||||
tileInfo.baseTerrain = baseTerrain.name
|
||||
|
||||
addRandomTerrainFeature(tileInfo)
|
||||
@ -433,7 +432,7 @@ open class RandomMapGenerator {
|
||||
if (tileInfo.getBaseTerrain().canHaveOverlay && Math.random() > 0.7f) {
|
||||
val secondaryTerrains = GameBasics.Terrains.values
|
||||
.filter { it.type === TerrainType.TerrainFeature && it.occursOn!!.contains(tileInfo.baseTerrain) }
|
||||
if (secondaryTerrains.any()) tileInfo.terrainFeature = secondaryTerrains.getRandom().name
|
||||
if (secondaryTerrains.any()) tileInfo.terrainFeature = secondaryTerrains.random().name
|
||||
}
|
||||
}
|
||||
|
||||
@ -457,7 +456,7 @@ open class RandomMapGenerator {
|
||||
private fun getRandomResource(resources: List<TileResource>, resourceType: ResourceType): TileResource? {
|
||||
val filtered = resources.filter { it.resourceType == resourceType }
|
||||
if (filtered.isEmpty()) return null
|
||||
else return filtered.getRandom()
|
||||
else return filtered.random()
|
||||
}
|
||||
|
||||
open fun generateMap(distance: Int): HashMap<String, TileInfo> {
|
||||
|
@ -6,7 +6,6 @@ import com.unciv.logic.civilization.CivilizationInfo
|
||||
import com.unciv.models.gamebasics.tech.Technology
|
||||
import com.unciv.models.stats.NamedStats
|
||||
import com.unciv.models.stats.Stats
|
||||
import com.unciv.ui.utils.getRandom
|
||||
|
||||
class Building : NamedStats(), IConstruction{
|
||||
|
||||
@ -292,7 +291,7 @@ class Building : NamedStats(), IConstruction{
|
||||
"Free Social Policy" in uniques -> civInfo.policies.freePolicies++
|
||||
"Free Great Person" in uniques -> {
|
||||
if (civInfo.isPlayerCivilization()) civInfo.greatPeople.freeGreatPeople++
|
||||
else civInfo.addGreatPerson(GameBasics.Units.keys.filter { it.startsWith("Great") }.getRandom())
|
||||
else civInfo.addGreatPerson(GameBasics.Units.keys.filter { it.startsWith("Great") }.random())
|
||||
}
|
||||
"+1 population in each city" in uniques -> {
|
||||
for(city in civInfo.cities){
|
||||
|
@ -77,7 +77,7 @@ class NewGameScreen: PickerScreen(){
|
||||
|
||||
addDifficultySelectBox(newGameOptionsTable)
|
||||
|
||||
val noBarbariansCheckbox = CheckBox("No barbarians",skin)
|
||||
val noBarbariansCheckbox = CheckBox("No barbarians".tr(),skin)
|
||||
noBarbariansCheckbox.isChecked=newGameParameters.noBarbarians
|
||||
noBarbariansCheckbox.addListener(object : ChangeListener() {
|
||||
override fun changed(event: ChangeEvent?, actor: Actor?) {
|
||||
|
@ -10,7 +10,6 @@ import com.unciv.logic.GameSaver
|
||||
import com.unciv.models.gamebasics.tr
|
||||
import com.unciv.ui.pickerscreens.PickerScreen
|
||||
import com.unciv.ui.utils.enable
|
||||
import com.unciv.ui.utils.getRandom
|
||||
import com.unciv.ui.utils.onClick
|
||||
import com.unciv.ui.utils.toLabel
|
||||
|
||||
@ -41,7 +40,7 @@ class SaveScreen : PickerScreen() {
|
||||
"Fluffy","Magical","Invisible")
|
||||
val nouns = listOf("Moose","Pigeon","Weasel","Ferret","Onion","Marshmallow","Crocodile","Unicorn",
|
||||
"Sandwich","Elephant","Kangaroo","Marmot","Beagle","Dolphin","Fish","Tomato","Duck","Dinosaur")
|
||||
val defaultSaveName = adjectives.getRandom()+" "+nouns.getRandom()
|
||||
val defaultSaveName = adjectives.random()+" "+nouns.random()
|
||||
textField.text = defaultSaveName
|
||||
|
||||
newSave.add("Saved game name".toLabel()).row()
|
||||
|
@ -98,7 +98,6 @@ fun Button.enable() {
|
||||
color = Color.WHITE
|
||||
touchable = Touchable.enabled
|
||||
}
|
||||
fun <E> List<E>.getRandom(): E = if (size == 0) throw Exception() else get((Math.random() * size).toInt())
|
||||
|
||||
|
||||
fun colorFromRGB(r: Int, g: Int, b: Int): Color {
|
||||
|
Reference in New Issue
Block a user