mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-19 00:37:52 +07:00
Added resource-providing building unique
This commit is contained in:
parent
55d904e1cd
commit
0b9bcabea4
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Find Player, Find Natural Wonder and Acquire Great Person quests implemented - By r3versi
|
Find Player, Find Natural Wonder and Acquire Great Person quests implemented - By r3versi
|
||||||
|
|
||||||
Android now handles internally-downloaded and externally-given mods together wel
|
Android now handles internally-downloaded and externally-given mods together well
|
||||||
|
|
||||||
Multiple small changes to make life easier for modders
|
Multiple small changes to make life easier for modders
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ object BattleDamage {
|
|||||||
|
|
||||||
// As of 3.11.1 This is to be deprecated and converted to "Bonus vs x y%" - keeping it here so that mods with this can still work for now
|
// As of 3.11.1 This is to be deprecated and converted to "Bonus vs x y%" - keeping it here so that mods with this can still work for now
|
||||||
for (unique in combatant.unit.getMatchingUniques("+[]% Strength vs []")) {
|
for (unique in combatant.unit.getMatchingUniques("+[]% Strength vs []")) {
|
||||||
if (unique.params[1] == enemy.getName())
|
if (enemy.matchesCategory(unique.params[1]))
|
||||||
modifiers.add("vs [${unique.params[1]}]", unique.params[0].toInt())
|
modifiers.add("vs [${unique.params[1]}]", unique.params[0].toInt())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,6 +170,11 @@ class CityInfo {
|
|||||||
val resource = getRuleset().tileResources[building.requiredResource]!!
|
val resource = getRuleset().tileResources[building.requiredResource]!!
|
||||||
cityResources.add(resource, -1, "Buildings")
|
cityResources.add(resource, -1, "Buildings")
|
||||||
}
|
}
|
||||||
|
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(), "Buildings")
|
||||||
|
}
|
||||||
|
|
||||||
return cityResources
|
return cityResources
|
||||||
}
|
}
|
||||||
@ -180,9 +185,7 @@ class CityInfo {
|
|||||||
for (tileInfo in getTiles().filter { it.resource != null }) {
|
for (tileInfo in getTiles().filter { it.resource != null }) {
|
||||||
val resource = tileInfo.getTileResource()
|
val resource = tileInfo.getTileResource()
|
||||||
val amount = getTileResourceAmount(tileInfo)
|
val amount = getTileResourceAmount(tileInfo)
|
||||||
if (amount > 0) {
|
if (amount > 0) cityResources.add(resource, amount, "City-States")
|
||||||
cityResources.add(resource, amount, "City-States")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return cityResources
|
return cityResources
|
||||||
}
|
}
|
||||||
|
@ -372,19 +372,19 @@ class CityStats {
|
|||||||
|
|
||||||
fun constructionFitsFilter(construction:IConstruction, filter:String): Boolean {
|
fun constructionFitsFilter(construction:IConstruction, filter:String): Boolean {
|
||||||
return construction.name == filter
|
return construction.name == filter
|
||||||
|| (filter == "land units" && construction is BaseUnit && construction.unitType.isLandUnit())
|
|| filter == "land units" && construction is BaseUnit && construction.unitType.isLandUnit()
|
||||||
|| (filter == "naval units" && construction is BaseUnit && construction.unitType.isWaterUnit())
|
|| filter == "naval units" && construction is BaseUnit && construction.unitType.isWaterUnit()
|
||||||
|| (filter == "ranged units" && construction is BaseUnit && construction.unitType == UnitType.Ranged)
|
|| filter == "ranged units" && construction is BaseUnit && construction.unitType == UnitType.Ranged
|
||||||
|| (filter == "mounted units" && construction is BaseUnit && construction.unitType == UnitType.Mounted)
|
|| filter == "mounted units" && construction is BaseUnit && construction.unitType == UnitType.Mounted
|
||||||
|| (filter == "military units" && construction is BaseUnit && !construction.unitType.isCivilian())
|
|| filter == "military units" && construction is BaseUnit && !construction.unitType.isCivilian()
|
||||||
|| (filter == "melee units" && construction is BaseUnit && construction.unitType.isMelee())
|
|| filter == "melee units" && construction is BaseUnit && construction.unitType.isMelee()
|
||||||
|| (filter == "Buildings" && construction is Building && !(construction.isWonder || construction.isNationalWonder))
|
|| filter == "Buildings" && construction is Building && !(construction.isWonder || construction.isNationalWonder)
|
||||||
|| (filter == "Wonders" && construction is Building && (construction.isWonder || construction.isNationalWonder))
|
|| filter == "Wonders" && construction is Building && (construction.isWonder || construction.isNationalWonder)
|
||||||
|| (construction is Building && construction.uniques.contains(filter))
|
|| construction is Building && construction.uniques.contains(filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isConnectedToCapital(roadType: RoadStatus): Boolean {
|
fun isConnectedToCapital(roadType: RoadStatus): Boolean {
|
||||||
if (cityInfo.civInfo.cities .count() < 2) return false// first city!
|
if (cityInfo.civInfo.cities.count() < 2) return false// first city!
|
||||||
|
|
||||||
// Railroad, or harbor from railroad
|
// Railroad, or harbor from railroad
|
||||||
if (roadType == RoadStatus.Railroad) return cityInfo.isConnectedToCapital { it.any { it.contains("Railroad") } }
|
if (roadType == RoadStatus.Railroad) return cityInfo.isConnectedToCapital { it.any { it.contains("Railroad") } }
|
||||||
|
@ -138,31 +138,27 @@ class Building : NamedStats(), IConstruction {
|
|||||||
|
|
||||||
fun getStats(civInfo: CivilizationInfo?): Stats {
|
fun getStats(civInfo: CivilizationInfo?): Stats {
|
||||||
val stats = this.clone()
|
val stats = this.clone()
|
||||||
if(civInfo != null) {
|
if (civInfo != null) {
|
||||||
val adoptedPolicies = civInfo.policies.adoptedPolicies
|
|
||||||
val baseBuildingName = getBaseBuilding(civInfo.gameInfo.ruleSet).name
|
val baseBuildingName = getBaseBuilding(civInfo.gameInfo.ruleSet).name
|
||||||
|
|
||||||
for(unique in civInfo.getMatchingUniques("[] from every []")) {
|
for (unique in civInfo.getMatchingUniques("[] from every []")) {
|
||||||
if (unique.params[1] != baseBuildingName) continue
|
if (unique.params[1] != baseBuildingName) continue
|
||||||
stats.add(Stats.parse(unique.params[0]))
|
stats.add(Stats.parse(unique.params[0]))
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo policy
|
for (unique in uniqueObjects)
|
||||||
if (adoptedPolicies.contains("Humanism") && hashSetOf("University", "Observatory", "Public School").contains(baseBuildingName ))
|
if (unique.placeholderText == "[] with []" && civInfo.hasResource(unique.params[1]) && Stats.isStats(unique.params[0]))
|
||||||
stats.happiness += 1f
|
stats.add(Stats.parse(unique.params[0]))
|
||||||
|
|
||||||
if(!isWonder)
|
if (!isWonder)
|
||||||
for(unique in civInfo.getMatchingUniques("[] from all [] buildings")){
|
for (unique in civInfo.getMatchingUniques("[] from all [] buildings")) {
|
||||||
if(isStatRelated(Stat.valueOf(unique.params[1])))
|
if (isStatRelated(Stat.valueOf(unique.params[1])))
|
||||||
stats.add(Stats.parse(unique.params[0]))
|
stats.add(Stats.parse(unique.params[0]))
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
for(unique in civInfo.getMatchingUniques("[] from every Wonder"))
|
for (unique in civInfo.getMatchingUniques("[] from every Wonder"))
|
||||||
stats.add(Stats.parse(unique.params[0]))
|
stats.add(Stats.parse(unique.params[0]))
|
||||||
|
|
||||||
if (adoptedPolicies.contains("Police State") && baseBuildingName == "Courthouse")
|
|
||||||
stats.happiness += 3
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return stats
|
return stats
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user