Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve AI city settling, science game, and belief picking #12256

Merged
merged 150 commits into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
150 commits
Select commit Hold shift + click to select a range
7ed4c0d
AI behaviour changes
EmperorPinguin Jun 23, 2024
47184b0
Merge branch 'master' of https://github.com/EmperorPinguin/Unciv
EmperorPinguin Jun 23, 2024
e856a76
Merge branch 'master' of https://github.com/EmperorPinguin/Unciv
EmperorPinguin Jun 23, 2024
b571e76
Update Automation.kt
EmperorPinguin Jun 23, 2024
cee0287
Update Automation.kt
EmperorPinguin Jun 23, 2024
16ae6d9
Update Automation.kt
EmperorPinguin Jun 23, 2024
a769a52
Update Automation.kt
EmperorPinguin Jun 23, 2024
9c8f2e2
Update Automation.kt
EmperorPinguin Jun 23, 2024
777b828
Update ConstructionAutomation.kt
EmperorPinguin Jun 23, 2024
2a4f9b0
Update Automation.kt
EmperorPinguin Jun 23, 2024
33b9fc7
Reverting some changes
EmperorPinguin Jun 23, 2024
e311e17
Changes
EmperorPinguin Jun 24, 2024
cade007
revert changes
EmperorPinguin Jun 24, 2024
318c396
revert changes
EmperorPinguin Jun 24, 2024
012afb5
revert changes
EmperorPinguin Jun 24, 2024
f4d02c8
revert changes
EmperorPinguin Jun 24, 2024
cae12b6
Update CityLocationTileRanker.kt
EmperorPinguin Jun 24, 2024
9040bab
Citizen assignment for stat conversion
EmperorPinguin Jun 24, 2024
a33d7f4
Merge branch 'yairm210:master' into master
EmperorPinguin Jun 25, 2024
e53f887
Merge branch 'yairm210:master' into master
EmperorPinguin Jun 25, 2024
3f540a8
Update CityLocationTileRanker.kt
EmperorPinguin Jun 25, 2024
0e5db36
Merge branch 'yairm210:master' into master
EmperorPinguin Jun 26, 2024
43cf8a3
Merge branch 'yairm210:master' into master
EmperorPinguin Jun 26, 2024
85743fb
Merge branch 'yairm210:master' into master
EmperorPinguin Jun 27, 2024
a1f5905
Reduce AI settling
EmperorPinguin Jun 27, 2024
d061b67
Merge branch 'yairm210:master' into master
EmperorPinguin Jun 27, 2024
4257a0f
Avoid AI building units when in negative Supply
EmperorPinguin Jun 27, 2024
44c8a90
Merge branch 'yairm210:master' into master
EmperorPinguin Jun 27, 2024
5f42454
Update CityLocationTileRanker.kt
EmperorPinguin Jun 27, 2024
6b49cdc
Merge branch 'master' of https://github.com/EmperorPinguin/Unciv
EmperorPinguin Jun 27, 2024
383a083
Update CityLocationTileRanker.kt
EmperorPinguin Jun 27, 2024
31e3c44
Update CityLocationTileRanker.kt
EmperorPinguin Jun 27, 2024
cd7c911
Merge branch 'yairm210:master' into master
EmperorPinguin Jun 28, 2024
958b646
Update ConstructionAutomation.kt
EmperorPinguin Jun 28, 2024
5f91c79
Merge branch 'yairm210:master' into master
EmperorPinguin Jun 28, 2024
809b0fc
Update build.gradle.kts
EmperorPinguin Jun 28, 2024
f2573d8
Update gradle-wrapper.properties
EmperorPinguin Jun 28, 2024
9bef165
Update CityLocationTileRanker.kt
EmperorPinguin Jun 28, 2024
3239649
Update CityLocationTileRanker.kt
EmperorPinguin Jun 28, 2024
6f7c7c8
Merge branch 'yairm210:master' into master
EmperorPinguin Jun 28, 2024
301ab4e
Update ConstructionAutomation.kt
EmperorPinguin Jun 28, 2024
f8f364e
Merge branch 'master' of https://github.com/EmperorPinguin/Unciv
EmperorPinguin Jun 28, 2024
df80b10
Update CityLocationTileRanker.kt
EmperorPinguin Jun 28, 2024
ef4f189
Merge branch 'master' of https://github.com/EmperorPinguin/Unciv
EmperorPinguin Jun 30, 2024
0fda42b
Merge branch 'yairm210:master' into master
EmperorPinguin Jun 30, 2024
55e1f7c
Merge branch 'yairm210:master' into master
EmperorPinguin Jul 2, 2024
bc6172b
Merge branch 'yairm210:master' into master
EmperorPinguin Jul 2, 2024
213c896
AI changes for humans
EmperorPinguin Jul 2, 2024
5f4e093
Fix puppet focus
EmperorPinguin Jul 3, 2024
61d8299
Merge branch 'yairm210:master' into master
EmperorPinguin Jul 4, 2024
7ff9018
Merge branch 'yairm210:master' into master
EmperorPinguin Jul 6, 2024
428193b
Merge branch 'yairm210:master' into master
EmperorPinguin Jul 15, 2024
001269a
Update Automation.kt
EmperorPinguin Jul 17, 2024
344dd81
Puppet focus
EmperorPinguin Jul 17, 2024
bf0a8e7
Update Automation.kt
EmperorPinguin Jul 17, 2024
545f8c2
Update Automation.kt
EmperorPinguin Jul 17, 2024
395ac8f
Update Automation.kt
EmperorPinguin Jul 18, 2024
96acd16
Update Automation.kt
EmperorPinguin Jul 18, 2024
9e73243
Update Automation.kt
EmperorPinguin Jul 18, 2024
5de758d
Merge branch 'yairm210:master' into master
EmperorPinguin Jul 18, 2024
6fc1b0c
Update Automation.kt
EmperorPinguin Jul 18, 2024
53057d9
Merge branch 'master' of https://github.com/EmperorPinguin/Unciv
EmperorPinguin Jul 18, 2024
d5e270b
Update Automation.kt
EmperorPinguin Jul 19, 2024
c34b62b
Update Automation.kt
EmperorPinguin Jul 19, 2024
611378b
Update Automation.kt
EmperorPinguin Jul 19, 2024
1e4d88b
Update Stats.kt
EmperorPinguin Jul 23, 2024
5863788
Merge branch 'yairm210:master' into master
EmperorPinguin Jul 24, 2024
c896436
Update CityTurnManager.kt
EmperorPinguin Jul 24, 2024
8bb6b37
Remove specialist science modifier
EmperorPinguin Jul 25, 2024
0d3d37b
Merge branch 'yairm210:master' into master
EmperorPinguin Jul 25, 2024
a73bf52
Merge branch 'master' of https://github.com/EmperorPinguin/Unciv
EmperorPinguin Jul 25, 2024
0a75ccb
Merge branch 'master' of https://github.com/EmperorPinguin/Unciv
EmperorPinguin Jul 28, 2024
a730dce
Update ReligionAutomation.kt
EmperorPinguin Jul 30, 2024
b0fb0f2
Merge branch 'yairm210:master' into master
EmperorPinguin Jul 30, 2024
2797b0d
Update ReligionAutomation.kt
EmperorPinguin Jul 30, 2024
c7e4323
Update ReligionAutomation.kt
EmperorPinguin Jul 30, 2024
1660de3
Update CivilianUnitAutomation.kt
EmperorPinguin Jul 30, 2024
c2e6324
Merge branch 'yairm210:master' into master
EmperorPinguin Jul 31, 2024
21c5a30
Update ReligionAutomation.kt
EmperorPinguin Jul 31, 2024
4251043
Merge branch 'master' of https://github.com/EmperorPinguin/Unciv
EmperorPinguin Jul 31, 2024
82a6221
Merge branch 'yairm210:master' into master
EmperorPinguin Aug 4, 2024
c431226
Worker prioritization
EmperorPinguin Aug 4, 2024
1871dbd
Update ConstructionAutomation.kt
EmperorPinguin Aug 4, 2024
0c8768e
Update ConstructionAutomation.kt
EmperorPinguin Aug 4, 2024
ee23862
Merge branch 'yairm210:master' into master
EmperorPinguin Aug 13, 2024
143a247
Update Automation.kt
EmperorPinguin Aug 13, 2024
31055c5
Update ConstructionAutomation.kt
EmperorPinguin Aug 13, 2024
db855b2
Update Policies.json
EmperorPinguin Aug 13, 2024
8a1c8b5
Update Policies.json
EmperorPinguin Aug 13, 2024
6b75cdb
Update Policies.json
EmperorPinguin Aug 13, 2024
16278a4
Update ConstructionAutomation.kt
EmperorPinguin Aug 13, 2024
f1dcea1
Update Policies.json
EmperorPinguin Aug 13, 2024
3cc9bf9
Update ReligionAutomation.kt
EmperorPinguin Aug 14, 2024
6fc896b
Update ReligionAutomation.kt
EmperorPinguin Aug 14, 2024
2f171a8
Update ReligionAutomation.kt
EmperorPinguin Aug 14, 2024
f90a4f8
Update ReligionAutomation.kt
EmperorPinguin Aug 14, 2024
90075e7
Merge branch 'yairm210:master' into master
EmperorPinguin Aug 16, 2024
9c2ba52
Rename Crop Yield to Growth
EmperorPinguin Aug 16, 2024
06f730c
Merge branch 'yairm210:master' into master
EmperorPinguin Aug 17, 2024
1f36661
Merge branch 'yairm210:master' into master
EmperorPinguin Aug 21, 2024
443074a
Merge branch 'yairm210:master' into master
EmperorPinguin Aug 22, 2024
1ee9432
Merge branch 'yairm210:master' into master
EmperorPinguin Aug 24, 2024
e8d2e81
Update worker usage
EmperorPinguin Aug 24, 2024
5c228b0
Merge branch 'yairm210:master' into master
EmperorPinguin Aug 28, 2024
44062df
Update UnitAutomation.kt
EmperorPinguin Aug 29, 2024
089919e
Merge branch 'yairm210:master' into master
EmperorPinguin Aug 29, 2024
b45d857
Merge branch 'yairm210:master' into master
EmperorPinguin Aug 31, 2024
9163062
Merge branch 'yairm210:master' into master
EmperorPinguin Sep 6, 2024
c8dbff7
Merge branch 'yairm210:master' into master
EmperorPinguin Sep 8, 2024
8b2d813
Tutorials update
EmperorPinguin Sep 8, 2024
8da7927
Update Tutorials.json
EmperorPinguin Sep 8, 2024
d8b06ff
Merge branch 'yairm210:master' into master
EmperorPinguin Sep 8, 2024
0e8b1d1
Fix spelling error
EmperorPinguin Sep 8, 2024
2e415e0
Merge branch 'master' of https://github.com/EmperorPinguin/Unciv
EmperorPinguin Sep 8, 2024
aa2712c
Update Tutorials.json
EmperorPinguin Sep 8, 2024
a339192
Update Tutorials.json
EmperorPinguin Sep 8, 2024
195390d
Update Tutorials.json
EmperorPinguin Sep 8, 2024
777fb8f
Update Tutorials.json
EmperorPinguin Sep 8, 2024
4556892
Update Tutorials.json
EmperorPinguin Sep 8, 2024
2c1523a
Update Tutorials.json
EmperorPinguin Sep 8, 2024
04e49f2
Update Tutorials.json
EmperorPinguin Sep 9, 2024
344cd13
Update Tutorials.json
EmperorPinguin Sep 14, 2024
d25f898
Merge branch 'yairm210:master' into master
EmperorPinguin Sep 14, 2024
6e7ccdc
Merge branch 'yairm210:master' into master
EmperorPinguin Sep 19, 2024
fee8469
AI tech and policy choices
EmperorPinguin Sep 20, 2024
44adb88
Update Techs.json
EmperorPinguin Sep 21, 2024
12f934e
Update Policies.json
EmperorPinguin Sep 21, 2024
451cf95
Merge branch 'yairm210:master' into master
EmperorPinguin Sep 21, 2024
58e079d
Update ConstructionAutomation.kt
EmperorPinguin Sep 21, 2024
4c5b5c2
Merge branch 'master' of https://github.com/EmperorPinguin/Unciv
EmperorPinguin Sep 21, 2024
fd9960a
Update UnitPromotions.json
EmperorPinguin Sep 21, 2024
ca9fdd7
Update
EmperorPinguin Sep 22, 2024
324472e
Update Policies.json
EmperorPinguin Sep 22, 2024
bb20a74
Update Tutorials.json
EmperorPinguin Sep 22, 2024
bb5d15e
Merge branch 'yairm210:master' into master
EmperorPinguin Sep 23, 2024
9b9df46
ReligionAutomation bugfix
EmperorPinguin Sep 23, 2024
d0d347b
Update ReligionAutomation.kt
EmperorPinguin Sep 23, 2024
bfcc10c
Merge branch 'yairm210:master' into master
EmperorPinguin Sep 24, 2024
daae674
Update ReligionAutomation.kt
EmperorPinguin Sep 24, 2024
c44969e
Update ReligionAutomation.kt
EmperorPinguin Sep 25, 2024
6eac918
Update ReligionAutomation.kt
EmperorPinguin Sep 25, 2024
bf8328c
Update ReligionAutomation.kt
EmperorPinguin Sep 25, 2024
85d5c33
Update ReligionAutomation.kt
EmperorPinguin Sep 25, 2024
b0b16bb
Update ReligionAutomation.kt
EmperorPinguin Sep 25, 2024
e3f77e4
Merge branch 'yairm210:master' into master
EmperorPinguin Sep 26, 2024
0015806
Merge branch 'yairm210:master' into master
EmperorPinguin Oct 2, 2024
7600041
Update AI city settling and science game
EmperorPinguin Oct 2, 2024
9a1bfa8
Update ReligionAutomation.kt
EmperorPinguin Oct 5, 2024
75fd6f1
Maybe revert this now the belief picking has improved
EmperorPinguin Oct 5, 2024
f5f88d1
Update ReligionAutomation.kt
EmperorPinguin Oct 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions android/assets/jsons/Civ V - Gods & Kings/Techs.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"name": "Archery",
"row": 7,
"prerequisites": ["Agriculture"],
"uniques": ["[-50]% weight to this choice for AI decisions"],
"quote": "'The haft of the arrow has been feathered with one of the eagle's own plumes, we often give our enemies the means of our own destruction' - Aesop"
},
{
Expand Down Expand Up @@ -101,6 +102,7 @@
"name": "Bronze Working",
"row": 10,
"prerequisites": ["Mining"],
"uniques": ["[+50]% weight to this choice for AI decisions"],
"quote": "'Here Hector entered, with a spear eleven cubits long in his hand; the bronze point gleamed in front of him, and was fastened to the shaft of the spear by a ring of gold.' - Homer"
}
]
Expand All @@ -124,6 +126,7 @@
"name": "Horseback Riding",
"row": 5,
"prerequisites": ["Trapping","The Wheel"],
"uniques": ["[+50]% weight to this choice for AI decisions"],
"quote": "'A Horse! A Horse! My kingdom for a horse!' - Shakespeare (Richard III)"
},
{
Expand Down Expand Up @@ -178,6 +181,7 @@
"name": "Iron Working",
"row": 10,
"prerequisites": ["Bronze Working"],
"uniques": ["[-50]% weight to this choice for AI decisions"],
"quote": "'Do not wait to strike til the iron is hot, but make it hot by striking.' - William Butler Yeats"
}
]
Expand Down Expand Up @@ -213,6 +217,7 @@
"name": "Metal Casting",
"row": 9,
"prerequisites": ["Engineering","Iron Working"],
"uniques": ["[+100]% weight to this choice for AI decisions"],
"quote": "'When pieces of bronze or gold or iron break, the metal-smith welds them together again in the fire, and the bond is established.' - Sri Guru Granth Sahib"
}
]
Expand All @@ -229,6 +234,7 @@
"cost": 375,
"row": 1,
"prerequisites": ["Optics","Theology"],
"uniques": ["[-50]% weight to this choice for AI decisions"],
"quote": "'I find the great thing in this world is not so much where we stand, as in what direction we are moving.' - Oliver Wendell Holmes"
},
{
Expand Down Expand Up @@ -262,6 +268,7 @@
"name": "Steel",
"row": 10,
"prerequisites": ["Metal Casting"],
"uniques": ["[-50]% weight to this choice for AI decisions"],
"quote": "'John Henry said to his Captain, / 'A man ain't nothin' but a man, / And before I'll let your steam drill beat me down, / I'll die with the hammer in my hand.'' - Anonymous: The Ballad of John Henry, the Steel-Drivin' Man"
}
]
Expand All @@ -276,7 +283,7 @@
{
"name": "Astronomy",
"row": 2,
"uniques": ["[+1] Movement <for [Embarked] units>","Enables [Embarked] units to enter ocean tiles"],
"uniques": ["[+1] Movement <for [Embarked] units>","Enables [Embarked] units to enter ocean tiles","[+50]% weight to this choice for AI decisions"],
"prerequisites": ["Compass","Education"],
"quote": "'Joyfully to the breeze royal Odysseus spread his sail, and with his rudder skillfully he steered.' - Homer"
},
Expand Down Expand Up @@ -305,6 +312,7 @@
"name": "Gunpowder",
"row": 10,
"prerequisites": ["Physics","Steel"],
"uniques": ["[-50]% weight to this choice for AI decisions"],
"quote": "'The day when two army corps can annihilate each other in one second, all civilized nations, it is to be hoped, will recoil from war and discharge their troops.' - Alfred Nobel"
}
]
Expand Down Expand Up @@ -332,18 +340,21 @@
"name": "Economics",
"row": 6,
"prerequisites": ["Banking","Printing Press"],
"uniques": ["[+50]% weight to this choice for AI decisions"],
"quote": "'Compound interest is the most powerful force in the universe.' - Albert Einstein"
},
{
"name": "Metallurgy",
"row": 9,
"prerequisites": ["Printing Press","Gunpowder"],
"uniques": ["[-50]% weight to this choice for AI decisions"],
"quote": "'There never was a good knife made of bad steel.' - Benjamin Franklin"
},
{
"name": "Chemistry",
"row": 10,
"prerequisites": ["Gunpowder"],
"uniques": ["[+100]% weight to this choice for AI decisions"],
"quote": "'Wherever we look, the work of the chemist has raised the level of our civilization and has increased the productive capacity of the nation.' - Calvin Coolidge"
}
]
Expand All @@ -359,6 +370,7 @@
"name": "Archaeology",
"row": 2,
"prerequisites": ["Navigation","Architecture"],
"uniques": ["[+50]% weight to this choice for AI decisions"],
"quote": "'Those who cannot remember the past are condemned to repeat it.' - George Santayana"
},
{
Expand All @@ -372,12 +384,14 @@
"name": "Industrialization",
"row": 6,
"prerequisites": ["Economics"],
"uniques": ["[+50]% weight to this choice for AI decisions"],
"quote": "'Industrialization based on machinery, already referred to as a characteristic of our age, is but one aspect of the revolution that is being wrought by technology.' - Emily Greene Balch"
},
{
"name": "Rifling",
"row": 7,
"prerequisites": ["Economics","Metallurgy"],
"uniques": ["[-50]% weight to this choice for AI decisions"],
"quote": "'It is well that war is so terrible, or we should grow too fond of it.' - Robert E. Lee"
},
{
Expand Down Expand Up @@ -442,19 +456,21 @@
"name": "Refrigeration",
"row": 2,
"prerequisites": ["Biology", "Electricity"], //todo: offshore platform should need this
"uniques": ["[-50]% weight to this choice for AI decisions"],
"uniques": ["[-75]% weight to this choice for AI decisions"],
"quote": "'And homeless near a thousand homes I stood, and near a thousand tables pined and wanted food.' - William Wordsworth"
},
{
"name": "Radio",
"row": 3,
"prerequisites": ["Electricity"],
"uniques": ["[+100]% weight to this choice for AI decisions"],
"quote": "'The whole country was tied together by radio. We all experienced the same heroes and comedians and singers. They were giants.' - Woody Allen"
},
{
"name": "Replaceable Parts",
"row": 4,
"prerequisites": ["Electricity","Steam Power"],
"uniques": ["[+100]% weight to this choice for AI decisions"],
"quote": "'Nothing is particularly hard if you divide it into small jobs.' - Henry Ford"
},
{
Expand Down Expand Up @@ -483,7 +499,7 @@
"name": "Plastics",
"row": 3,
"prerequisites": ["Radio","Replaceable Parts"],
"uniques": ["[+100]% weight to this choice for AI decisions"],
"uniques": ["[+200]% weight to this choice for AI decisions"],
"quote": "'Ben, I want to say one word to you, just one word: plastics.' - Buck Henry and Calder Willingham, The Graduate"
},
{
Expand Down Expand Up @@ -531,6 +547,7 @@
"name": "Radar",
"row": 6,
"prerequisites": ["Ballistics","Electronics"],
"uniques": ["[+100]% weight to this choice for AI decisions"],
"quote": "'Vision is the art of seeing things invisible.' - Jonathan Swift"
},
{
Expand Down Expand Up @@ -604,7 +621,7 @@
"name": "Satellites",
"row": 6,
"prerequisites": ["Rocketry"],
"uniques": ["Reveals the entire map","[+100]% weight to this choice for AI decisions"],
"uniques": ["Reveals the entire map","[+200]% weight to this choice for AI decisions"],
"quote": "'Now, somehow, in some new way, the sky seemed almost alien.' - Lyndon B. Johnson"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class ConstructionAutomation(val cityConstructions: CityConstructions) {
if (!civInfo.hasUnique(UniqueType.EnablesConstructionOfSpaceshipParts)) return
val spaceshipPart = (nonWonders + units).filter { it.name in spaceshipParts }.filterBuildable().firstOrNull()
?: return
val modifier = 3f * personality.modifierFocus(PersonalityValue.Science, .4f)
val modifier = 20f //We're weighing Apollo program according to personality. If we decided to invest in that, we might as well commit to it.
addChoice(relativeCostEffectiveness, spaceshipPart.name, modifier)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,17 +367,9 @@ object NextTurnAutomation {

if (greatPeople.isEmpty()) return
var greatPerson = greatPeople.random()

if (civInfo.wantsToFocusOn(Victory.Focus.Culture)) {
val culturalGP =
greatPeople.firstOrNull { it.uniques.contains("Great Person - [Culture]") }
if (culturalGP != null) greatPerson = culturalGP
}
if (civInfo.wantsToFocusOn(Victory.Focus.Science)) {
val scientificGP =
greatPeople.firstOrNull { it.uniques.contains("Great Person - [Science]") }
if (scientificGP != null) greatPerson = scientificGP
}
val scienceGP = greatPeople.firstOrNull { it.uniques.contains("Great Person - [Science]") }
if (scienceGP != null) greatPerson = scienceGP
// Humans would pick a prophet or engineer, but it'd require more sophistication on part of the AI - a scientist is the safest option for now

civInfo.units.addUnit(greatPerson, civInfo.cities.firstOrNull { it.isCapital() })

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,12 @@ object ReligionAutomation {

if (civInfo.religionManager.remainingFoundableReligions() == 0 ) {
buyGreatPerson(civInfo)
return
}

// We don't have a religion and no more change of getting it :(
if (civInfo.religionManager.religionState <= ReligionState.Pantheon) {
tryBuyAnyReligiousBuilding(civInfo)
return
}

// If we don't have majority in all our own cities, build missionaries and inquisitors to solve this
//TODO: in late game, this may not be worth it
val citiesWithoutOurReligion = civInfo.cities.filter { it.religion.getMajorityReligion() != civInfo.religionManager.religion!! }
// The original had a cap at 4 missionaries total, but 1/4 * the number of cities should be more appropriate imo
if (citiesWithoutOurReligion.count() >
Expand All @@ -59,7 +55,6 @@ object ReligionAutomation {
return
}


// Get an inquisitor to defend our holy city
val holyCity = civInfo.religionManager.getHolyCity()
if (holyCity != null
Expand All @@ -70,23 +65,13 @@ object ReligionAutomation {
buyInquisitorNear(civInfo, holyCity)
return
}

// Buy religious buildings in cities if possible
val citiesWithMissingReligiousBuildings = civInfo.cities.filter { city ->
city.religion.getMajorityReligion() != null
&& !city.cityConstructions.isAllBuilt(city.religion.getMajorityReligion()!!.buildingsPurchasableByBeliefs)
}
if (citiesWithMissingReligiousBuildings.any()) {
tryBuyAnyReligiousBuilding(civInfo)
return
}


// Just buy missionaries to spread our religion outside of our civ
if (civInfo.units.getCivUnits().count { it.hasUnique(UniqueType.CanSpreadReligion) } < 4) {
buyMissionaryInAnyCity(civInfo)
return
}
// Todo: buy inquisitors for defence of other cities
// Todo: declare war if enemy missionaries enter our civ without permission
}

private fun tryBuyAnyReligiousBuilding(civInfo: Civilization) {
Expand Down Expand Up @@ -289,17 +274,17 @@ object ReligionAutomation {
UniqueType.StatsFromObject ->
when {
ruleSet.buildings.containsKey(unique.params[1]) -> {
unique.stats.values.sum() /
if (ruleSet.buildings[unique.params[1]]!!.isWonder) 2f
else 1f
unique.stats.values.sum() *
if (ruleSet.buildings[unique.params[1]]!!.isNationalWonder) 0.5f //there's at most 1 copy of each of these in our empire
else 1.5f //yields for buildings are usually more desireable than faith-purchased buildings, as we might not need an upfront investment

}
ruleSet.specialists.containsKey(unique.params[1]) -> {
unique.stats.values.sum() *
if (city.population.population > 8f) 3f
if (city.population.population > 8f) 2f
else 1f
}
else -> 0f
else -> unique.stats.values.sum() * 1f //should account for most edge cases here
}
UniqueType.StatsFromTradeRoute ->
unique.stats.values.sum() *
Expand All @@ -309,7 +294,7 @@ object ReligionAutomation {
min(unique.params[0].toFloat() * city.population.population, unique.params[2].toFloat())
UniqueType.StatsPerCity ->
if (city.matchesFilter(unique.params[1]))
unique.stats.values.sum()
unique.stats.values.sum() * 2f //free yields
else 0f
else -> 0f
}
Expand Down Expand Up @@ -359,7 +344,7 @@ object ReligionAutomation {
// Some city-filters are modified by personality (non-enemy foreign cities)
score += modifier * when (unique.type) {
UniqueType.KillUnitPlunderNearCity ->
unique.params[0].toFloat() * 4f *
unique.params[0].toFloat() * 0.5f * //can be very strong, but a low weight for now as the AI currently isn't farming barb camp
if (civInfo.wantsToFocusOn(Victory.Focus.Military)) 2f
else 1f
UniqueType.BuyUnitsForAmountStat, UniqueType.BuyBuildingsForAmountStat ->
Expand All @@ -368,39 +353,39 @@ object ReligionAutomation {
) 0f
// This is something completely different from the original, but I have no idea
// what happens over there
else civInfo.stats.statsForNextTurn[Stat.valueOf(unique.params[2])] * 5f / unique.params[1].toFloat()
else civInfo.stats.statsForNextTurn[Stat.valueOf(unique.params[2])] * 200f / unique.params[1].toFloat() //the costs of these are probably similar to the baseUnitBuyCost
UniqueType.BuyUnitsWithStat, UniqueType.BuyBuildingsWithStat ->
if (civInfo.religionManager.religion != null
&& civInfo.religionManager.religion!!.followerBeliefUniqueMap.getUniques(unique.type).any()
) 0f
// This is something completely different from the original, but I have no idea
// what happens over there
else civInfo.stats.statsForNextTurn[Stat.valueOf(unique.params[1])] * 10f / civInfo.getEra().baseUnitBuyCost
else civInfo.stats.statsForNextTurn[Stat.valueOf(unique.params[1])] * 200f / civInfo.getEra().baseUnitBuyCost //baseUnitBuyCost is 200 in Standard speed pre-Renaissance
UniqueType.BuyUnitsByProductionCost ->
15f * if (civInfo.wantsToFocusOn(Victory.Focus.Military)) 2f else 1f
0f //Holy Warriors is a waste if we don't buy units with it, and if we buy units with it'll cost us great persons
UniqueType.StatsWhenSpreading ->
unique.params[0].toFloat() / 5f
unique.params[0].toFloat() / 10f
UniqueType.StatsWhenAdoptingReligion ->
unique.stats.values.sum() / 50f
UniqueType.RestingPointOfCityStatesFollowingReligionChange ->
if (civInfo.wantsToFocusOn(Victory.Focus.CityStates))
unique.params[0].toFloat() / 3.5f
unique.params[0].toFloat() / 4f
else
unique.params[0].toFloat() / 7f
unique.params[0].toFloat() / 8f
UniqueType.StatsFromGlobalCitiesFollowingReligion ->
unique.stats.values.sum()
unique.stats.values.sum() * 2f //free yields that are potentially more than our own number of cities would allow
UniqueType.StatsFromGlobalFollowers ->
4f * (unique.stats.values.sum() / unique.params[1].toFloat())
10f * (unique.stats.values.sum() / unique.params[1].toFloat())
UniqueType.Strength ->
unique.params[0].toFloat() / 4f
unique.params[0].toFloat() * 2f//combat strength from beliefs is very strong
UniqueType.ReligionSpreadDistance ->
(10f + unique.params[0].toFloat()) * goodEarlyModifier
UniqueType.NaturalReligionSpreadStrength ->
unique.params[0].toFloat() * goodEarlyModifier / 5f
unique.params[0].toFloat() * goodEarlyModifier / 5f //We should weigh this according to cityFilter; Religious Texts is way stronger than Religious Unity
UniqueType.SpreadReligionStrength ->
unique.params[0].toFloat() * goodLateModifier / 5f
UniqueType.FaithCostOfGreatProphetChange ->
-unique.params[0].toFloat() * goodLateModifier / 2f
-unique.params[0].toFloat() * goodLateModifier / 10f //It's only about 1 more prophet, due to the increasing costs.
UniqueType.BuyBuildingsDiscount, UniqueType.BuyUnitsDiscount ->
-unique.params[2].toFloat() * goodLateModifier / 5f
UniqueType.BuyItemsDiscount ->
Expand Down
Loading
Loading