This commit is contained in:
Yair Morgenstern 2021-07-09 11:01:40 +03:00
commit df7bba02a1
19 changed files with 828 additions and 699 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -263,485 +263,492 @@ Great Merchant
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Great Scientist Great Prophet
rotate: false rotate: false
xy: 112, 112 xy: 112, 112
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Great War Bomber Great Scientist
rotate: false rotate: false
xy: 220, 220 xy: 220, 220
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Great War Infantry Great War Bomber
rotate: false rotate: false
xy: 328, 328 xy: 328, 328
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Guided Missile Great War Infantry
rotate: false rotate: false
xy: 436, 436 xy: 436, 436
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Helicopter Gunship Guided Missile
rotate: false rotate: false
xy: 544, 544 xy: 544, 544
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Hoplite Helicopter Gunship
rotate: false rotate: false
xy: 652, 652 xy: 652, 652
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Horse Archer Hoplite
rotate: false rotate: false
xy: 760, 766 xy: 760, 766
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Horseman Horse Archer
rotate: false rotate: false
xy: 868, 868 xy: 868, 868
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Hwach'a Horseman
rotate: false rotate: false
xy: 112, 4 xy: 112, 4
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Infantry Hwach'a
rotate: false rotate: false
xy: 220, 112 xy: 220, 112
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Ironclad Infantry
rotate: false rotate: false
xy: 328, 220 xy: 328, 220
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Jaguar Ironclad
rotate: false rotate: false
xy: 436, 328 xy: 436, 328
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Janissary Jaguar
rotate: false rotate: false
xy: 544, 436 xy: 544, 436
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Jet Fighter Janissary
rotate: false rotate: false
xy: 652, 544 xy: 652, 544
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Keshik Jet Fighter
rotate: false rotate: false
xy: 760, 658 xy: 760, 658
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Khan Keshik
rotate: false rotate: false
xy: 868, 760 xy: 868, 760
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Knight Khan
rotate: false rotate: false
xy: 976, 868 xy: 976, 868
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Lancer Knight
rotate: false rotate: false
xy: 220, 4 xy: 220, 4
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Landship Lancer
rotate: false rotate: false
xy: 328, 112 xy: 328, 112
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Landsknecht Landship
rotate: false rotate: false
xy: 436, 220 xy: 436, 220
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Legion Landsknecht
rotate: false rotate: false
xy: 544, 328 xy: 544, 328
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Longbowman Legion
rotate: false rotate: false
xy: 652, 436 xy: 652, 436
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Longswordsman Longbowman
rotate: false rotate: false
xy: 760, 550 xy: 760, 550
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Machine Gun Longswordsman
rotate: false rotate: false
xy: 868, 652 xy: 868, 652
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Mandekalu Cavalry Machine Gun
rotate: false rotate: false
xy: 976, 760 xy: 976, 760
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Maori Warrior Mandekalu Cavalry
rotate: false rotate: false
xy: 1084, 868 xy: 1084, 868
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Marine Maori Warrior
rotate: false rotate: false
xy: 328, 4 xy: 328, 4
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Mechanized Infantry Marine
rotate: false rotate: false
xy: 436, 112 xy: 436, 112
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Minuteman Mechanized Infantry
rotate: false rotate: false
xy: 544, 220 xy: 544, 220
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Missile Cruiser Minuteman
rotate: false rotate: false
xy: 652, 328 xy: 652, 328
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Mobile SAM Missile Cruiser
rotate: false rotate: false
xy: 760, 442 xy: 760, 442
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Modern Armor Mobile SAM
rotate: false rotate: false
xy: 868, 544 xy: 868, 544
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Mohawk Warrior Modern Armor
rotate: false rotate: false
xy: 976, 652 xy: 976, 652
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Musketeer Mohawk Warrior
rotate: false rotate: false
xy: 1084, 760 xy: 1084, 760
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Musketeer
rotate: false
xy: 1192, 868
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
Musketman Musketman
rotate: false rotate: false
xy: 1192, 869 xy: 436, 5
size: 100, 99 size: 100, 99
orig: 100, 99 orig: 100, 99
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Naresuan's Elephant Naresuan's Elephant
rotate: false rotate: false
xy: 436, 4 xy: 544, 112
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Norwegian Ski Infantry Norwegian Ski Infantry
rotate: false rotate: false
xy: 544, 112 xy: 652, 220
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Nuclear Missile Nuclear Missile
rotate: false rotate: false
xy: 652, 220 xy: 760, 334
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Nuclear Submarine Nuclear Submarine
rotate: false rotate: false
xy: 760, 334 xy: 868, 436
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Panzer Panzer
rotate: false rotate: false
xy: 868, 436 xy: 976, 544
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Paratrooper Paratrooper
rotate: false rotate: false
xy: 976, 544 xy: 1084, 652
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Persian Immortal Persian Immortal
rotate: false rotate: false
xy: 1084, 652 xy: 1192, 760
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Pikeman Pikeman
rotate: false rotate: false
xy: 1192, 761 xy: 1300, 868
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Privateer Privateer
rotate: false rotate: false
xy: 1300, 868 xy: 652, 112
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Rifleman Rifleman
rotate: false rotate: false
xy: 544, 4 xy: 760, 226
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Rocket Artillery Rocket Artillery
rotate: false rotate: false
xy: 652, 112 xy: 868, 328
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Samurai Samurai
rotate: false rotate: false
xy: 760, 226 xy: 976, 436
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Scout Scout
rotate: false rotate: false
xy: 868, 328 xy: 1084, 544
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Sea Beggar Sea Beggar
rotate: false rotate: false
xy: 976, 436 xy: 1192, 652
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Settler Settler
rotate: false rotate: false
xy: 1084, 544 xy: 1300, 760
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Ship of the Line Ship of the Line
rotate: false rotate: false
xy: 1192, 653 xy: 1408, 868
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Sipahi Sipahi
rotate: false rotate: false
xy: 1300, 760 xy: 760, 118
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Slinger Slinger
rotate: false rotate: false
xy: 1408, 868 xy: 868, 220
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Spearman Spearman
rotate: false rotate: false
xy: 652, 4 xy: 976, 328
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Stealth Bomber Stealth Bomber
rotate: false rotate: false
xy: 760, 118 xy: 1084, 436
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Submarine Submarine
rotate: false rotate: false
xy: 868, 220 xy: 1192, 544
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Swordsman Swordsman
rotate: false rotate: false
xy: 976, 328 xy: 1300, 652
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Tank Tank
rotate: false rotate: false
xy: 1084, 436 xy: 1408, 760
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Tercio Tercio
rotate: false rotate: false
xy: 1192, 545 xy: 1516, 868
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Trebuchet Trebuchet
rotate: false rotate: false
xy: 1300, 652 xy: 976, 220
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Triplane Triplane
rotate: false rotate: false
xy: 1408, 760 xy: 1084, 328
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Trireme Trireme
rotate: false rotate: false
xy: 1516, 867 xy: 1192, 435
size: 100, 101 size: 100, 101
orig: 100, 101 orig: 100, 101
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Turtle Ship Turtle Ship
rotate: false rotate: false
xy: 760, 10 xy: 1300, 544
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
War Chariot War Chariot
rotate: false rotate: false
xy: 868, 112 xy: 1408, 652
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
War Elephant War Elephant
rotate: false rotate: false
xy: 976, 220 xy: 1516, 760
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Warrior Warrior
rotate: false rotate: false
xy: 1084, 328 xy: 1624, 868
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Work Boats Work Boats
rotate: false rotate: false
xy: 1192, 437 xy: 1084, 220
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Worker Worker
rotate: false rotate: false
xy: 1300, 544 xy: 1192, 327
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0
index: -1 index: -1
Zero Zero
rotate: false rotate: false
xy: 1408, 652 xy: 1300, 436
size: 100, 100 size: 100, 100
orig: 100, 100 orig: 100, 100
offset: 0, 0 offset: 0, 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 334 KiB

After

Width:  |  Height:  |  Size: 337 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1.0 MiB

View File

@ -189,6 +189,11 @@
"gold": 4, "gold": 4,
"uniques": ["Great Improvement", "[+1 Gold] once [Economics] is discovered"] "uniques": ["Great Improvement", "[+1 Gold] once [Economics] is discovered"]
}, },
{
"name": "Holy site",
"faith": 6,
"uniques": ["Great Improvement"]
},
{ {
"name": "Citadel", "name": "Citadel",
"uniques": ["Gives a defensive bonus of [100]%", "Deal 30 damage to adjacent enemy units", "Great Improvement", "Can be built just outside your borders"], "uniques": ["Gives a defensive bonus of [100]%", "Deal 30 damage to adjacent enemy units", "Great Improvement", "Can be built just outside your borders"],

View File

@ -1472,6 +1472,12 @@
"uniques": ["Can speed up construction of a wonder", "Can construct [Manufactory]", "Great Person - [Production]", "Unbuildable"], "uniques": ["Can speed up construction of a wonder", "Can construct [Manufactory]", "Great Person - [Production]", "Unbuildable"],
"movement": 2 "movement": 2
}, },
{
"name": "Great Prophet",
"unitType": "Civilian",
"uniques": ["Can construct [Holy site] if it hasn't spread religion yet", "Can spread religion [4] times","Great Person - [Faith]", "Unbuildable"],
"movement": 2
},
{ {
"name": "Great General", "name": "Great General",
"unitType": "Civilian", "unitType": "Civilian",

View File

@ -714,6 +714,8 @@ Hurry Research = Versnel Onderzoek
Conduct Trade Mission = Voer handelsmissie uit Conduct Trade Mission = Voer handelsmissie uit
Your trade mission to [civName] has earned you [goldAmount] gold and [influenceAmount] influence! = Jouw handelsmissie naar [civName] heeft je [goldAmount] goud en [influenceAmount] invloed opgeleverd! Your trade mission to [civName] has earned you [goldAmount] gold and [influenceAmount] influence! = Jouw handelsmissie naar [civName] heeft je [goldAmount] goud en [influenceAmount] invloed opgeleverd!
Hurry Wonder = Versnel Wonder Hurry Wonder = Versnel Wonder
Spread Religion = Verkondig Religie
Spread [religionName] = Verkondig [religionName]
Your citizens have been happy with your rule for so long that the empire enters a Golden Age! = Jouw dorpelingen zijn voor zo een lange tijd blij met jouw leiderschap dat jouw rijk de Gulden Eeuw binnen gaat. Your citizens have been happy with your rule for so long that the empire enters a Golden Age! = Jouw dorpelingen zijn voor zo een lange tijd blij met jouw leiderschap dat jouw rijk de Gulden Eeuw binnen gaat.
You have entered the [newEra]! = Jij bent in het/de [newEra] aangekomen! You have entered the [newEra]! = Jij bent in het/de [newEra] aangekomen!
[civName] has entered the [eraName]! = [civName] is aangekomen in de [eraName]! [civName] has entered the [eraName]! = [civName] is aangekomen in de [eraName]!

View File

@ -674,6 +674,8 @@ Hurry Research =
Conduct Trade Mission = Conduct Trade Mission =
Your trade mission to [civName] has earned you [goldAmount] gold and [influenceAmount] influence! = Your trade mission to [civName] has earned you [goldAmount] gold and [influenceAmount] influence! =
Hurry Wonder = Hurry Wonder =
Spread Religion =
Spread [religionName] =
Your citizens have been happy with your rule for so long that the empire enters a Golden Age! = Your citizens have been happy with your rule for so long that the empire enters a Golden Age! =
You have entered the [newEra]! = You have entered the [newEra]! =
[civName] has entered the [eraName]! = [civName] has entered the [eraName]! =

View File

@ -505,6 +505,7 @@ class CivilizationInfo {
if (cities.isNotEmpty()) { //if no city available, addGreatPerson will throw exception if (cities.isNotEmpty()) { //if no city available, addGreatPerson will throw exception
val greatPerson = greatPeople.getNewGreatPerson() val greatPerson = greatPeople.getNewGreatPerson()
if (greatPerson != null && gameInfo.ruleSet.units.containsKey(greatPerson)) addUnit(greatPerson) if (greatPerson != null && gameInfo.ruleSet.units.containsKey(greatPerson)) addUnit(greatPerson)
religionManager.startTurn()
} }
updateViewableTiles() // adds explored tiles so that the units will be able to perform automated actions better updateViewableTiles() // adds explored tiles so that the units will be able to perform automated actions better
@ -654,16 +655,18 @@ class CivilizationInfo {
notifications.add(Notification(text, arrayList, action)) notifications.add(Notification(text, arrayList, action))
} }
fun addUnit(unitName: String, city: CityInfo? = null) { fun addUnit(unitName: String, city: CityInfo? = null): MapUnit? {
if (cities.isEmpty()) return if (cities.isEmpty()) return null
val cityToAddTo = city ?: cities.random() val cityToAddTo = city ?: cities.random()
if (!gameInfo.ruleSet.units.containsKey(unitName)) return if (!gameInfo.ruleSet.units.containsKey(unitName)) return null
val unit = getEquivalentUnit(unitName) val unit = getEquivalentUnit(unitName)
// silently bail if no tile to place the unit is found
val placedUnit = placeUnitNearTile(cityToAddTo.location, unit.name) val placedUnit = placeUnitNearTile(cityToAddTo.location, unit.name)
if (placedUnit != null && unit.isGreatPerson()) { // silently bail if no tile to place the unit is found
if (placedUnit == null) return null
if (unit.isGreatPerson()) {
addNotification("A [${unit.name}] has been born in [${cityToAddTo.name}]!", placedUnit.getTile().position, unit.name) addNotification("A [${unit.name}] has been born in [${cityToAddTo.name}]!", placedUnit.getTile().position, unit.name)
} }
return placedUnit
} }
/** Tries to place the a [unitName] unit into the [TileInfo] closest to the given the [position] /** Tries to place the a [unitName] unit into the [TileInfo] closest to the given the [position]

View File

@ -1,7 +1,7 @@
package com.unciv.logic.civilization package com.unciv.logic.civilization
import com.unciv.models.ruleset.Belief import com.unciv.models.ruleset.Belief
import com.unciv.models.ruleset.Unique import kotlin.random.Random
class ReligionManager { class ReligionManager {
@Transient @Transient
@ -11,6 +11,33 @@ class ReligionManager {
var pantheonBelief: String? = null var pantheonBelief: String? = null
var greatProphetsEarned = 0
fun clone(): ReligionManager {
val clone = ReligionManager()
clone.pantheonBelief = pantheonBelief
clone.storedFaith = storedFaith
return clone
}
fun startTurn() {
if (canGenerateProphet()) {
val prophetSpawnChange = (5f + storedFaith - faithForNextGreatProphet()) / 100f
if (Random(civInfo.gameInfo.turns).nextFloat() < prophetSpawnChange) {
val birthCity = civInfo.cities.filter { it.religion.getMajorityReligion() == pantheonBelief }.random()
val prophet = civInfo.addUnit("Great Prophet", birthCity)
if (prophet == null) return
prophet.religion = pantheonBelief
prophet.abilityUsedCount["Religion Spread"] = 0
storedFaith -= faithForNextGreatProphet()
}
}
}
fun endTurn(faithFromNewTurn: Int) {
storedFaith += faithFromNewTurn
}
private fun faithForPantheon() = 10 + civInfo.gameInfo.civilizations.count { it.isMajorCiv() && it.religionManager.pantheonBelief != null } * 5 private fun faithForPantheon() = 10 + civInfo.gameInfo.civilizations.count { it.isMajorCiv() && it.religionManager.pantheonBelief != null } * 5
fun canFoundPantheon(): Boolean { fun canFoundPantheon(): Boolean {
@ -28,10 +55,6 @@ class ReligionManager {
return true return true
} }
fun endTurn(faithFromNewTurn: Int) {
storedFaith += faithFromNewTurn
}
fun choosePantheonBelief(belief: Belief){ fun choosePantheonBelief(belief: Belief){
storedFaith -= faithForPantheon() storedFaith -= faithForPantheon()
pantheonBelief = belief.name pantheonBelief = belief.name
@ -39,10 +62,17 @@ class ReligionManager {
civInfo.getCapital().religion[belief.name] = 100 // Capital is religious, other cities are not civInfo.getCapital().religion[belief.name] = 100 // Capital is religious, other cities are not
} }
fun clone(): ReligionManager { // https://www.reddit.com/r/civ/comments/2m82wu/can_anyone_detail_the_finer_points_of_great/
val clone = ReligionManager() // Game files (globaldefines.xml)
clone.pantheonBelief = pantheonBelief fun faithForNextGreatProphet() = ((200 + 100 * greatProphetsEarned * (greatProphetsEarned + 1)/2) * civInfo.gameInfo.gameParameters.gameSpeed.modifier).toInt()
clone.storedFaith = storedFaith
return clone fun canGenerateProphet(): Boolean {
if (pantheonBelief == null) return false // First get a pantheon, then we'll talk about a real religion
if (storedFaith < faithForNextGreatProphet()) return false
// In the base game, great prophets shouldn't generate anymore starting from the industrial era
// This is difficult to implement in the current codebase, probably requires an additional variable in eras.json
// Also only if you either [have founded a religion] or [the max amount of religions (players/2 + 1) has not been reached].
// As this is yet to be implemented, this function does almost nothing
return true
} }
} }

View File

@ -13,6 +13,7 @@ import com.unciv.models.ruleset.Unique
import com.unciv.models.ruleset.tile.TileImprovement import com.unciv.models.ruleset.tile.TileImprovement
import com.unciv.models.ruleset.unit.BaseUnit import com.unciv.models.ruleset.unit.BaseUnit
import com.unciv.models.ruleset.unit.UnitType import com.unciv.models.ruleset.unit.UnitType
import com.unciv.models.translations.getPlaceholderParameters
import java.text.DecimalFormat import java.text.DecimalFormat
import kotlin.math.pow import kotlin.math.pow
import kotlin.random.Random import kotlin.random.Random
@ -92,8 +93,10 @@ class MapUnit {
* Name which should be displayed in UI * Name which should be displayed in UI
*/ */
fun displayName(): String { fun displayName(): String {
return if (instanceName == null) name val name = if (instanceName == null) name
else "$instanceName ({$name})" else "$instanceName (${name})"
return if (religion != null && maxReligionSpreads() > 0) "$name ($religion)"
else name
} }
var currentMovement: Float = 0f var currentMovement: Float = 0f
@ -106,6 +109,9 @@ class MapUnit {
var due: Boolean = true var due: Boolean = true
var isTransported: Boolean = false var isTransported: Boolean = false
var abilityUsedCount: HashMap<String, Int> = hashMapOf()
var religion: String? = null
companion object { companion object {
private const val ANCIENT_RUIN_MAP_REVEAL_OFFSET = 4 private const val ANCIENT_RUIN_MAP_REVEAL_OFFSET = 4
private const val ANCIENT_RUIN_MAP_REVEAL_RANGE = 4 private const val ANCIENT_RUIN_MAP_REVEAL_RANGE = 4
@ -126,6 +132,8 @@ class MapUnit {
toReturn.attacksThisTurn = attacksThisTurn toReturn.attacksThisTurn = attacksThisTurn
toReturn.promotions = promotions.clone() toReturn.promotions = promotions.clone()
toReturn.isTransported = isTransported toReturn.isTransported = isTransported
toReturn.abilityUsedCount.putAll(abilityUsedCount)
toReturn.religion = religion
return toReturn return toReturn
} }
@ -976,5 +984,15 @@ class MapUnit {
return matchingUniques.any { improvement.matchesFilter(it.params[0]) || tile.matchesTerrainFilter(it.params[0]) } return matchingUniques.any { improvement.matchesFilter(it.params[0]) || tile.matchesTerrainFilter(it.params[0]) }
} }
fun maxReligionSpreads(): Int {
return getMatchingUniques("Can spread religion [] times").sumBy { it.params[0].toInt() }
}
fun getReligionString(): String {
val maxSpreads = maxReligionSpreads()
if (abilityUsedCount["Religion Spread"] == null) return "" // That is, either the key doesn't exist, or it does exist and the value is null.
return "${maxSpreads - abilityUsedCount["Religion Spread"]!!}/${maxSpreads}"
}
//endregion //endregion
} }

View File

@ -30,6 +30,7 @@ enum class UnitActionType(val value: String) {
ConstructRoad("Construct road"), ConstructRoad("Construct road"),
// //
Create("Create"), Create("Create"),
SpreadReligion("Spread Religion"),
HurryResearch("Hurry Research"), HurryResearch("Hurry Research"),
StartGoldenAge("Start Golden Age"), StartGoldenAge("Start Golden Age"),
HurryWonder("Hurry Wonder"), HurryWonder("Hurry Wonder"),

View File

@ -42,6 +42,10 @@ class CityStatsTable(val cityScreen: CityScreen): Table() {
addText() addText()
innerTable.addSeparator() innerTable.addSeparator()
innerTable.add(SpecialistAllocationTable(cityScreen).apply { update() }) innerTable.add(SpecialistAllocationTable(cityScreen).apply { update() })
if (cityInfo.civInfo.gameInfo.hasReligionEnabled()) {
innerTable.addSeparator()
addReligionInfo()
}
pack() pack()
} }
@ -78,4 +82,11 @@ class CityStatsTable(val cityScreen: CityScreen): Table() {
if (cityInfo.isInResistance()) if (cityInfo.isInResistance())
innerTable.add("In resistance for another [${cityInfo.resistanceCounter}] turns".toLabel()).row() innerTable.add("In resistance for another [${cityInfo.resistanceCounter}] turns".toLabel()).row()
} }
private fun addReligionInfo() {
// This will later become large enough to be its own class, but for now it is small enough to fit inside a single function
val majorityReligion = cityInfo.religion.getMajorityReligion()
val label = majorityReligion ?: "None"
innerTable.add("Majority Religion: $label".toLabel())
}
} }

View File

@ -63,6 +63,7 @@ object UnitActions {
// //
addCreateWaterImprovements(unit, actionList) addCreateWaterImprovements(unit, actionList)
addGreatPersonActions(unit, actionList, tile) addGreatPersonActions(unit, actionList, tile)
addSpreadReligionActions(unit, actionList, tile)
actionList += getImprovementConstructionActions(unit, tile) actionList += getImprovementConstructionActions(unit, tile)
addDisbandAction(actionList, unit, worldScreen) addDisbandAction(actionList, unit, worldScreen)
@ -423,9 +424,34 @@ object UnitActions {
} }
} }
private fun addSpreadReligionActions(unit: MapUnit, actionList: ArrayList<UnitAction>, tile: TileInfo) {
if (!unit.hasUnique("Can spread religion [] times")) return
if (unit.religion == null) return
val maxReligionSpreads = unit.maxReligionSpreads()
if (!unit.abilityUsedCount.containsKey("Religion Spread")) return // This should be impossible anways, but just in case
if (maxReligionSpreads <= unit.abilityUsedCount["Religion Spread"]!!) return
val city = tile.getCity()
actionList += UnitAction(UnitActionType.SpreadReligion,
title = "Spread [${unit.religion!!}]",
uncivSound = UncivSound.Choir,
action = {
unit.abilityUsedCount["Religion Spread"] = unit.abilityUsedCount["Religion Spread"]!! + 1
city!!.religion[unit.religion!!] = 100
unit.currentMovement = 0f
if (unit.abilityUsedCount["Religion Spread"] == maxReligionSpreads) {
addGoldPerGreatPersonUsage(unit.civInfo)
unit.destroy()
}
}.takeIf { unit.currentMovement > 0 && city != null && city.civInfo == unit.civInfo } // For now you can only convert your own cities
)
}
fun getImprovementConstructionActions(unit: MapUnit, tile: TileInfo): ArrayList<UnitAction> { fun getImprovementConstructionActions(unit: MapUnit, tile: TileInfo): ArrayList<UnitAction> {
val finalActions = ArrayList<UnitAction>() val finalActions = ArrayList<UnitAction>()
for (unique in unit.getMatchingUniques("Can construct []")) { var uniquesToCheck = unit.getMatchingUniques("Can construct []")
if (unit.abilityUsedCount.containsKey("Religion Spread") && unit.abilityUsedCount["Religion Spread"]!! == 0 && unit.maxReligionSpreads() > 0)
uniquesToCheck += unit.getMatchingUniques("Can construct [] if it hasn't spread religion yet")
for (unique in uniquesToCheck) {
val improvementName = unique.params[0] val improvementName = unique.params[0]
val improvement = tile.ruleset.tileImprovements[improvementName] val improvement = tile.ruleset.tileImprovements[improvementName]
if (improvement == null) continue if (improvement == null) continue

View File

@ -35,6 +35,10 @@ class UnitActionsTable(val worldScreen: WorldScreen) : Table() {
val improvementName = unitAction.getPlaceholderParameters()[0] val improvementName = unitAction.getPlaceholderParameters()[0]
return UnitIconAndKey(ImageGetter.getImprovementIcon(improvementName), 'i') return UnitIconAndKey(ImageGetter.getImprovementIcon(improvementName), 'i')
} }
unitAction.equalsPlaceholderText("Spread []") -> {
// This should later include icons for the different religions. For now, just use the great prophet icon
return UnitIconAndKey(ImageGetter.getUnitIcon("Great Prophet"), 'g')
}
unitAction.startsWith("Sleep") -> return UnitIconAndKey(ImageGetter.getImage("OtherIcons/Sleep"), 'f') unitAction.startsWith("Sleep") -> return UnitIconAndKey(ImageGetter.getImage("OtherIcons/Sleep"), 'f')
unitAction.startsWith("Fortify") -> return UnitIconAndKey(ImageGetter.getImage("OtherIcons/Shield").apply { color = Color.BLACK }, 'f') unitAction.startsWith("Fortify") -> return UnitIconAndKey(ImageGetter.getImage("OtherIcons/Shield").apply { color = Color.BLACK }, 'f')
else -> when (unitAction) { else -> when (unitAction) {

View File

@ -160,6 +160,11 @@ class UnitTable(val worldScreen: WorldScreen) : Table(){
unitDescriptionTable.add(unit.promotions.XP.toString() + "/" + unit.promotions.xpForNextPromotion()) unitDescriptionTable.add(unit.promotions.XP.toString() + "/" + unit.promotions.xpForNextPromotion())
} }
if (unit.maxReligionSpreads() > 0) {
unitDescriptionTable.add(ImageGetter.getStatIcon("Faith")).size(20f)
unitDescriptionTable.add(unit.getReligionString())
}
if (unit.promotions.promotions.size != promotionsTable.children.size) // The unit has been promoted! Reload promotions! if (unit.promotions.promotions.size != promotionsTable.children.size) // The unit has been promoted! Reload promotions!
selectedUnitHasChanged = true selectedUnitHasChanged = true
} else { // multiple selected units } else { // multiple selected units

View File

@ -128,6 +128,7 @@ Unless otherwise specified, all the following are from [the Noun Project](https:
* [Pallet](https://thenounproject.com/search/?q=Pallet&i=6862) By James Keuning for Great Artist * [Pallet](https://thenounproject.com/search/?q=Pallet&i=6862) By James Keuning for Great Artist
* [Gear](https://thenounproject.com/search/?q=Gear&i=17369) By Melvin Salas for Great Engineer * [Gear](https://thenounproject.com/search/?q=Gear&i=17369) By Melvin Salas for Great Engineer
* [Beaker](https://thenounproject.com/search/?q=Beaker&i=621510) By Delwar Hossain for Great Scientist * [Beaker](https://thenounproject.com/search/?q=Beaker&i=621510) By Delwar Hossain for Great Scientist
* [Dove](https://thenounproject.com/search/?q=dove&i=1344088) by sandra for Great Prophet*
* [General](https://thenounproject.com/search/?q=general&i=933566) By anbileru adaleru for Great General * [General](https://thenounproject.com/search/?q=general&i=933566) By anbileru adaleru for Great General
## Resources ## Resources
@ -183,6 +184,7 @@ Unless otherwise specified, all the following are from [the Noun Project](https:
### Ancient Era ### Ancient Era
* [Storehouse](https://thenounproject.com/term/storehouse/966786/) By Pedro Santos for Granary * [Storehouse](https://thenounproject.com/term/storehouse/966786/) By Pedro Santos for Granary
* [Shinto Gate](https://thenounproject.com/search/?q=shrine&i=253325) by Alexander Skowalsky for Shrine
* [Great Wall Of China](https://thenounproject.com/term/great-wall-of-china/146039/) By Arthur Shlain for Walls * [Great Wall Of China](https://thenounproject.com/term/great-wall-of-china/146039/) By Arthur Shlain for Walls
* [Markadan Tower](https://thenounproject.com/search/?q=fortification&i=2107694) by Vectors Market for Walls of Babylon * [Markadan Tower](https://thenounproject.com/search/?q=fortification&i=2107694) by Vectors Market for Walls of Babylon
* [Block](https://thenounproject.com/term/block/1711553/) By Monjin Friends for Stone Works * [Block](https://thenounproject.com/term/block/1711553/) By Monjin Friends for Stone Works