mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-10 15:59:33 +07:00
Merge branch 'master' of https://github.com/yairm210/Unciv
This commit is contained in:
@ -283,8 +283,10 @@ object Battle {
|
||||
|
||||
if(thisCombatant.getCivInfo().isMajorCiv()) {
|
||||
var greatGeneralPointsModifier = 1f
|
||||
for (unique in thisCombatant.unit.getMatchingUniques("[] is earned []% faster"))
|
||||
if (unique.params[0] == Constants.greatGeneral)
|
||||
val unitUniques = thisCombatant.unit.getMatchingUniques("[] is earned []% faster")
|
||||
val civUniques = thisCombatant.unit.civInfo.getMatchingUniques("[] is earned []% faster")
|
||||
for (unique in unitUniques + civUniques)
|
||||
if (unique.params[0] == Constants.greatGeneral)
|
||||
greatGeneralPointsModifier += unique.params[1].toFloat() / 100
|
||||
|
||||
if (thisCombatant.unit.hasUnique("Combat very likely to create Great Generals")) // As of 3.10.10 This is to be deprecated and converted to "[Great General] is earned []% faster" - keeping it here to that mods with this can still work for now
|
||||
|
@ -181,15 +181,14 @@ class CityInfo {
|
||||
if (amount > 0) cityResources.add(resource, amount, "Tiles")
|
||||
}
|
||||
for (tileInfo in getTiles()) {
|
||||
if (tileInfo.improvement== null) continue
|
||||
if (tileInfo.improvement == null) continue
|
||||
val tileImprovement = tileInfo.getTileImprovement()
|
||||
for (unique in tileImprovement!!.uniqueObjects)
|
||||
if (unique.placeholderText == "Provides [] []") {
|
||||
val resource = getRuleset().tileResources[unique.params[1]] ?: continue
|
||||
cityResources.add(resource, unique.params[0].toInt() * civInfo.getResourceModifier(resource), "Tiles")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
for (building in cityConstructions.getBuiltBuildings().filter { it.requiredResource != null }) {
|
||||
val resource = getRuleset().tileResources[building.requiredResource]!!
|
||||
cityResources.add(resource, -1, "Buildings")
|
||||
@ -197,23 +196,12 @@ class CityInfo {
|
||||
for(unique in cityConstructions.builtBuildingUniqueMap.getUniques("Provides [] []")) { // E.G "Provides [1] [Iron]"
|
||||
val resource = getRuleset().tileResources[unique.params[1]]
|
||||
if(resource!=null){
|
||||
cityResources.add(resource, unique.params[0].toInt() * civInfo.getResourceModifier(resource), "Buildings") }
|
||||
cityResources.add(resource, unique.params[0].toInt() * civInfo.getResourceModifier(resource), "Tiles") }
|
||||
}
|
||||
|
||||
return cityResources
|
||||
}
|
||||
|
||||
fun getCityResourcesForAlly(): ResourceSupplyList {
|
||||
val cityResources = ResourceSupplyList()
|
||||
|
||||
for (tileInfo in getTiles().filter { it.resource != null }) {
|
||||
val resource = tileInfo.getTileResource()
|
||||
val amount = getTileResourceAmount(tileInfo)
|
||||
if (amount > 0) cityResources.add(resource, amount, "City-States")
|
||||
}
|
||||
return cityResources
|
||||
}
|
||||
|
||||
fun getTileResourceAmount(tileInfo: TileInfo): Int {
|
||||
if (tileInfo.resource == null) return 0
|
||||
val resource = tileInfo.getTileResource()
|
||||
|
@ -81,7 +81,9 @@ class CivInfoStats(val civInfo: CivilizationInfo){
|
||||
// Inca unique according to https://civilization.fandom.com/wiki/Incan_%28Civ5%29
|
||||
if (civInfo.hasUnique("50% Maintenance costs reduction"))
|
||||
transportationUpkeep /= 2
|
||||
if (civInfo.hasUnique("Maintenance on roads & railroads reduced by 33%, +2 gold from all trade routes"))
|
||||
if (civInfo.hasUnique("Maintenance on roads & railroads reduced by 33%")
|
||||
//presume we want to deprecate the old one at some point?
|
||||
||civInfo.hasUnique("Maintenance on roads & railroads reduced by 33%, +2 gold from all trade routes"))
|
||||
transportationUpkeep = (transportationUpkeep * 2 / 3f).toInt()
|
||||
return transportationUpkeep
|
||||
}
|
||||
|
@ -146,7 +146,8 @@ class CivInfoTransientUpdater(val civInfo: CivilizationInfo) {
|
||||
if (!civInfo.isCityState()) {
|
||||
for (otherCiv in civInfo.getKnownCivs().filter { it.getAllyCiv() == civInfo.civName }) {
|
||||
for (city in otherCiv.cities) {
|
||||
newDetailedCivResources.add(city.getCityResourcesForAlly())
|
||||
for(resourceSupply in city.getCityResources())
|
||||
newDetailedCivResources.add(resourceSupply.resource,resourceSupply.amount,"City-States")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user