mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-22 10:54:19 -04:00
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.
This commit is contained in:
parent
9fc2510fe0
commit
19d0fbc050
@ -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),
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user