mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-09 20:29:50 +07:00
Certain projects cannot be hurried by great engineer (#7076)
This commit is contained in:
parent
207cba0844
commit
b79246ee02
@ -385,7 +385,7 @@
|
|||||||
"uniques": ["[+2 Gold] from [Gold Ore] tiles [in this city]", "[+2 Gold] from [Silver] tiles [in this city]"],
|
"uniques": ["[+2 Gold] from [Gold Ore] tiles [in this city]", "[+2 Gold] from [Silver] tiles [in this city]"],
|
||||||
"requiredTech": "Currency"
|
"requiredTech": "Currency"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Petra",
|
"name": "Petra",
|
||||||
"culture": 1,
|
"culture": 1,
|
||||||
"isWonder": true,
|
"isWonder": true,
|
||||||
@ -1026,7 +1026,7 @@
|
|||||||
"name": "Manhattan Project",
|
"name": "Manhattan Project",
|
||||||
"cost": 750,
|
"cost": 750,
|
||||||
"isNationalWonder": true,
|
"isNationalWonder": true,
|
||||||
"uniques": ["Enables nuclear weapon", "Triggers a global alert upon completion"],
|
"uniques": ["Enables nuclear weapon", "Triggers a global alert upon completion", "Cannot be hurried"],
|
||||||
"requiredTech": "Atomic Theory"
|
"requiredTech": "Atomic Theory"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1077,8 +1077,8 @@
|
|||||||
"name": "Apollo Program",
|
"name": "Apollo Program",
|
||||||
"cost": 750,
|
"cost": 750,
|
||||||
"isNationalWonder": true,
|
"isNationalWonder": true,
|
||||||
"uniques": ["Enables construction of Spaceship parts", "Triggers a global alert upon completion",
|
"uniques": ["Enables construction of Spaceship parts", "Triggers a global alert upon completion",
|
||||||
"Hidden when [Scientific] Victory is disabled"],
|
"Hidden when [Scientific] Victory is disabled", "Cannot be hurried"],
|
||||||
"requiredTech": "Rocketry"
|
"requiredTech": "Rocketry"
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1138,11 +1138,11 @@
|
|||||||
"cost": 1500,
|
"cost": 1500,
|
||||||
"isNationalWonder": true,
|
"isNationalWonder": true,
|
||||||
"uniques": ["Hidden until [5] social policy branches have been completed", "Triggers a global alert upon build start",
|
"uniques": ["Hidden until [5] social policy branches have been completed", "Triggers a global alert upon build start",
|
||||||
"Triggers a Cultural Victory upon completion", "Hidden when [Cultural] Victory is disabled"]
|
"Triggers a Cultural Victory upon completion", "Hidden when [Cultural] Victory is disabled", "Cannot be hurried"]
|
||||||
},
|
},
|
||||||
|
|
||||||
// Religious buildings
|
// Religious buildings
|
||||||
|
|
||||||
{
|
{
|
||||||
"name": "Cathedral",
|
"name": "Cathedral",
|
||||||
"cost": 0,
|
"cost": 0,
|
||||||
@ -1157,7 +1157,7 @@
|
|||||||
"cost": 0,
|
"cost": 0,
|
||||||
"culture": 2,
|
"culture": 2,
|
||||||
"faith": 2,
|
"faith": 2,
|
||||||
"uniques": ["[+1 Culture, +1 Faith] from [Wine] tiles [in this city]",
|
"uniques": ["[+1 Culture, +1 Faith] from [Wine] tiles [in this city]",
|
||||||
"[+1 Culture, +1 Faith] from [Incense] tiles [in this city]",
|
"[+1 Culture, +1 Faith] from [Incense] tiles [in this city]",
|
||||||
"Unbuildable", "Hidden when religion is disabled", "Destroyed when the city is captured"]
|
"Unbuildable", "Hidden when religion is disabled", "Destroyed when the city is captured"]
|
||||||
},
|
},
|
||||||
|
@ -291,7 +291,7 @@
|
|||||||
"requiredBuilding": "Monument",
|
"requiredBuilding": "Monument",
|
||||||
"requiredTech": "Philosophy"
|
"requiredTech": "Philosophy"
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name": "National College",
|
"name": "National College",
|
||||||
"cost": 125,
|
"cost": 125,
|
||||||
@ -895,7 +895,7 @@
|
|||||||
"name": "Manhattan Project",
|
"name": "Manhattan Project",
|
||||||
"cost": 750,
|
"cost": 750,
|
||||||
"isNationalWonder": true,
|
"isNationalWonder": true,
|
||||||
"uniques": ["Enables nuclear weapon", "Triggers a global alert upon completion"],
|
"uniques": ["Enables nuclear weapon", "Triggers a global alert upon completion", "Cannot be hurried"],
|
||||||
"requiredTech": "Atomic Theory"
|
"requiredTech": "Atomic Theory"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -931,8 +931,8 @@
|
|||||||
"name": "Apollo Program",
|
"name": "Apollo Program",
|
||||||
"cost": 750,
|
"cost": 750,
|
||||||
"isNationalWonder": true,
|
"isNationalWonder": true,
|
||||||
"uniques": ["Enables construction of Spaceship parts", "Triggers a global alert upon completion",
|
"uniques": ["Enables construction of Spaceship parts", "Triggers a global alert upon completion",
|
||||||
"Hidden when [Scientific] Victory is disabled"],
|
"Hidden when [Scientific] Victory is disabled", "Cannot be hurried"],
|
||||||
"requiredTech": "Rocketry"
|
"requiredTech": "Rocketry"
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -966,7 +966,7 @@
|
|||||||
"cost": 1500,
|
"cost": 1500,
|
||||||
"isNationalWonder": true,
|
"isNationalWonder": true,
|
||||||
"uniques": ["Hidden until [5] social policy branches have been completed", "Triggers a global alert upon build start",
|
"uniques": ["Hidden until [5] social policy branches have been completed", "Triggers a global alert upon build start",
|
||||||
"Triggers a Cultural Victory upon completion", "Hidden when [Cultural] Victory is disabled"]
|
"Triggers a Cultural Victory upon completion", "Hidden when [Cultural] Victory is disabled", "Cannot be hurried"]
|
||||||
}
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
|
@ -62,6 +62,7 @@ Close Unciv =
|
|||||||
Unsellable =
|
Unsellable =
|
||||||
Not displayed as an available construction unless [building] is built =
|
Not displayed as an available construction unless [building] is built =
|
||||||
Not displayed as an available construction without [resource] =
|
Not displayed as an available construction without [resource] =
|
||||||
|
Cannot be hurried =
|
||||||
|
|
||||||
Choose a free great person =
|
Choose a free great person =
|
||||||
Get [unitName] =
|
Get [unitName] =
|
||||||
|
@ -189,6 +189,11 @@ class CityConstructions {
|
|||||||
return currentConstruction is Building && currentConstruction.isWonder
|
return currentConstruction is Building && currentConstruction.isWonder
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun canBeHurried(): Boolean {
|
||||||
|
val currentConstruction = getCurrentConstruction()
|
||||||
|
return currentConstruction is INonPerpetualConstruction && !currentConstruction.hasUnique(UniqueType.CannotBeHurried)
|
||||||
|
}
|
||||||
|
|
||||||
/** If the city is constructing multiple units of the same type, subsequent units will require the full cost */
|
/** If the city is constructing multiple units of the same type, subsequent units will require the full cost */
|
||||||
fun isFirstConstructionOfItsKind(constructionQueueIndex: Int, name: String): Boolean {
|
fun isFirstConstructionOfItsKind(constructionQueueIndex: Int, name: String): Boolean {
|
||||||
// if the construction name is the same as the current construction, it isn't the first
|
// if the construction name is the same as the current construction, it isn't the first
|
||||||
|
@ -533,7 +533,9 @@ enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags:
|
|||||||
|
|
||||||
CanActionSeveralTimes("Can [action] [amount] times", UniqueTarget.Unit),
|
CanActionSeveralTimes("Can [action] [amount] times", UniqueTarget.Unit),
|
||||||
|
|
||||||
|
CannotBeHurried("Cannot be hurried", UniqueTarget.Building, UniqueTarget.Tech),
|
||||||
CanSpeedupConstruction("Can speed up construction of a building", UniqueTarget.Unit),
|
CanSpeedupConstruction("Can speed up construction of a building", UniqueTarget.Unit),
|
||||||
|
CanSpeedupWonderConstruction("Can speed up the construction of a wonder", UniqueTarget.Unit),
|
||||||
CanHurryResearch("Can hurry technology research", UniqueTarget.Unit),
|
CanHurryResearch("Can hurry technology research", UniqueTarget.Unit),
|
||||||
CanTradeWithCityStateForGoldAndInfluence("Can undertake a trade mission with City-State, giving a large sum of gold and [amount] Influence", UniqueTarget.Unit),
|
CanTradeWithCityStateForGoldAndInfluence("Can undertake a trade mission with City-State, giving a large sum of gold and [amount] Influence", UniqueTarget.Unit),
|
||||||
|
|
||||||
|
@ -489,16 +489,17 @@ object UnitActions {
|
|||||||
|
|
||||||
private fun addGreatPersonActions(unit: MapUnit, actionList: ArrayList<UnitAction>, tile: TileInfo) {
|
private fun addGreatPersonActions(unit: MapUnit, actionList: ArrayList<UnitAction>, tile: TileInfo) {
|
||||||
|
|
||||||
if (unit.currentMovement > 0) for (unique in unit.getUniques()) when (unique.placeholderText) {
|
if (unit.currentMovement > 0) for (unique in unit.getUniques()) when (unique.type) {
|
||||||
"Can hurry technology research" -> {
|
UniqueType.CanHurryResearch -> {
|
||||||
actionList += UnitAction(UnitActionType.HurryResearch,
|
actionList += UnitAction(UnitActionType.HurryResearch,
|
||||||
action = {
|
action = {
|
||||||
unit.civInfo.tech.addScience(unit.civInfo.tech.getScienceFromGreatScientist())
|
unit.civInfo.tech.addScience(unit.civInfo.tech.getScienceFromGreatScientist())
|
||||||
unit.consume()
|
unit.consume()
|
||||||
}.takeIf { unit.civInfo.tech.currentTechnologyName() != null }
|
}.takeIf { unit.civInfo.tech.currentTechnologyName() != null
|
||||||
|
&& !unit.civInfo.tech.currentTechnology()!!.hasUnique(UniqueType.CannotBeHurried) }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
"Can start an []-turn golden age" -> {
|
UniqueType.StartGoldenAge -> {
|
||||||
val turnsToGoldenAge = unique.params[0].toInt()
|
val turnsToGoldenAge = unique.params[0].toInt()
|
||||||
actionList += UnitAction(UnitActionType.StartGoldenAge,
|
actionList += UnitAction(UnitActionType.StartGoldenAge,
|
||||||
action = {
|
action = {
|
||||||
@ -507,11 +508,11 @@ object UnitActions {
|
|||||||
}.takeIf { unit.currentTile.getOwner() != null && unit.currentTile.getOwner() == unit.civInfo }
|
}.takeIf { unit.currentTile.getOwner() != null && unit.currentTile.getOwner() == unit.civInfo }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
"Can speed up the construction of a wonder" -> {
|
UniqueType.CanSpeedupWonderConstruction -> {
|
||||||
val canHurryWonder =
|
val canHurryWonder =
|
||||||
if (!tile.isCityCenter()) false
|
if (!tile.isCityCenter()) false
|
||||||
else tile.getCity()!!.cityConstructions.isBuildingWonder()
|
else tile.getCity()!!.cityConstructions.isBuildingWonder()
|
||||||
|
&& tile.getCity()!!.cityConstructions.canBeHurried()
|
||||||
|
|
||||||
actionList += UnitAction(UnitActionType.HurryWonder,
|
actionList += UnitAction(UnitActionType.HurryWonder,
|
||||||
action = {
|
action = {
|
||||||
@ -526,15 +527,15 @@ object UnitActions {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
"Can speed up construction of a building" -> {
|
UniqueType.CanSpeedupConstruction -> {
|
||||||
if (!tile.isCityCenter()) {
|
if (!tile.isCityCenter()) {
|
||||||
actionList += UnitAction(UnitActionType.HurryBuilding, action = null)
|
actionList += UnitAction(UnitActionType.HurryBuilding, action = null)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
val canHurryConstruction = tile.getCity()!!.cityConstructions.getCurrentConstruction() is Building
|
|
||||||
|
|
||||||
val cityConstructions = tile.getCity()!!.cityConstructions
|
val cityConstructions = tile.getCity()!!.cityConstructions
|
||||||
|
val canHurryConstruction = cityConstructions.getCurrentConstruction() is Building
|
||||||
|
&& cityConstructions.canBeHurried()
|
||||||
|
|
||||||
//http://civilization.wikia.com/wiki/Great_engineer_(Civ5)
|
//http://civilization.wikia.com/wiki/Great_engineer_(Civ5)
|
||||||
val productionPointsToAdd = min(
|
val productionPointsToAdd = min(
|
||||||
@ -555,7 +556,7 @@ object UnitActions {
|
|||||||
}.takeIf { canHurryConstruction }
|
}.takeIf { canHurryConstruction }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
"Can undertake a trade mission with City-State, giving a large sum of gold and [] Influence" -> {
|
UniqueType.CanTradeWithCityStateForGoldAndInfluence -> {
|
||||||
val canConductTradeMission = tile.owningCity?.civInfo?.isCityState() == true
|
val canConductTradeMission = tile.owningCity?.civInfo?.isCityState() == true
|
||||||
&& tile.owningCity?.civInfo?.isAtWarWith(unit.civInfo) == false
|
&& tile.owningCity?.civInfo?.isAtWarWith(unit.civInfo) == false
|
||||||
val influenceEarned = unique.params[0].toFloat()
|
val influenceEarned = unique.params[0].toFloat()
|
||||||
|
Loading…
Reference in New Issue
Block a user