mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-14 17:59:11 +07:00
Modding: "Cannot be traded" unique accepts Civ conditionals
This commit is contained in:
@ -403,7 +403,7 @@ class Civilization : IsPartOfGameInfoSerialization {
|
|||||||
|
|
||||||
for (resourceSupply in detailedCivResources) {
|
for (resourceSupply in detailedCivResources) {
|
||||||
if (resourceSupply.resource.isStockpiled()) continue
|
if (resourceSupply.resource.isStockpiled()) continue
|
||||||
if (resourceSupply.resource.hasUnique(UniqueType.CannotBeTraded)) continue
|
if (resourceSupply.resource.hasUnique(UniqueType.CannotBeTraded, StateForConditionals(this))) continue
|
||||||
// If we got it from another trade or from a CS, preserve the origin
|
// If we got it from another trade or from a CS, preserve the origin
|
||||||
if (resourceSupply.isCityStateOrTradeOrigin()) {
|
if (resourceSupply.isCityStateOrTradeOrigin()) {
|
||||||
newResourceSupplyList.add(resourceSupply.copy())
|
newResourceSupplyList.add(resourceSupply.copy())
|
||||||
|
@ -292,7 +292,7 @@ class CivInfoTransientCache(val civInfo: Civilization) {
|
|||||||
resourceBonusPercentage += unique.params[0].toFloat() / 100
|
resourceBonusPercentage += unique.params[0].toFloat() / 100
|
||||||
for (cityStateAlly in civInfo.getKnownCivs().filter { it.getAllyCiv() == civInfo.civName }) {
|
for (cityStateAlly in civInfo.getKnownCivs().filter { it.getAllyCiv() == civInfo.civName }) {
|
||||||
for (resourceSupply in cityStateAlly.cityStateFunctions.getCityStateResourcesForAlly()) {
|
for (resourceSupply in cityStateAlly.cityStateFunctions.getCityStateResourcesForAlly()) {
|
||||||
if (resourceSupply.resource.hasUnique(UniqueType.CannotBeTraded)) continue
|
if (resourceSupply.resource.hasUnique(UniqueType.CannotBeTraded, StateForConditionals(civInfo))) continue
|
||||||
val newAmount = (resourceSupply.amount * resourceBonusPercentage).toInt()
|
val newAmount = (resourceSupply.amount * resourceBonusPercentage).toInt()
|
||||||
cityStateProvidedResources.add(resourceSupply.copy(amount = newAmount))
|
cityStateProvidedResources.add(resourceSupply.copy(amount = newAmount))
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user