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
@ -1026,7 +1026,7 @@
|
||||
"name": "Manhattan Project",
|
||||
"cost": 750,
|
||||
"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"
|
||||
},
|
||||
{
|
||||
@ -1078,7 +1078,7 @@
|
||||
"cost": 750,
|
||||
"isNationalWonder": true,
|
||||
"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"
|
||||
},
|
||||
|
||||
@ -1138,7 +1138,7 @@
|
||||
"cost": 1500,
|
||||
"isNationalWonder": true,
|
||||
"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
|
||||
|
@ -895,7 +895,7 @@
|
||||
"name": "Manhattan Project",
|
||||
"cost": 750,
|
||||
"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"
|
||||
},
|
||||
{
|
||||
@ -932,7 +932,7 @@
|
||||
"cost": 750,
|
||||
"isNationalWonder": true,
|
||||
"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"
|
||||
},
|
||||
|
||||
@ -966,7 +966,7 @@
|
||||
"cost": 1500,
|
||||
"isNationalWonder": true,
|
||||
"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 =
|
||||
Not displayed as an available construction unless [building] is built =
|
||||
Not displayed as an available construction without [resource] =
|
||||
Cannot be hurried =
|
||||
|
||||
Choose a free great person =
|
||||
Get [unitName] =
|
||||
|
@ -189,6 +189,11 @@ class CityConstructions {
|
||||
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 */
|
||||
fun isFirstConstructionOfItsKind(constructionQueueIndex: Int, name: String): Boolean {
|
||||
// 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),
|
||||
|
||||
CannotBeHurried("Cannot be hurried", UniqueTarget.Building, UniqueTarget.Tech),
|
||||
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),
|
||||
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) {
|
||||
|
||||
if (unit.currentMovement > 0) for (unique in unit.getUniques()) when (unique.placeholderText) {
|
||||
"Can hurry technology research" -> {
|
||||
if (unit.currentMovement > 0) for (unique in unit.getUniques()) when (unique.type) {
|
||||
UniqueType.CanHurryResearch -> {
|
||||
actionList += UnitAction(UnitActionType.HurryResearch,
|
||||
action = {
|
||||
unit.civInfo.tech.addScience(unit.civInfo.tech.getScienceFromGreatScientist())
|
||||
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()
|
||||
actionList += UnitAction(UnitActionType.StartGoldenAge,
|
||||
action = {
|
||||
@ -507,11 +508,11 @@ object UnitActions {
|
||||
}.takeIf { unit.currentTile.getOwner() != null && unit.currentTile.getOwner() == unit.civInfo }
|
||||
)
|
||||
}
|
||||
"Can speed up the construction of a wonder" -> {
|
||||
UniqueType.CanSpeedupWonderConstruction -> {
|
||||
val canHurryWonder =
|
||||
if (!tile.isCityCenter()) false
|
||||
else tile.getCity()!!.cityConstructions.isBuildingWonder()
|
||||
|
||||
&& tile.getCity()!!.cityConstructions.canBeHurried()
|
||||
|
||||
actionList += UnitAction(UnitActionType.HurryWonder,
|
||||
action = {
|
||||
@ -526,15 +527,15 @@ object UnitActions {
|
||||
)
|
||||
}
|
||||
|
||||
"Can speed up construction of a building" -> {
|
||||
UniqueType.CanSpeedupConstruction -> {
|
||||
if (!tile.isCityCenter()) {
|
||||
actionList += UnitAction(UnitActionType.HurryBuilding, action = null)
|
||||
continue
|
||||
}
|
||||
|
||||
val canHurryConstruction = tile.getCity()!!.cityConstructions.getCurrentConstruction() is Building
|
||||
|
||||
val cityConstructions = tile.getCity()!!.cityConstructions
|
||||
val canHurryConstruction = cityConstructions.getCurrentConstruction() is Building
|
||||
&& cityConstructions.canBeHurried()
|
||||
|
||||
//http://civilization.wikia.com/wiki/Great_engineer_(Civ5)
|
||||
val productionPointsToAdd = min(
|
||||
@ -555,7 +556,7 @@ object UnitActions {
|
||||
}.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
|
||||
&& tile.owningCity?.civInfo?.isAtWarWith(unit.civInfo) == false
|
||||
val influenceEarned = unique.params[0].toFloat()
|
||||
|
Loading…
Reference in New Issue
Block a user