mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 14:24:43 -04:00
Implemented a cap for the production boost of great engineers (#4966)
* Implemented a cap for the production boost of great engineers * Added a hybrid solution * Adding production now shows the amount of production added
This commit is contained in:
parent
213e648517
commit
15c4b67781
@ -1494,7 +1494,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Great Engineer",
|
"name": "Great Engineer",
|
||||||
"unitType": "Civilian",
|
"unitType": "Civilian",
|
||||||
"uniques": ["Can speed up construction of a wonder", "Can construct [Manufactory]", "Great Person - [Production]", "Unbuildable", "Uncapturable"],
|
"uniques": ["Can speed up construction of a building", "Can construct [Manufactory]", "Great Person - [Production]", "Unbuildable", "Uncapturable"],
|
||||||
"movement": 2
|
"movement": 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -824,6 +824,7 @@ Hurry Research = Versnel Onderzoek
|
|||||||
Conduct Trade Mission = Voer handelsmissie uit
|
Conduct Trade Mission = Voer handelsmissie uit
|
||||||
Your trade mission to [civName] has earned you [goldAmount] gold and [influenceAmount] influence! = Jouw handelsmissie naar [civName] heeft je [goldAmount] goud en [influenceAmount] invloed opgeleverd!
|
Your trade mission to [civName] has earned you [goldAmount] gold and [influenceAmount] influence! = Jouw handelsmissie naar [civName] heeft je [goldAmount] goud en [influenceAmount] invloed opgeleverd!
|
||||||
Hurry Wonder = Versnel Wonder
|
Hurry Wonder = Versnel Wonder
|
||||||
|
Hurry Construction = Versnel Constructie
|
||||||
Spread Religion = Verkondig Religie
|
Spread Religion = Verkondig Religie
|
||||||
Spread [religionName] = Verkondig [religionName]
|
Spread [religionName] = Verkondig [religionName]
|
||||||
Found a Religion = Begin een religie
|
Found a Religion = Begin een religie
|
||||||
|
@ -731,6 +731,8 @@ Hurry Research =
|
|||||||
Conduct Trade Mission =
|
Conduct Trade Mission =
|
||||||
Your trade mission to [civName] has earned you [goldAmount] gold and [influenceAmount] influence! =
|
Your trade mission to [civName] has earned you [goldAmount] gold and [influenceAmount] influence! =
|
||||||
Hurry Wonder =
|
Hurry Wonder =
|
||||||
|
Hurry Construction =
|
||||||
|
Hurry Construction (+[productionAmount]) =
|
||||||
Spread Religion =
|
Spread Religion =
|
||||||
Spread [religionName] =
|
Spread [religionName] =
|
||||||
Found a Religion =
|
Found a Religion =
|
||||||
|
@ -25,7 +25,7 @@ import kotlin.math.roundToInt
|
|||||||
* City constructions manager.
|
* City constructions manager.
|
||||||
*
|
*
|
||||||
* @property cityInfo the city it refers to
|
* @property cityInfo the city it refers to
|
||||||
* @property currentConstructionFromQueue the name of the construction is currently worked
|
* @property currentConstructionFromQueue name of the construction that is currently being produced
|
||||||
* @property currentConstructionIsUserSet a flag indicating if the [currentConstructionFromQueue] has been set by the user or by the AI
|
* @property currentConstructionIsUserSet a flag indicating if the [currentConstructionFromQueue] has been set by the user or by the AI
|
||||||
* @property constructionQueue a list of constructions names enqueued
|
* @property constructionQueue a list of constructions names enqueued
|
||||||
*/
|
*/
|
||||||
|
@ -122,6 +122,8 @@ enum class UnitActionType(
|
|||||||
{ ImageGetter.getUnitIcon("Great Artist") }, 'g', UncivSound.Chimes),
|
{ ImageGetter.getUnitIcon("Great Artist") }, 'g', UncivSound.Chimes),
|
||||||
HurryWonder("Hurry Wonder",
|
HurryWonder("Hurry Wonder",
|
||||||
{ ImageGetter.getUnitIcon("Great Engineer") }, 'g', UncivSound.Chimes),
|
{ ImageGetter.getUnitIcon("Great Engineer") }, 'g', UncivSound.Chimes),
|
||||||
|
HurryBuilding("Hurry Construction",
|
||||||
|
{ ImageGetter.getUnitIcon("Great Engineer") }, 'g', UncivSound.Chimes),
|
||||||
ConductTradeMission("Conduct Trade Mission",
|
ConductTradeMission("Conduct Trade Mission",
|
||||||
{ ImageGetter.getUnitIcon("Great Merchant") }, 'g', UncivSound.Chimes),
|
{ ImageGetter.getUnitIcon("Great Merchant") }, 'g', UncivSound.Chimes),
|
||||||
FoundReligion("Found a Religion",
|
FoundReligion("Found a Religion",
|
||||||
|
@ -22,6 +22,7 @@ import com.unciv.ui.pickerscreens.PromotionPickerScreen
|
|||||||
import com.unciv.ui.utils.YesNoPopup
|
import com.unciv.ui.utils.YesNoPopup
|
||||||
import com.unciv.ui.utils.hasOpenPopups
|
import com.unciv.ui.utils.hasOpenPopups
|
||||||
import com.unciv.ui.worldscreen.WorldScreen
|
import com.unciv.ui.worldscreen.WorldScreen
|
||||||
|
import kotlin.math.min
|
||||||
|
|
||||||
object UnitActions {
|
object UnitActions {
|
||||||
|
|
||||||
@ -406,24 +407,55 @@ 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 construction of a wonder" -> {
|
"Can speed up the construction of a wonder" -> {
|
||||||
val canHurryWonder = if (!tile.isCityCenter()) false
|
val canHurryWonder =
|
||||||
else {
|
if (!tile.isCityCenter()) false
|
||||||
val currentConstruction = tile.getCity()!!.cityConstructions.getCurrentConstruction()
|
else tile.getCity()!!.cityConstructions.isBuildingWonder()
|
||||||
if (currentConstruction !is Building) false
|
|
||||||
else currentConstruction.isAnyWonder()
|
|
||||||
}
|
|
||||||
actionList += UnitAction(UnitActionType.HurryWonder,
|
actionList += UnitAction(UnitActionType.HurryWonder,
|
||||||
action = {
|
action = {
|
||||||
tile.getCity()!!.cityConstructions.apply {
|
tile.getCity()!!.cityConstructions.apply {
|
||||||
addProductionPoints(300 + 30 * tile.getCity()!!.population.population) //http://civilization.wikia.com/wiki/Great_engineer_(Civ5)
|
//http://civilization.wikia.com/wiki/Great_engineer_(Civ5)
|
||||||
|
addProductionPoints(((300 + 30 * tile.getCity()!!.population.population) * unit.civInfo.gameInfo.gameParameters.gameSpeed.modifier).toInt())
|
||||||
constructIfEnough()
|
constructIfEnough()
|
||||||
}
|
}
|
||||||
|
|
||||||
addGoldPerGreatPersonUsage(unit.civInfo)
|
addGoldPerGreatPersonUsage(unit.civInfo)
|
||||||
unit.destroy()
|
unit.destroy()
|
||||||
}.takeIf { canHurryWonder }
|
}.takeIf { canHurryWonder }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"Can speed up construction of a building" -> {
|
||||||
|
if (!tile.isCityCenter()) {
|
||||||
|
actionList += UnitAction(UnitActionType.HurryBuilding, action = null)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
val canHurryConstruction = tile.getCity()!!.cityConstructions.getCurrentConstruction() is Building
|
||||||
|
|
||||||
|
val cityConstructions = tile.getCity()!!.cityConstructions
|
||||||
|
|
||||||
|
//http://civilization.wikia.com/wiki/Great_engineer_(Civ5)
|
||||||
|
val productionPointsToAdd = min(
|
||||||
|
(300 + 30 * tile.getCity()!!.population.population) * unit.civInfo.gameInfo.gameParameters.gameSpeed.modifier,
|
||||||
|
cityConstructions.getRemainingWork(cityConstructions.currentConstructionFromQueue).toFloat() - 1
|
||||||
|
).toInt()
|
||||||
|
|
||||||
|
actionList += UnitAction(UnitActionType.HurryBuilding,
|
||||||
|
title = "Hurry Construction (+[$productionPointsToAdd]⚙)",
|
||||||
|
action = {
|
||||||
|
cityConstructions.apply {
|
||||||
|
addProductionPoints(productionPointsToAdd)
|
||||||
|
constructIfEnough()
|
||||||
|
}
|
||||||
|
|
||||||
|
addGoldPerGreatPersonUsage(unit.civInfo)
|
||||||
|
unit.destroy()
|
||||||
|
}.takeIf { canHurryConstruction }
|
||||||
|
)
|
||||||
|
}
|
||||||
"Can undertake a trade mission with City-State, giving a large sum of gold and [] Influence" -> {
|
"Can undertake a trade mission with City-State, giving a large sum of gold and [] Influence" -> {
|
||||||
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user