mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-18 16:29:05 +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
|
||||
|
||||
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
|
||||
|
||||
|
@ -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
|
||||
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())
|
||||
}
|
||||
|
||||
|
@ -170,6 +170,11 @@ class CityInfo {
|
||||
val resource = getRuleset().tileResources[building.requiredResource]!!
|
||||
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
|
||||
}
|
||||
@ -180,9 +185,7 @@ class CityInfo {
|
||||
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")
|
||||
}
|
||||
if (amount > 0) cityResources.add(resource, amount, "City-States")
|
||||
}
|
||||
return cityResources
|
||||
}
|
||||
|
@ -372,19 +372,19 @@ class CityStats {
|
||||
|
||||
fun constructionFitsFilter(construction:IConstruction, filter:String): Boolean {
|
||||
return construction.name == filter
|
||||
|| (filter == "land units" && construction is BaseUnit && construction.unitType.isLandUnit())
|
||||
|| (filter == "naval units" && construction is BaseUnit && construction.unitType.isWaterUnit())
|
||||
|| (filter == "ranged units" && construction is BaseUnit && construction.unitType == UnitType.Ranged)
|
||||
|| (filter == "mounted units" && construction is BaseUnit && construction.unitType == UnitType.Mounted)
|
||||
|| (filter == "military units" && construction is BaseUnit && !construction.unitType.isCivilian())
|
||||
|| (filter == "melee units" && construction is BaseUnit && construction.unitType.isMelee())
|
||||
|| (filter == "Buildings" && construction is Building && !(construction.isWonder || construction.isNationalWonder))
|
||||
|| (filter == "Wonders" && construction is Building && (construction.isWonder || construction.isNationalWonder))
|
||||
|| (construction is Building && construction.uniques.contains(filter))
|
||||
|| filter == "land units" && construction is BaseUnit && construction.unitType.isLandUnit()
|
||||
|| filter == "naval units" && construction is BaseUnit && construction.unitType.isWaterUnit()
|
||||
|| filter == "ranged units" && construction is BaseUnit && construction.unitType == UnitType.Ranged
|
||||
|| filter == "mounted units" && construction is BaseUnit && construction.unitType == UnitType.Mounted
|
||||
|| filter == "military units" && construction is BaseUnit && !construction.unitType.isCivilian()
|
||||
|| filter == "melee units" && construction is BaseUnit && construction.unitType.isMelee()
|
||||
|| filter == "Buildings" && construction is Building && !(construction.isWonder || construction.isNationalWonder)
|
||||
|| filter == "Wonders" && construction is Building && (construction.isWonder || construction.isNationalWonder)
|
||||
|| construction is Building && construction.uniques.contains(filter)
|
||||
}
|
||||
|
||||
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
|
||||
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 {
|
||||
val stats = this.clone()
|
||||
if(civInfo != null) {
|
||||
val adoptedPolicies = civInfo.policies.adoptedPolicies
|
||||
if (civInfo != null) {
|
||||
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
|
||||
stats.add(Stats.parse(unique.params[0]))
|
||||
}
|
||||
|
||||
// todo policy
|
||||
if (adoptedPolicies.contains("Humanism") && hashSetOf("University", "Observatory", "Public School").contains(baseBuildingName ))
|
||||
stats.happiness += 1f
|
||||
for (unique in uniqueObjects)
|
||||
if (unique.placeholderText == "[] with []" && civInfo.hasResource(unique.params[1]) && Stats.isStats(unique.params[0]))
|
||||
stats.add(Stats.parse(unique.params[0]))
|
||||
|
||||
if(!isWonder)
|
||||
for(unique in civInfo.getMatchingUniques("[] from all [] buildings")){
|
||||
if(isStatRelated(Stat.valueOf(unique.params[1])))
|
||||
if (!isWonder)
|
||||
for (unique in civInfo.getMatchingUniques("[] from all [] buildings")) {
|
||||
if (isStatRelated(Stat.valueOf(unique.params[1])))
|
||||
stats.add(Stats.parse(unique.params[0]))
|
||||
}
|
||||
else
|
||||
for(unique in civInfo.getMatchingUniques("[] from every Wonder"))
|
||||
for (unique in civInfo.getMatchingUniques("[] from every Wonder"))
|
||||
stats.add(Stats.parse(unique.params[0]))
|
||||
|
||||
if (adoptedPolicies.contains("Police State") && baseBuildingName == "Courthouse")
|
||||
stats.happiness += 3
|
||||
|
||||
}
|
||||
return stats
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user