Skip to content
Snippets Groups Projects
Commit 65544312 authored by izajime's avatar izajime
Browse files

Feature: La tienda ahora tambien ofrece objetos de utilidad

parent a2877531
Branches
No related tags found
2 merge requests!65Feature:,!51Tienda to guapa
...@@ -87,14 +87,15 @@ object RepositorioObjetos { ...@@ -87,14 +87,15 @@ object RepositorioObjetos {
} }
fun obtenerObjetosAleatoriosTienda(cantidad: Int): ArrayList<String> { fun obtenerObjetosAleatoriosTienda(cantidad: Int): ArrayList<String> {
val consumibles = objetos.values.filterIsInstance<ObjetoConsumible>() val consumibles = objetos.values.filter { it is ObjetoConsumible || it is ObjetoUtilidad }
return ArrayList<String>().apply { return ArrayList<String>().apply {
repeat(cantidad) { repeat(cantidad) {
add(consumibles.random().nombre) add((consumibles.random()).nombre)
} }
} }
} }
fun convertirNombresAObjetos(nombres: List<String>): List<Objeto?> { fun convertirNombresAObjetos(nombres: List<String>): List<Objeto?> {
return nombres.map { nombre -> return nombres.map { nombre ->
obtenerObjetoPorNombre(nombre) obtenerObjetoPorNombre(nombre)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment