diff --git a/core/src/com/unciv/GameStarter.kt b/core/src/com/unciv/GameStarter.kt index bd125bda9e..93f870008c 100644 --- a/core/src/com/unciv/GameStarter.kt +++ b/core/src/com/unciv/GameStarter.kt @@ -20,6 +20,7 @@ class GameParameters{ var humanNations=ArrayList().apply { add("Babylon") } var numberOfEnemies=3 var mapType= MapType.Perlin + var noBarbarians=false var mapFileName :String?=null } diff --git a/core/src/com/unciv/logic/GameInfo.kt b/core/src/com/unciv/logic/GameInfo.kt index 5b70ae75d2..c7be01e047 100644 --- a/core/src/com/unciv/logic/GameInfo.kt +++ b/core/src/com/unciv/logic/GameInfo.kt @@ -47,7 +47,7 @@ class GameInfo { currentPlayerIndex = (currentPlayerIndex+1) % civilizations.size if(currentPlayerIndex==0){ turns++ - if (turns % 10 == 0) { // every 10 turns add a barbarian in a random place + if (turns % 10 == 0 && !gameParameters.noBarbarians) { // every 10 turns add a barbarian in a random place placeBarbarianUnit(null) } } diff --git a/core/src/com/unciv/ui/NewGameScreen.kt b/core/src/com/unciv/ui/NewGameScreen.kt index 4e5a18d205..7f0ff8cf28 100644 --- a/core/src/com/unciv/ui/NewGameScreen.kt +++ b/core/src/com/unciv/ui/NewGameScreen.kt @@ -2,10 +2,7 @@ package com.unciv.ui import com.badlogic.gdx.Gdx import com.badlogic.gdx.scenes.scene2d.Actor -import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane -import com.badlogic.gdx.scenes.scene2d.ui.SelectBox -import com.badlogic.gdx.scenes.scene2d.ui.Skin -import com.badlogic.gdx.scenes.scene2d.ui.Table +import com.badlogic.gdx.scenes.scene2d.ui.* import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener import com.badlogic.gdx.utils.Array import com.unciv.GameStarter @@ -80,6 +77,16 @@ class NewGameScreen: PickerScreen(){ addDifficultySelectBox(newGameOptionsTable) + val noBarbariansCheckbox = CheckBox("No barbarians",skin) + noBarbariansCheckbox.isChecked=newGameParameters.noBarbarians + noBarbariansCheckbox.addListener(object : ChangeListener() { + override fun changed(event: ChangeEvent?, actor: Actor?) { + newGameParameters.noBarbarians = noBarbariansCheckbox.isChecked + } + }) + newGameOptionsTable.add(noBarbariansCheckbox).colspan(2).row() + + rightSideButton.enable() rightSideButton.setText("Start game!".tr()) rightSideButton.onClick {