mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-11 03:18:18 +07:00
Typefied spaceship part unique (#5878)
* Typefied spaceship part unique * Removed unused imports * Ah right, spaceship parts are still buildings
This commit is contained in:
parent
1d40b8a7de
commit
dcbb0df4f9
@ -448,7 +448,7 @@ class GameInfo {
|
||||
}
|
||||
}
|
||||
|
||||
spaceResources.addAll(ruleSet.buildings.values.filter { it.hasUnique("Spaceship part") }
|
||||
spaceResources.addAll(ruleSet.buildings.values.filter { it.hasUnique(UniqueType.SpaceshipPart) }
|
||||
.flatMap { it.getResourceRequirements().keys } )
|
||||
|
||||
barbarians.setTransients(this)
|
||||
|
@ -173,7 +173,7 @@ object Automation {
|
||||
return true
|
||||
|
||||
// Spaceships are always allowed
|
||||
if (construction.hasUnique("Spaceship part"))
|
||||
if (construction.hasUnique(UniqueType.SpaceshipPart))
|
||||
return true
|
||||
|
||||
val requiredResources = construction.getResourceRequirements()
|
||||
|
@ -2,7 +2,6 @@ package com.unciv.logic.automation
|
||||
|
||||
import com.unciv.UncivGame
|
||||
import com.unciv.logic.city.CityConstructions
|
||||
import com.unciv.logic.city.INonPerpetualConstruction
|
||||
import com.unciv.logic.city.PerpetualConstruction
|
||||
import com.unciv.logic.civilization.CityAction
|
||||
import com.unciv.logic.civilization.NotificationIcon
|
||||
@ -194,7 +193,7 @@ class ConstructionAutomation(val cityConstructions: CityConstructions){
|
||||
}
|
||||
|
||||
private fun addSpaceshipPartChoice() {
|
||||
val spaceshipPart = buildableNotWonders.firstOrNull { it.uniques.contains("Spaceship part") }
|
||||
val spaceshipPart = buildableNotWonders.firstOrNull { it.hasUnique(UniqueType.SpaceshipPart) }
|
||||
if (spaceshipPart != null) {
|
||||
var modifier = 1.5f
|
||||
if (preferredVictoryType == VictoryType.Scientific) modifier = 2f
|
||||
|
@ -629,7 +629,7 @@ class Building : RulesetStatsObject(), INonPerpetualConstruction {
|
||||
}
|
||||
}
|
||||
|
||||
if ("Spaceship part" in uniques) {
|
||||
if (hasUnique(UniqueType.SpaceshipPart)) {
|
||||
if (!civInfo.hasUnique("Enables construction of Spaceship parts"))
|
||||
rejectionReasons.add(
|
||||
RejectionReason.RequiresBuildingInSomeCity.apply { errorMessage = "Apollo project not built!" }
|
||||
@ -722,7 +722,7 @@ class Building : RulesetStatsObject(), INonPerpetualConstruction {
|
||||
override fun postBuildEvent(cityConstructions: CityConstructions, boughtWith: Stat?): Boolean {
|
||||
val civInfo = cityConstructions.cityInfo.civInfo
|
||||
|
||||
if ("Spaceship part" in uniques) {
|
||||
if (hasUnique(UniqueType.SpaceshipPart)) {
|
||||
civInfo.victoryManager.currentsSpaceshipParts.add(name, 1)
|
||||
return true
|
||||
}
|
||||
|
@ -269,6 +269,7 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget, val flags:
|
||||
CanEnterForeignTilesButLosesReligiousStrength("May enter foreign tiles without open borders, but loses [amount] religious strength each turn it ends there", UniqueTarget.Unit),
|
||||
|
||||
ReligiousUnit("Religious Unit", UniqueTarget.Unit),
|
||||
SpaceshipPart("Spaceship part", UniqueTarget.Building, UniqueTarget.Unit),
|
||||
|
||||
//endregion
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user