mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-12 19:10:12 +07:00
Updated Commerce branch to G&K (#4129)
* Updated Commerce branch to G&K * Implemented requested changes
This commit is contained in:
parent
09f1deaee0
commit
434136e6cc
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB |
BIN
android/Images/PolicyIcons/Merchant Navy.png
Normal file
BIN
android/Images/PolicyIcons/Merchant Navy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.0 KiB |
BIN
android/Images/PolicyIcons/Naval Tradition.png
Normal file
BIN
android/Images/PolicyIcons/Naval Tradition.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
Before Width: | Height: | Size: 886 B |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 968 KiB After Width: | Height: | Size: 989 KiB |
@ -203,7 +203,8 @@
|
|||||||
"greatPersonPoints": {"gold": 1},
|
"greatPersonPoints": {"gold": 1},
|
||||||
"isWonder": true,
|
"isWonder": true,
|
||||||
"providesFreeBuilding": "Lighthouse",
|
"providesFreeBuilding": "Lighthouse",
|
||||||
"uniques": ["Must be next to [Coast]", "All military naval units receive +1 movement and +1 sight"],
|
"uniques": ["Must be next to [Coast]", "+[1] Movement for all [military water] units",
|
||||||
|
"+[1] Sight for all [military water] units"],
|
||||||
"requiredTech": "Optics",
|
"requiredTech": "Optics",
|
||||||
"quote": "'They that go down to the sea in ships, that do business in great waters; these see the works of the Lord, and his wonders in the deep.' - The Bible, Psalms 107:23-24"
|
"quote": "'They that go down to the sea in ships, that do business in great waters; these see the works of the Lord, and his wonders in the deep.' - The Bible, Psalms 107:23-24"
|
||||||
},
|
},
|
||||||
|
@ -224,39 +224,41 @@
|
|||||||
"uniques": ["+[25]% [Gold] [in capital]"],
|
"uniques": ["+[25]% [Gold] [in capital]"],
|
||||||
"era": "Medieval era",
|
"era": "Medieval era",
|
||||||
"policies": [
|
"policies": [
|
||||||
|
{
|
||||||
|
"name": "Naval Tradition",
|
||||||
|
"uniques": ["+[1] Movement for all [military water] units", "+[1] Sight for all [military water] units",
|
||||||
|
"Free [Great Admiral] appears", "+[2] Movement for all [Great Admiral] units"
|
||||||
|
],
|
||||||
|
"row": 1,
|
||||||
|
"column": 2
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "Trade Unions",
|
"name": "Trade Unions",
|
||||||
"uniques": ["Maintenance on roads & railroads reduced by [33]%", "[+2 Gold] from each Trade Route"],
|
"uniques": ["Maintenance on roads & railroads reduced by [33]%", "[+2 Gold] from each Trade Route"],
|
||||||
"row": 1,
|
"row": 1,
|
||||||
|
"column": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Merchant Navy",
|
||||||
|
"uniques": ["[+3 Production] [in all coastal cities]"],
|
||||||
|
"requires": ["Naval Tradition"],
|
||||||
|
"row": 2,
|
||||||
"column": 2
|
"column": 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Mercantilism",
|
"name": "Mercantilism",
|
||||||
"uniques": ["Cost of purchasing items in cities reduced by [25]%"],
|
"uniques": ["Cost of purchasing items in cities reduced by [25]%", "[+1 Science] from every [Mint]", "[+1 Science] from every [Market]",
|
||||||
"row": 1,
|
"[+1 Science] from every [Bank]", "[+1 Science] from every [Stock Exchange]"],
|
||||||
"column": 5
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Entrepreneurship",
|
|
||||||
"uniques": ["[Great Merchant] is earned [25]% faster", "[+1 Science] from every [Mint]", "[+1 Science] from every [Market]",
|
|
||||||
"[+1 Science] from every [Bank]", "[+1 Science] from every [Stock Exchange]" ],
|
|
||||||
"requires": ["Trade Unions"],
|
"requires": ["Trade Unions"],
|
||||||
"row": 2,
|
"row": 2,
|
||||||
"column": 2
|
"column": 4
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Patronage",
|
|
||||||
"uniques": ["Cost of purchasing [Culture] buildings reduced by [50]%"],
|
|
||||||
"requires": ["Mercantilism"],
|
|
||||||
"row": 2,
|
|
||||||
"column": 5
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Protectionism",
|
"name": "Protectionism",
|
||||||
"uniques": ["+1 happiness from each type of luxury resource"],
|
"uniques": ["+[2] happiness from each type of luxury resource"],
|
||||||
"requires": ["Entrepreneurship","Patronage"],
|
"requires": ["Mercantilism"],
|
||||||
"row": 3,
|
"row": 3,
|
||||||
"column": 3
|
"column": 4
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Commerce Complete",
|
"name": "Commerce Complete",
|
||||||
|
@ -369,7 +369,12 @@ class GameInfo {
|
|||||||
if (!ruleSet.technologies.containsKey(tech))
|
if (!ruleSet.technologies.containsKey(tech))
|
||||||
civinfo.tech.techsResearched.remove(tech)
|
civinfo.tech.techsResearched.remove(tech)
|
||||||
for (policy in civinfo.policies.adoptedPolicies.toList())
|
for (policy in civinfo.policies.adoptedPolicies.toList())
|
||||||
if (!ruleSet.policies.containsKey(policy))
|
// So these two policies are deprecated since 3.14.17
|
||||||
|
// However, we still need to convert save files that have those to valid save files
|
||||||
|
// The easiest way to do this, is just to allow them here, and filter them out in
|
||||||
|
// the policyManager class.
|
||||||
|
// Yes, this is ugly, but it should be temporary, and it works.
|
||||||
|
if (!ruleSet.policies.containsKey(policy) && !(policy == "Entrepreneurship" || policy == "Patronage"))
|
||||||
civinfo.policies.adoptedPolicies.remove(policy)
|
civinfo.policies.adoptedPolicies.remove(policy)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -164,6 +164,7 @@ class CityInfo {
|
|||||||
fun isWorked(tileInfo: TileInfo) = workedTiles.contains(tileInfo.position)
|
fun isWorked(tileInfo: TileInfo) = workedTiles.contains(tileInfo.position)
|
||||||
|
|
||||||
fun isCapital(): Boolean = cityConstructions.builtBuildings.contains(capitalCityIndicator())
|
fun isCapital(): Boolean = cityConstructions.builtBuildings.contains(capitalCityIndicator())
|
||||||
|
fun isCoastal(): Boolean = centerTileInfo.isCoastalTile()
|
||||||
fun capitalCityIndicator(): String {
|
fun capitalCityIndicator(): String {
|
||||||
val indicatorBuildings = getRuleset().buildings.values.asSequence().filter { it.uniques.contains("Indicates the capital city") }
|
val indicatorBuildings = getRuleset().buildings.values.asSequence().filter { it.uniques.contains("Indicates the capital city") }
|
||||||
val civSpecificBuilding = indicatorBuildings.firstOrNull { it.uniqueTo == civInfo.civName }
|
val civSpecificBuilding = indicatorBuildings.firstOrNull { it.uniqueTo == civInfo.civName }
|
||||||
@ -470,7 +471,7 @@ class CityInfo {
|
|||||||
return when (filter) {
|
return when (filter) {
|
||||||
"in this city" -> true
|
"in this city" -> true
|
||||||
"in all cities" -> true
|
"in all cities" -> true
|
||||||
"in all coastal cities" -> getCenterTile().isCoastalTile()
|
"in all coastal cities" -> isCoastal()
|
||||||
"in capital" -> isCapital()
|
"in capital" -> isCapital()
|
||||||
"in all non-occupied cities" -> !cityStats.hasExtraAnnexUnhappiness() || isPuppet
|
"in all non-occupied cities" -> !cityStats.hasExtraAnnexUnhappiness() || isPuppet
|
||||||
"in all cities with a world wonder" -> cityConstructions.getBuiltBuildings().any { it.isWonder }
|
"in all cities with a world wonder" -> cityConstructions.getBuiltBuildings().any { it.isWonder }
|
||||||
|
@ -129,8 +129,13 @@ class CivInfoStats(val civInfo: CivilizationInfo) {
|
|||||||
statMap["Base happiness"] = civInfo.getDifficulty().baseHappiness.toFloat()
|
statMap["Base happiness"] = civInfo.getDifficulty().baseHappiness.toFloat()
|
||||||
|
|
||||||
var happinessPerUniqueLuxury = 4f + civInfo.getDifficulty().extraHappinessPerLuxury
|
var happinessPerUniqueLuxury = 4f + civInfo.getDifficulty().extraHappinessPerLuxury
|
||||||
for (unique in civInfo.getMatchingUniques("+1 happiness from each type of luxury resource"))
|
for (unique in civInfo.getMatchingUniques("+[] happiness from each type of luxury resource"))
|
||||||
happinessPerUniqueLuxury += 1
|
happinessPerUniqueLuxury += unique.params[0].toInt()
|
||||||
|
// Deprecated since 3.14.17
|
||||||
|
for (unique in civInfo.getMatchingUniques("+1 happiness from each type of luxury resource"))
|
||||||
|
happinessPerUniqueLuxury += 1
|
||||||
|
//
|
||||||
|
|
||||||
statMap["Luxury resources"] = civInfo.getCivResources().map { it.resource }
|
statMap["Luxury resources"] = civInfo.getCivResources().map { it.resource }
|
||||||
.count { it.resourceType === ResourceType.Luxury } * happinessPerUniqueLuxury
|
.count { it.resourceType === ResourceType.Luxury } * happinessPerUniqueLuxury
|
||||||
|
|
||||||
|
@ -53,6 +53,16 @@ class PolicyManager {
|
|||||||
fun getPolicyByName(name: String): Policy = civInfo.gameInfo.ruleSet.policies[name]!!
|
fun getPolicyByName(name: String): Policy = civInfo.gameInfo.ruleSet.policies[name]!!
|
||||||
|
|
||||||
fun setTransients() {
|
fun setTransients() {
|
||||||
|
// Reassign policies deprecated in 3.14.17, left for backwards compatibility
|
||||||
|
if (adoptedPolicies.contains("Patronage")) {
|
||||||
|
adoptedPolicies.add("Merchant Navy")
|
||||||
|
adoptedPolicies.remove("Patronage")
|
||||||
|
}
|
||||||
|
if (adoptedPolicies.contains("Entrepreneurship")) {
|
||||||
|
adoptedPolicies.add("Naval Tradition")
|
||||||
|
adoptedPolicies.remove("Entrepreneurship")
|
||||||
|
}
|
||||||
|
//
|
||||||
for (policyName in adoptedPolicies)
|
for (policyName in adoptedPolicies)
|
||||||
addPolicyToTransients(getPolicyByName(policyName))
|
addPolicyToTransients(getPolicyByName(policyName))
|
||||||
// Deprecated since 3.14.17, left for backwards compatibility
|
// Deprecated since 3.14.17, left for backwards compatibility
|
||||||
|
@ -140,12 +140,13 @@ class MapUnit {
|
|||||||
|
|
||||||
var movement = baseUnit.movement
|
var movement = baseUnit.movement
|
||||||
movement += getUniques().count { it.text == "+1 Movement" }
|
movement += getUniques().count { it.text == "+1 Movement" }
|
||||||
|
|
||||||
if (type.isWaterUnit() && !type.isCivilian()
|
// Deprecated since 3.14.17
|
||||||
&& civInfo.hasUnique("All military naval units receive +1 movement and +1 sight")
|
if (type.isMilitary() && type.isWaterUnit() && civInfo.hasUnique("All military naval units receive +1 movement and +1 sight")) {
|
||||||
)
|
movement += 1
|
||||||
movement += 1
|
}
|
||||||
|
//
|
||||||
|
|
||||||
for (unique in civInfo.getMatchingUniques("+[] Movement for all [] units"))
|
for (unique in civInfo.getMatchingUniques("+[] Movement for all [] units"))
|
||||||
if (matchesFilter(unique.params[1]))
|
if (matchesFilter(unique.params[1]))
|
||||||
movement += unique.params[0].toInt()
|
movement += unique.params[0].toInt()
|
||||||
@ -215,10 +216,12 @@ class MapUnit {
|
|||||||
if (hasUnique("Limited Visibility")) visibilityRange -= 1
|
if (hasUnique("Limited Visibility")) visibilityRange -= 1
|
||||||
if (civInfo.hasUnique("+1 Sight for all land military units") && type.isMilitary() && type.isLandUnit())
|
if (civInfo.hasUnique("+1 Sight for all land military units") && type.isMilitary() && type.isLandUnit())
|
||||||
visibilityRange += 1
|
visibilityRange += 1
|
||||||
if (type.isWaterUnit() && !type.isCivilian()
|
|
||||||
&& civInfo.hasUnique("All military naval units receive +1 movement and +1 sight")
|
// Deprecated since 3.14.17
|
||||||
)
|
if (type.isMilitary() && type.isWaterUnit() && civInfo.hasUnique("All military naval units receive +1 movement and +1 sight"))
|
||||||
visibilityRange += 1
|
visibilityRange += 1
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
for (unique in civInfo.getMatchingUniques("[] Sight when []"))
|
for (unique in civInfo.getMatchingUniques("[] Sight when []"))
|
||||||
if (matchesFilter(unique.params[1]))
|
if (matchesFilter(unique.params[1]))
|
||||||
@ -889,13 +892,17 @@ class MapUnit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun matchesFilter(filter: String): Boolean {
|
fun matchesFilter(filter: String): Boolean {
|
||||||
if (baseUnit.matchesFilter(filter)) return true
|
return when (filter) {
|
||||||
if ((filter == "Wounded" || filter == "wounded units") && health < 100) return true
|
"Wounded", "wounded units" -> health < 100
|
||||||
if (hasUnique(filter)) return true
|
"Barbarians", "Barbarian" -> civInfo.isBarbarian()
|
||||||
if ((filter == "Barbarians" || filter == "Barbarian") && civInfo.isBarbarian()) return true
|
"Embarked" -> isEmbarked()
|
||||||
if (filter == "Embarked" && isEmbarked()) return true
|
else -> {
|
||||||
return false
|
if (baseUnit.matchesFilter(filter)) return true
|
||||||
|
if (hasUnique(filter)) return true
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ class BaseUnit : INamed, IConstruction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getRejectionReason(cityConstructions: CityConstructions): String {
|
fun getRejectionReason(cityConstructions: CityConstructions): String {
|
||||||
if (unitType.isWaterUnit() && !cityConstructions.cityInfo.getCenterTile().isCoastalTile())
|
if (unitType.isWaterUnit() && !cityConstructions.cityInfo.isCoastal())
|
||||||
return "Can only build water units in coastal cities"
|
return "Can only build water units in coastal cities"
|
||||||
val civInfo = cityConstructions.cityInfo.civInfo
|
val civInfo = cityConstructions.cityInfo.civInfo
|
||||||
for (unique in uniqueObjects.filter { it.placeholderText == "Not displayed as an available construction without []" }) {
|
for (unique in uniqueObjects.filter { it.placeholderText == "Not displayed as an available construction without []" }) {
|
||||||
@ -232,15 +232,18 @@ class BaseUnit : INamed, IConstruction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun matchesFilter(filter: String): Boolean {
|
fun matchesFilter(filter: String): Boolean {
|
||||||
if (filter == unitType.name) return true
|
return when (filter) {
|
||||||
if (filter == name) return true
|
unitType.name -> true
|
||||||
if (filter == "All") return true
|
name -> true
|
||||||
if ((filter == "Land" || filter == "land units") && unitType.isLandUnit()) return true
|
"All" -> true
|
||||||
if ((filter == "Water" || filter == "water units") && unitType.isWaterUnit()) return true
|
"Land", "land units" -> unitType.isLandUnit()
|
||||||
if ((filter == "Air" || filter == "air units") && unitType.isAirUnit()) return true
|
"Water", "water units", "Water units" -> unitType.isWaterUnit()
|
||||||
if (filter == "non-air" && !unitType.isAirUnit()) return true
|
"Air", "air units" -> unitType.isAirUnit()
|
||||||
if ((filter == "Military" || filter == "military units") && unitType.isMilitary()) return true
|
"non-air" -> !unitType.isAirUnit()
|
||||||
return false
|
"Military", "military units" -> unitType.isMilitary()
|
||||||
|
"military water" -> unitType.isMilitary() && unitType.isWaterUnit()
|
||||||
|
else -> false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isGreatPerson() = uniqueObjects.any { it.placeholderText == "Great Person - []" }
|
fun isGreatPerson() = uniqueObjects.any { it.placeholderText == "Great Person - []" }
|
||||||
@ -253,4 +256,4 @@ class BaseUnit : INamed, IConstruction {
|
|||||||
resourceRequirements[unique.params[1]] = unique.params[0].toInt()
|
resourceRequirements[unique.params[1]] = unique.params[0].toInt()
|
||||||
return resourceRequirements
|
return resourceRequirements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -323,10 +323,10 @@ Unless otherwise specified, all the following are from [the Noun Project](https:
|
|||||||
### Commerce
|
### Commerce
|
||||||
|
|
||||||
* [Trade](https://thenounproject.com/term/trade/686718/) By Gregor Cresnar for Trade Unions
|
* [Trade](https://thenounproject.com/term/trade/686718/) By Gregor Cresnar for Trade Unions
|
||||||
* [Pie Chart](https://thenounproject.com/term/pie-chart/1284359/) By Adrien Coquet for Protectionism
|
* [Pie Chart](https://thenounproject.com/term/pie-chart/1284359/) By Adrien Coquet for Protectionism
|
||||||
* [Coins](https://thenounproject.com/term/coins/1915881/) By icon 54 for Mercantilism
|
* [Coins](https://thenounproject.com/term/coins/1915881/) By icon 54 for Mercantilism
|
||||||
* [Painting](https://thenounproject.com/term/painting/387146/) By Mike Rowe for Patronage
|
* [Sextant](https://thenounproject.com/term/sextant/313438 ) By lastspark for Sextant
|
||||||
* [Gem](https://thenounproject.com/term/gem/754533/) By Oksana Latysheva for Entrepreneurship
|
* [Merchant Navy Icon](https://www.pngkit.com/view/u2w7i1i1o0t4a9y3_png-file-merchant-navy-icon/) for Merchant Navy
|
||||||
|
|
||||||
### Rationalism
|
### Rationalism
|
||||||
|
|
||||||
@ -338,7 +338,7 @@ Unless otherwise specified, all the following are from [the Noun Project](https:
|
|||||||
|
|
||||||
### Freedom
|
### Freedom
|
||||||
|
|
||||||
* [social network](https://thenounproject.com/term/social-network/746002/) By Kirby Wu for Civil Society
|
* [Social Network](https://thenounproject.com/term/social-network/746002/) By Kirby Wu for Civil Society
|
||||||
* [Gender Equality](https://thenounproject.com/term/gender-equality/577561/) By corpus delicti for Universal Suffrage
|
* [Gender Equality](https://thenounproject.com/term/gender-equality/577561/) By corpus delicti for Universal Suffrage
|
||||||
* [Feather](https://thenounproject.com/term/feather/1628/) By Eduardo Souza for Constitution
|
* [Feather](https://thenounproject.com/term/feather/1628/) By Eduardo Souza for Constitution
|
||||||
* [Voting](https://thenounproject.com/term/voting/981735/) By Nikita Kozin for Democracy
|
* [Voting](https://thenounproject.com/term/voting/981735/) By Nikita Kozin for Democracy
|
||||||
|
Loading…
Reference in New Issue
Block a user