mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-04 07:17:50 +07:00
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!
This commit is contained in:
@ -191,16 +191,26 @@ object GameStarter {
|
||||
val availableCityStatesNames = Stack<String>()
|
||||
// since we shuffle and then order by, we end up with all the City-States with starting tiles first in a random order,
|
||||
// and then all the other City-States in a random order! Because the sortedBy function is stable!
|
||||
availableCityStatesNames.addAll(ruleset.nations.filter { it.value.isCityState() }.keys
|
||||
.shuffled().sortedByDescending { it in civNamesWithStartingLocations })
|
||||
availableCityStatesNames.addAll( ruleset.nations
|
||||
.filter { it.value.isCityState() && (it.value.cityStateType != CityStateType.Religious || newGameParameters.religionEnabled) }
|
||||
.keys
|
||||
.shuffled()
|
||||
.sortedByDescending { it in civNamesWithStartingLocations } )
|
||||
|
||||
|
||||
val allMercantileResources = ruleset.tileResources.values.filter { it.unique == "Can only be created by Mercantile City-States" }.map { it.name }
|
||||
val unusedMercantileResources = Stack<String>()
|
||||
unusedMercantileResources.addAll(allMercantileResources.shuffled())
|
||||
|
||||
var addedCityStates = 0
|
||||
// Keep trying to add city states until we reach the target number.
|
||||
while (addedCityStates < newGameParameters.numberOfCityStates) {
|
||||
if (availableCityStatesNames.isEmpty()) // We ran out of city-states somehow
|
||||
break
|
||||
|
||||
val cityStateName = availableCityStatesNames.pop()
|
||||
val civ = CivilizationInfo(cityStateName)
|
||||
if (civ.initCityState(ruleset, newGameParameters.startingEra, availableCivNames)) { // true if successful init
|
||||
if (civ.initCityState(ruleset, newGameParameters.startingEra, availableCivNames)) {
|
||||
gameInfo.civilizations.add(civ)
|
||||
addedCityStates++
|
||||
}
|
||||
|
@ -425,6 +425,7 @@ class CityStateFunctions(val civInfo: CivilizationInfo) {
|
||||
civInfo.cityStateType == CityStateType.Mercantile && statType == Stat.Happiness -> true
|
||||
civInfo.cityStateType == CityStateType.Cultured && statType == Stat.Culture -> true
|
||||
civInfo.cityStateType == CityStateType.Maritime && statType == Stat.Food -> true
|
||||
civInfo.cityStateType == CityStateType.Religious && statType == Stat.Faith ->true
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ enum class CityStateType(val color: String = "", val icon: String) {
|
||||
Maritime("#38ff70", "OtherIcons/Maritime"),
|
||||
Mercantile("#ffd800", "OtherIcons/Mercantile"),
|
||||
Militaristic("#ff0000", "OtherIcons/Militaristic"),
|
||||
//Religious("#FFFFFF", "OtherIcons/Religious")
|
||||
Religious("#FFFFFF", "OtherIcons/Religious")
|
||||
}
|
||||
|
||||
enum class CityStatePersonality {
|
||||
|
@ -406,9 +406,11 @@ class CivilizationInfo {
|
||||
val cityStateLocation = if (cities.isEmpty()) null else getCapital().location
|
||||
|
||||
val giftAmount = Stats(gold = 15f)
|
||||
val faithAmount = Stats(faith = 4f)
|
||||
// Later, religious city-states will also gift gold, making this the better implementation
|
||||
// For now, it might be overkill though.
|
||||
var meetString = "[${civName}] has given us [${giftAmount}] as a token of goodwill for meeting us"
|
||||
val religionMeetString = "[${civName}] has also given us [${faithAmount}]"
|
||||
if (diplomacy.filter { it.value.otherCiv().isMajorCiv() }.count() == 1) {
|
||||
giftAmount.timesInPlace(2f)
|
||||
meetString = "[${civName}] has given us [${giftAmount}] as we are the first major civ to meet them"
|
||||
@ -418,6 +420,12 @@ class CivilizationInfo {
|
||||
else
|
||||
otherCiv.addNotification(meetString, NotificationIcon.Gold)
|
||||
|
||||
if (otherCiv.isCityState() && otherCiv.canGiveStat(Stat.Faith)){
|
||||
otherCiv.addNotification(religionMeetString, NotificationIcon.Faith)
|
||||
|
||||
for ((key, value) in faithAmount)
|
||||
otherCiv.addStat(key, value.toInt())
|
||||
}
|
||||
for ((key, value) in giftAmount)
|
||||
otherCiv.addStat(key, value.toInt())
|
||||
}
|
||||
|
@ -1,9 +1,11 @@
|
||||
package com.unciv.logic.civilization
|
||||
|
||||
import com.unciv.logic.civilization.diplomacy.RelationshipLevel
|
||||
import com.unciv.logic.map.MapUnit
|
||||
import com.unciv.models.Religion
|
||||
import com.unciv.models.ruleset.Belief
|
||||
import com.unciv.models.ruleset.BeliefType
|
||||
import com.unciv.models.ruleset.Era
|
||||
import com.unciv.ui.pickerscreens.BeliefContainer
|
||||
import com.unciv.ui.utils.toPercent
|
||||
import kotlin.random.Random
|
||||
|
Reference in New Issue
Block a user