From 19d0fbc05005cef22f67a347e2e92b847137e64f Mon Sep 17 00:00:00 2001 From: General_E <121508218+Emandac@users.noreply.github.com> Date: Wed, 22 Jan 2025 16:40:05 +0100 Subject: [PATCH] Added an UniqueType to Found puppet city. (#12834) * Settler settle best tile when not escort and dangerous Tiles instead of running away Settler unit will now settle on best tile in dangerous Tiles without escort instead of running away. * Update WorkerAutomation.kt * Update SpecificUnitAutomation.kt * Update WorkerAutomation.kt * Update SpecificUnitAutomation.kt * Now city states get mad when you steal their Lands * new version * change to getDiplomacyManagerOrMeet * added text to template.properties and changed AlertPopup.kt * Update template.properties * with period at the end :b * add flag now * Made Option to declare war when a city state is bullied unavailable * added option to change the Maximum Autosave turns stored * remove print * change letter * should fix issue with building test * update with changes * Added UniqueType.FoundPuppetCity with "Founds a new puppet city" in "uniques" of an unit in Units.json. Making it so you can now settle a puppet city. --- .../unciv/models/ruleset/unique/UniqueType.kt | 1 + .../unit/actions/UnitActionsFromUniques.kt | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt index 50fccfc53657e..9401f8503e9c0 100644 --- a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt +++ b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt @@ -348,6 +348,7 @@ enum class UniqueType( // Unit actions should look like: "Can {action description}, to allow them to be combined with modifiers FoundCity("Founds a new city", UniqueTarget.UnitAction), + FoundPuppetCity("Founds a new puppet city", UniqueTarget.UnitAction), ConstructImprovementInstantly("Can instantly construct a [improvementFilter] improvement", UniqueTarget.UnitAction), // TODO: Should be replaced by "Can instantly construct a [] improvement " CreateWaterImprovements("May create improvements on water resources", UniqueTarget.Unit), diff --git a/core/src/com/unciv/ui/screens/worldscreen/unit/actions/UnitActionsFromUniques.kt b/core/src/com/unciv/ui/screens/worldscreen/unit/actions/UnitActionsFromUniques.kt index 33d94c5454601..1129eb988ce63 100644 --- a/core/src/com/unciv/ui/screens/worldscreen/unit/actions/UnitActionsFromUniques.kt +++ b/core/src/com/unciv/ui/screens/worldscreen/unit/actions/UnitActionsFromUniques.kt @@ -39,8 +39,11 @@ object UnitActionsFromUniques { * (no movement left, too close to another city). */ internal fun getFoundCityAction(unit: MapUnit, tile: Tile): UnitAction? { - val unique = UnitActionModifiers.getUsableUnitActionUniques(unit, UniqueType.FoundCity) - .firstOrNull() ?: return null + // FoundPuppetCity is to found a puppet city for modding. + val unique = UnitActionModifiers.getUsableUnitActionUniques(unit, + UniqueType.FoundCity).firstOrNull() ?: + UnitActionModifiers.getUsableUnitActionUniques(unit, + UniqueType.FoundPuppetCity).firstOrNull() ?: return null if (tile.isWater || tile.isImpassible()) return null // Spain should still be able to build Conquistadors in a one city challenge - but can't settle them @@ -54,12 +57,19 @@ object UnitActionsFromUniques { ) == true } val foundAction = { if (unit.civ.playerType != PlayerType.AI) - UncivGame.Current.settings.addCompletedTutorialTask("Found city") - unit.civ.addCity(tile.position, unit) + // Now takes on the text of the unique. + UncivGame.Current.settings.addCompletedTutorialTask( + unique.text) + // Get the city to be able to change it into puppet, for modding. + val city = unit.civ.addCity(tile.position, unit) if (hasActionModifiers) UnitActionModifiers.activateSideEffects(unit, unique) else unit.destroy() GUI.setUpdateWorldOnNextRender() // Set manually, since this could be triggered from the ConfirmPopup and not from the UnitActionsTable + // If unit has FoundPuppetCity make it into a puppet city. + if (unique.type == UniqueType.FoundPuppetCity) { + city.isPuppet = true + } } if (unit.civ.playerType == PlayerType.AI)