Skip to content

Commit 2976187

Browse files
Adding religous city states to unciv! (#5136)
* Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv! * Adding religous city states to unciv!
1 parent 0f805fb commit 2976187

File tree

9 files changed

+85
-5
lines changed

9 files changed

+85
-5
lines changed

android/assets/Atlases.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[Tech,Flags,Skin,Construction]
1+
[Construction,Flags,Skin,Tech]

android/assets/jsons/Civ V - Vanilla/Eras.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@
1616
"Cultured": ["Provides [3] [Culture] per turn"],
1717
"Maritime": ["Provides [2] [Food] [in capital]"],
1818
"Mercantile": ["Provides [2] Happiness"],
19+
"Religious": ["Provides [3] [Faith] per turn"],
1920
"Militaristic": ["Provides military units every ≈[20] turns"]
2021
},
2122
"allyBonus": {
2223
"Cultured": ["Provides [6] [Culture] per turn"],
2324
"Maritime": ["Provides [2] [Food] [in capital]", "Provides [1] [Food] [in all cities]"],
2425
"Mercantile": ["Provides [2] Happiness", "Provides a unique luxury"],
26+
"Religious": ["Provides [6] [Faith] per turn"],
2527
"Militaristic": ["Provides military units every ≈[17] turns"]
2628
},
2729
"iconRGB": [255, 87, 35]
@@ -42,12 +44,14 @@
4244
"Cultured": ["Provides [3] [Culture] per turn"],
4345
"Maritime": ["Provides [2] [Food] [in capital]"],
4446
"Mercantile": ["Provides [2] Happiness"],
47+
"Religious": ["Provides [3] [Faith] per turn"],
4548
"Militaristic": ["Provides military units every ≈[20] turns"]
4649
},
4750
"allyBonus": {
4851
"Cultured": ["Provides [6] [Culture] per turn"],
4952
"Maritime": ["Provides [2] [Food] [in capital]", "Provides [1] [Food] [in all cities]"],
5053
"Mercantile": ["Provides [2] Happiness", "Provides a unique luxury"],
54+
"Religious": ["Provides [6] [Faith] per turn"],
5155
"Militaristic": ["Provides military units every ≈[17] turns"]
5256
},
5357
"iconRGB": [233, 31, 99]
@@ -70,12 +74,14 @@
7074
"Cultured": ["Provides [6] [Culture] per turn"],
7175
"Maritime": ["Provides [2] [Food] [in capital]"],
7276
"Mercantile": ["Provides [3] Happiness"],
77+
"Religious": ["Provides [6] [Faith] per turn"],
7378
"Militaristic": ["Provides military units every ≈[20] turns"]
7479
},
7580
"allyBonus": {
7681
"Cultured": ["Provides [12] [Culture] per turn"],
7782
"Maritime": ["Provides [2] [Food] [in capital]", "Provides [1] [Food] [in all cities]"],
7883
"Mercantile": ["Provides [3] Happiness", "Provides a unique luxury"],
84+
"Religious": ["Provides [12] [Faith] per turn"],
7985
"Militaristic": ["Provides military units every ≈[17] turns"]
8086
},
8187
"iconRGB": [157, 39, 176]
@@ -99,12 +105,14 @@
99105
"Cultured": ["Provides [6] [Culture] per turn"],
100106
"Maritime": ["Provides [2] [Food] [in capital]"],
101107
"Mercantile": ["Provides [3] Happiness"],
108+
"Religious": ["Provides [6] [Faith] per turn"],
102109
"Militaristic": ["Provides military units every ≈[20] turns"]
103110
},
104111
"allyBonus": {
105112
"Cultured": ["Provides [12] [Culture] per turn"],
106113
"Maritime": ["Provides [2] [Food] [in capital]", "Provides [1] [Food] [in all cities]"],
107114
"Mercantile": ["Provides [3] Happiness", "Provides a unique luxury"],
115+
"Religious": ["Provides [12] [Faith] per turn"],
108116
"Militaristic": ["Provides military units every ≈[17] turns"]
109117
},
110118
"iconRGB": [104, 58, 183]
@@ -129,12 +137,14 @@
129137
"Cultured": ["Provides [13] [Culture] per turn"],
130138
"Maritime": ["Provides [2] [Food] [in capital]"],
131139
"Mercantile": ["Provides [3] Happiness"],
140+
"Religious": ["Provides [13] [Faith] per turn"],
132141
"Militaristic": ["Provides military units every ≈[20] turns"]
133142
},
134143
"allyBonus": {
135144
"Cultured": ["Provides [26] [Culture] per turn"],
136145
"Maritime": ["Provides [2] [Food] [in capital]", "Provides [1] [Food] [in all cities]"],
137146
"Mercantile": ["Provides [3] Happiness", "Provides a unique luxury"],
147+
"Religious": ["Provides [26] [Faith] per turn"],
138148
"Militaristic": ["Provides military units every ≈[17] turns"]
139149
},
140150
"iconRGB": [63, 81, 182],
@@ -164,12 +174,15 @@
164174
"Cultured": ["Provides [13] [Culture] per turn"],
165175
"Maritime": ["Provides [2] [Food] [in capital]"],
166176
"Mercantile": ["Provides [3] Happiness"],
177+
178+
"Religious": ["Provides [13] [Faith] per turn"],
167179
"Militaristic": ["Provides military units every ≈[20] turns"]
168180
},
169181
"allyBonus": {
170182
"Cultured": ["Provides [26] [Culture] per turn"],
171183
"Maritime": ["Provides [2] [Food] [in capital]", "Provides [1] [Food] [in all cities]"],
172184
"Mercantile": ["Provides [3] Happiness", "Provides a unique luxury"],
185+
"Religious": ["Provides [26] [Faith] per turn"],
173186
"Militaristic": ["Provides military units every ≈[17] turns"]
174187
},
175188
"iconRGB": [33, 150, 243],
@@ -200,12 +213,14 @@
200213
"Cultured": ["Provides [13] [Culture] per turn"],
201214
"Maritime": ["Provides [2] [Food] [in capital]"],
202215
"Mercantile": ["Provides [3] Happiness"],
216+
"Religious": ["Provides [13] [Faith] per turn"],
203217
"Militaristic": ["Provides military units every ≈[20] turns"]
204218
},
205219
"allyBonus": {
206220
"Cultured": ["Provides [26] [Culture] per turn"],
207221
"Maritime": ["Provides [2] [Food] [in capital]", "Provides [1] [Food] [in all cities]"],
208222
"Mercantile": ["Provides [3] Happiness", "Provides a unique luxury"],
223+
"Religious": ["Provides [26] [Faith] per turn"],
209224
"Militaristic": ["Provides military units every ≈[17] turns"]
210225
},
211226
"iconRGB": [0, 150, 136],
@@ -240,13 +255,16 @@
240255
"Cultured": ["Provides [13] [Culture] per turn"],
241256
"Maritime": ["Provides [2] [Food] [in capital]"],
242257
"Mercantile": ["Provides [3] Happiness"],
258+
"Religious": ["Provides [13] [Faith] per turn"],
243259
"Militaristic": ["Provides military units every ≈[20] turns"]
244260
},
245261
"allyBonus": {
246262
"Cultured": ["Provides [26] [Culture] per turn"],
247263
"Maritime": ["Provides [2] [Food] [in capital]", "Provides [1] [Food] [in all cities]"],
248264
"Mercantile": ["Provides [3] Happiness", "Provides a unique luxury"],
265+
"Religious": ["Provides [26] [Faith] per turn"],
249266
"Militaristic": ["Provides military units every ≈[17] turns"]
267+
250268
},
251269
"iconRGB": [76, 176, 81],
252270
"uniques": ["May not generate great prophet equivalents naturally",
@@ -279,13 +297,17 @@
279297
"Cultured": ["Provides [13] [Culture] per turn"],
280298
"Maritime": ["Provides [2] [Food] [in capital]"],
281299
"Mercantile": ["Provides [3] Happiness"],
300+
"Religious": ["Provides [13] [Faith] per turn"],
282301
"Militaristic": ["Provides military units every ≈[20] turns"]
302+
283303
},
284304
"allyBonus": {
285305
"Cultured": ["Provides [26] [Culture] per turn"],
286306
"Maritime": ["Provides [2] [Food] [in capital]", "Provides [1] [Food] [in all cities]"],
287307
"Mercantile": ["Provides [3] Happiness", "Provides a unique luxury"],
308+
"Religious": ["Provides [26] [Faith] per turn"],
288309
"Militaristic": ["Provides military units every ≈[17] turns"]
310+
289311
},
290312
"iconRGB": [76, 176, 81],
291313
"uniques": ["May not generate great prophet equivalents naturally",

android/assets/jsons/Civ V - Vanilla/Nations.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,6 +1121,42 @@
11211121
"innerColor": [224,224,224],
11221122
"cities": ["Mogadishu"]
11231123
},
1124+
{
1125+
"name": "Bratislava",
1126+
"adjective": ["Bratislava"],
1127+
"cityStateType": "Religious",
1128+
1129+
"declaringWar": "I didn't want to do this. We declare war.",
1130+
"attacked": "I will fear no evil. For god is with me!",
1131+
"defeated": "Why have you forsaken us my lord?",
1132+
"outerColor": [0, 0, 0],
1133+
"innerColor": [255,255,255],
1134+
"cities": ["Bratislava"]
1135+
},
1136+
{
1137+
"name": "Cahokia",
1138+
"adjective": ["Cahokia"],
1139+
"cityStateType": "Religious",
1140+
1141+
"declaringWar": "We have wanted this for a LONG time. War it shall be.",
1142+
"attacked": "Very well, we will kick you back to the ancient era!",
1143+
"defeated": "This isn't how it is supposed to be!",
1144+
"outerColor": [0, 0, 0],
1145+
"innerColor": [203, 253, 232],
1146+
"cities": ["Cahokia"]
1147+
},
1148+
{
1149+
"name": "Jerusalem",
1150+
"adjective": ["Jerusalem"],
1151+
"cityStateType": "Religious",
1152+
1153+
"declaringWar": "By god's grace we will not allow these atrocities to occur any longer. We declare war!",
1154+
"attacked": "May god have mercy on your evil soul.",
1155+
"defeated": "I for one welcome our new conquer overlord!",
1156+
"outerColor": [0, 0, 0],
1157+
"innerColor": [198,255,192],
1158+
"cities": ["Jerusalem"]
1159+
},
11241160

11251161

11261162

android/assets/jsons/translations/template.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ A [greatPerson] has been born in [cityName]! =
499499
We have encountered [civName]! =
500500
[cityStateName] has given us [stats] as a token of goodwill for meeting us =
501501
[cityStateName] has given us [stats] as we are the first major civ to meet them =
502+
[cityStateName] has also given us [stats] =
502503
Cannot provide unit upkeep for [unitName] - unit has been disbanded! =
503504
[cityName] has grown! =
504505
[cityName] is starving! =

core/src/com/unciv/logic/GameStarter.kt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,16 +191,26 @@ object GameStarter {
191191
val availableCityStatesNames = Stack<String>()
192192
// since we shuffle and then order by, we end up with all the City-States with starting tiles first in a random order,
193193
// and then all the other City-States in a random order! Because the sortedBy function is stable!
194-
availableCityStatesNames.addAll(ruleset.nations.filter { it.value.isCityState() }.keys
195-
.shuffled().sortedByDescending { it in civNamesWithStartingLocations })
194+
availableCityStatesNames.addAll( ruleset.nations
195+
.filter { it.value.isCityState() && (it.value.cityStateType != CityStateType.Religious || newGameParameters.religionEnabled) }
196+
.keys
197+
.shuffled()
198+
.sortedByDescending { it in civNamesWithStartingLocations } )
199+
200+
201+
val allMercantileResources = ruleset.tileResources.values.filter { it.unique == "Can only be created by Mercantile City-States" }.map { it.name }
202+
val unusedMercantileResources = Stack<String>()
203+
unusedMercantileResources.addAll(allMercantileResources.shuffled())
204+
196205
var addedCityStates = 0
197206
// Keep trying to add city states until we reach the target number.
198207
while (addedCityStates < newGameParameters.numberOfCityStates) {
199208
if (availableCityStatesNames.isEmpty()) // We ran out of city-states somehow
200209
break
210+
201211
val cityStateName = availableCityStatesNames.pop()
202212
val civ = CivilizationInfo(cityStateName)
203-
if (civ.initCityState(ruleset, newGameParameters.startingEra, availableCivNames)) { // true if successful init
213+
if (civ.initCityState(ruleset, newGameParameters.startingEra, availableCivNames)) {
204214
gameInfo.civilizations.add(civ)
205215
addedCityStates++
206216
}

core/src/com/unciv/logic/civilization/CityStateFunctions.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ class CityStateFunctions(val civInfo: CivilizationInfo) {
425425
civInfo.cityStateType == CityStateType.Mercantile && statType == Stat.Happiness -> true
426426
civInfo.cityStateType == CityStateType.Cultured && statType == Stat.Culture -> true
427427
civInfo.cityStateType == CityStateType.Maritime && statType == Stat.Food -> true
428+
civInfo.cityStateType == CityStateType.Religious && statType == Stat.Faith ->true
428429
else -> false
429430
}
430431
}

core/src/com/unciv/logic/civilization/CityStateType.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ enum class CityStateType(val color: String = "", val icon: String) {
55
Maritime("#38ff70", "OtherIcons/Maritime"),
66
Mercantile("#ffd800", "OtherIcons/Mercantile"),
77
Militaristic("#ff0000", "OtherIcons/Militaristic"),
8-
//Religious("#FFFFFF", "OtherIcons/Religious")
8+
Religious("#FFFFFF", "OtherIcons/Religious")
99
}
1010

1111
enum class CityStatePersonality {

core/src/com/unciv/logic/civilization/CivilizationInfo.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,11 @@ class CivilizationInfo {
406406
val cityStateLocation = if (cities.isEmpty()) null else getCapital().location
407407

408408
val giftAmount = Stats(gold = 15f)
409+
val faithAmount = Stats(faith = 4f)
409410
// Later, religious city-states will also gift gold, making this the better implementation
410411
// For now, it might be overkill though.
411412
var meetString = "[${civName}] has given us [${giftAmount}] as a token of goodwill for meeting us"
413+
val religionMeetString = "[${civName}] has also given us [${faithAmount}]"
412414
if (diplomacy.filter { it.value.otherCiv().isMajorCiv() }.count() == 1) {
413415
giftAmount.timesInPlace(2f)
414416
meetString = "[${civName}] has given us [${giftAmount}] as we are the first major civ to meet them"
@@ -418,6 +420,12 @@ class CivilizationInfo {
418420
else
419421
otherCiv.addNotification(meetString, NotificationIcon.Gold)
420422

423+
if (otherCiv.isCityState() && otherCiv.canGiveStat(Stat.Faith)){
424+
otherCiv.addNotification(religionMeetString, NotificationIcon.Faith)
425+
426+
for ((key, value) in faithAmount)
427+
otherCiv.addStat(key, value.toInt())
428+
}
421429
for ((key, value) in giftAmount)
422430
otherCiv.addStat(key, value.toInt())
423431
}

core/src/com/unciv/logic/civilization/ReligionManager.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package com.unciv.logic.civilization
22

3+
import com.unciv.logic.civilization.diplomacy.RelationshipLevel
34
import com.unciv.logic.map.MapUnit
45
import com.unciv.models.Religion
56
import com.unciv.models.ruleset.Belief
67
import com.unciv.models.ruleset.BeliefType
8+
import com.unciv.models.ruleset.Era
79
import com.unciv.ui.pickerscreens.BeliefContainer
810
import com.unciv.ui.utils.toPercent
911
import kotlin.random.Random

0 commit comments

Comments
 (0)