mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-20 01:07:40 +07:00
Modding: Can provide resources as a global unique
This commit is contained in:
parent
1fb43a805f
commit
557735cb0e
@ -438,7 +438,7 @@ class CityInfo : IsPartOfGameInfoSerialization {
|
||||
val resource = getRuleset().tileResources[unique.params[1]]
|
||||
?: continue
|
||||
cityResources.add(
|
||||
resource, "Buildings+",
|
||||
resource, "Buildings",
|
||||
unique.params[0].toInt() * civInfo.getResourceModifier(resource)
|
||||
)
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import com.unciv.UncivGame
|
||||
import com.unciv.logic.map.MapShape
|
||||
import com.unciv.logic.map.TileInfo
|
||||
import com.unciv.models.ruleset.tile.ResourceSupplyList
|
||||
import com.unciv.models.ruleset.unique.UniqueTarget
|
||||
import com.unciv.models.ruleset.unique.UniqueType
|
||||
|
||||
/** CivInfo class was getting too crowded */
|
||||
@ -190,6 +191,15 @@ class CivInfoTransientUpdater(val civInfo: CivilizationInfo) {
|
||||
newDetailedCivResources.addByResource(cityStateProvidedResources, Constants.cityStates)
|
||||
}
|
||||
|
||||
for (unique in civInfo.getMatchingUniques(UniqueType.ProvidesResources)) {
|
||||
if (unique.sourceObjectType == UniqueTarget.Building || unique.sourceObjectType == UniqueTarget.Wonder) continue // already calculated in city
|
||||
newDetailedCivResources.add(
|
||||
civInfo.gameInfo.ruleSet.tileResources[unique.params[1]]!!,
|
||||
unique.sourceObjectType?.name ?: "",
|
||||
unique.params[1].toInt()
|
||||
)
|
||||
}
|
||||
|
||||
for (diplomacyManager in civInfo.diplomacy.values)
|
||||
newDetailedCivResources.add(diplomacyManager.resourcesFromTrade())
|
||||
|
||||
|
@ -143,7 +143,7 @@ enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags:
|
||||
CannotBuildUnits("Cannot build [baseUnitFilter] units", UniqueTarget.Global),
|
||||
|
||||
ConsumesResources("Consumes [amount] [resource]", UniqueTarget.Improvement, UniqueTarget.Building, UniqueTarget.Unit),
|
||||
ProvidesResources("Provides [amount] [resource]", UniqueTarget.Improvement, UniqueTarget.Building),
|
||||
ProvidesResources("Provides [amount] [resource]", UniqueTarget.Improvement, UniqueTarget.Global),
|
||||
|
||||
GrowthPercentBonus("[relativeAmount]% growth [cityFilter]", UniqueTarget.Global, UniqueTarget.FollowerBelief),
|
||||
CarryOverFood("[relativeAmount]% Food is carried over after population increases [cityFilter]", UniqueTarget.Global, UniqueTarget.FollowerBelief),
|
||||
|
Loading…
Reference in New Issue
Block a user