mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-20 19:56:51 +01:00
updated version from unitType to BaseUnit
This commit is contained in:
parent
5ca4104f35
commit
58c806c184
|
|
@ -114,7 +114,7 @@ Cannot be purchased =
|
|||
Can only be purchased =
|
||||
See also =
|
||||
Use default promotions =
|
||||
Default promotions for [unitType] =
|
||||
Default promotions for [unitName] =
|
||||
|
||||
Requires at least one of the following: =
|
||||
Requires all of the following: =
|
||||
|
|
|
|||
|
|
@ -93,9 +93,9 @@ class City : IsPartOfGameInfoSerialization, INamed {
|
|||
var isPuppet = false
|
||||
var shouldReassignPopulation = false // flag so that on startTurn() we reassign population
|
||||
|
||||
var unitTypeShouldUseSavedPromotion = HashMap<String, Boolean>()
|
||||
var unitShouldUseSavedPromotion = HashMap<String, Boolean>()
|
||||
|
||||
var cityUnitTypePromotions = HashMap<String, UnitPromotions>()
|
||||
var cityUnitPromotions = HashMap<String, UnitPromotions>()
|
||||
|
||||
@delegate:Transient
|
||||
val neighboringCities: List<City> by lazy {
|
||||
|
|
@ -158,8 +158,8 @@ class City : IsPartOfGameInfoSerialization, INamed {
|
|||
toReturn.avoidGrowth = avoidGrowth
|
||||
toReturn.manualSpecialists = manualSpecialists
|
||||
toReturn.connectedToCapitalStatus = connectedToCapitalStatus
|
||||
toReturn.unitTypeShouldUseSavedPromotion = unitTypeShouldUseSavedPromotion
|
||||
toReturn.cityUnitTypePromotions = cityUnitTypePromotions
|
||||
toReturn.unitShouldUseSavedPromotion = unitShouldUseSavedPromotion
|
||||
toReturn.cityUnitPromotions = cityUnitPromotions
|
||||
return toReturn
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -469,8 +469,8 @@ class CityConstructions : IsPartOfGameInfoSerialization {
|
|||
// Check if the player want to rebuild the unit the saved promotion
|
||||
// and null check.
|
||||
// and finally check if the current unit has enough XP.
|
||||
val savedPromotion = city.cityUnitTypePromotions[unit.baseUnit.unitType]
|
||||
if (city.unitTypeShouldUseSavedPromotion[unit.baseUnit.unitType] == true &&
|
||||
val savedPromotion = city.cityUnitPromotions[unit.baseUnit.name]
|
||||
if (city.unitShouldUseSavedPromotion[unit.baseUnit.name] == true &&
|
||||
savedPromotion != null && unit.promotions.XP >= savedPromotion.XP) {
|
||||
|
||||
for (promotions in savedPromotion.promotions) {
|
||||
|
|
|
|||
|
|
@ -101,13 +101,13 @@ class ConstructionInfoTable(val cityScreen: CityScreen) : Table() {
|
|||
}
|
||||
}
|
||||
if (construction is BaseUnit) {
|
||||
val unitType = construction.unitType
|
||||
val baseUnitName = construction.name
|
||||
|
||||
val buildUnitWithPromotions = city.unitTypeShouldUseSavedPromotion[unitType]
|
||||
val buildUnitWithPromotions = city.unitShouldUseSavedPromotion[baseUnitName]
|
||||
|
||||
if (buildUnitWithPromotions != null) {
|
||||
row()
|
||||
add("Use default promotions".toCheckBox(buildUnitWithPromotions) {city.unitTypeShouldUseSavedPromotion[unitType] = it}).colspan(2).center()
|
||||
add("Use default promotions".toCheckBox(buildUnitWithPromotions) {city.unitShouldUseSavedPromotion[baseUnitName] = it}).colspan(2).center()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ class PromotionPickerScreen private constructor(
|
|||
|
||||
// adds the checkBoxs to choice to save unit promotion.
|
||||
private fun saveUnitTypePromotionForCity() {
|
||||
val checkBoxSaveUnitPromotion = "Default promotions for [${unit.baseUnit.unitType}]".toCheckBox(saveUnitTypePromotion) {saveUnitTypePromotion = it}
|
||||
val checkBoxSaveUnitPromotion = "Default promotions for [${unit.baseUnit.name}]".toCheckBox(saveUnitTypePromotion) {saveUnitTypePromotion = it}
|
||||
promotionsTable.add(checkBoxSaveUnitPromotion)
|
||||
}
|
||||
|
||||
|
|
@ -213,8 +213,8 @@ class PromotionPickerScreen private constructor(
|
|||
|
||||
if (unitCurrentCity != null) {
|
||||
// If you are clicked the save unitType promotion, you want the next unitType to have the same promotion.
|
||||
unitCurrentCity.unitTypeShouldUseSavedPromotion.put(unit.baseUnit.unitType,true)
|
||||
unitCurrentCity.cityUnitTypePromotions.put(unit.baseUnit.unitType,unit.promotions)
|
||||
unitCurrentCity.unitShouldUseSavedPromotion.put(unit.baseUnit.name,true)
|
||||
unitCurrentCity.cityUnitPromotions.put(unit.baseUnit.name,unit.promotions)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user