mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-16 19:23:28 +07:00
Update ReligionAutomation.kt (#7581)
This commit is contained in:
parent
c4747524d4
commit
5cc77dad3e
@ -162,14 +162,19 @@ object ReligionAutomation {
|
||||
var inquisitors = civInfo.gameInfo.ruleSet.units.values.filter {
|
||||
it.getMapUnit(civInfo).canDoReligiousAction(Constants.removeHeresy)
|
||||
|| it.hasUnique(UniqueType.PreventSpreadingReligion)
|
||||
}.map { it.name }
|
||||
inquisitors = inquisitors.map { civInfo.getEquivalentUnit(it).name }
|
||||
val inquisitorConstruction = inquisitors
|
||||
.map { civInfo.cities.first().cityConstructions.getConstruction(it) as INonPerpetualConstruction }
|
||||
.filter { unit -> civInfo.cities.any { unit.isPurchasable(it.cityConstructions) } }
|
||||
.minByOrNull { it.getStatBuyCost(civInfo.getCapital()!!, Stat.Faith)!! }
|
||||
?: return
|
||||
}
|
||||
|
||||
inquisitors = inquisitors.map { civInfo.getEquivalentUnit(it) }
|
||||
|
||||
val inquisitorConstruction = inquisitors
|
||||
// Get list of cities it can be built in
|
||||
.associateBy({unit -> unit}) { unit -> civInfo.cities.filter { unit.isPurchasable(it.cityConstructions) && unit.canBePurchasedWithStat(it, Stat.Faith) } }
|
||||
.filter { it.value.isNotEmpty() }
|
||||
// And from that list determine the cheapest price
|
||||
.minByOrNull { it.value.minOf { city -> it.key.getStatBuyCost(city, Stat.Faith)!! }}?.key
|
||||
?: return
|
||||
|
||||
|
||||
val hasUniqueToTakeCivReligion = civInfo.gameInfo.ruleSet.units[inquisitorConstruction.name]!!.hasUnique(UniqueType.TakeReligionOverBirthCity)
|
||||
|
||||
val validCitiesToBuy = civInfo.cities.filter {
|
||||
|
Loading…
x
Reference in New Issue
Block a user