Skip to content

Commit

Permalink
Added an UniqueType to Found puppet city. (yairm210#12834)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
Emandac authored Jan 22, 2025
1 parent 9fc2510 commit 19d0fbc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions core/src/com/unciv/models/ruleset/unique/UniqueType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 <by consuming this unit>"
CreateWaterImprovements("May create improvements on water resources", UniqueTarget.Unit),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 19d0fbc

Please sign in to comment.