mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-08 23:08:35 +07:00
Added religion triggers
This commit is contained in:
@ -8,6 +8,7 @@ import com.unciv.models.Counter
|
|||||||
import com.unciv.models.Religion
|
import com.unciv.models.Religion
|
||||||
import com.unciv.models.ruleset.Belief
|
import com.unciv.models.ruleset.Belief
|
||||||
import com.unciv.models.ruleset.BeliefType
|
import com.unciv.models.ruleset.BeliefType
|
||||||
|
import com.unciv.models.ruleset.unique.UniqueTriggerActivation
|
||||||
import com.unciv.models.ruleset.unique.UniqueType
|
import com.unciv.models.ruleset.unique.UniqueType
|
||||||
import com.unciv.ui.utils.extensions.toPercent
|
import com.unciv.ui.utils.extensions.toPercent
|
||||||
import java.lang.Integer.max
|
import java.lang.Integer.max
|
||||||
@ -132,6 +133,9 @@ class ReligionManager : IsPartOfGameInfoSerialization {
|
|||||||
for (city in civInfo.cities)
|
for (city in civInfo.cities)
|
||||||
city.religion.addPressure(beliefName, 200 * city.population.population)
|
city.religion.addPressure(beliefName, 200 * city.population.population)
|
||||||
religionState = ReligionState.Pantheon
|
religionState = ReligionState.Pantheon
|
||||||
|
|
||||||
|
for (unique in civInfo.getTriggeredUniques(UniqueType.TriggerUponFoundingPantheon))
|
||||||
|
UniqueTriggerActivation.triggerCivwideUnique(unique, civInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.reddit.com/r/civ/comments/2m82wu/can_anyone_detail_the_finer_points_of_great/
|
// https://www.reddit.com/r/civ/comments/2m82wu/can_anyone_detail_the_finer_points_of_great/
|
||||||
@ -238,11 +242,14 @@ class ReligionManager : IsPartOfGameInfoSerialization {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
fun useProphetForFoundingReligion(prophet: MapUnit) {
|
fun foundReligion(prophet: MapUnit) {
|
||||||
if (!mayFoundReligionNow(prophet)) return // How did you do this?
|
if (!mayFoundReligionNow(prophet)) return // How did you do this?
|
||||||
if (religionState == ReligionState.None) shouldChoosePantheonBelief = true
|
if (religionState == ReligionState.None) shouldChoosePantheonBelief = true
|
||||||
religionState = ReligionState.FoundingReligion
|
religionState = ReligionState.FoundingReligion
|
||||||
civInfo.religionManager.foundingCityId = prophet.getTile().getCity()!!.id
|
civInfo.religionManager.foundingCityId = prophet.getTile().getCity()!!.id
|
||||||
|
|
||||||
|
for (unique in civInfo.getTriggeredUniques(UniqueType.TriggerUponFoundingReligion))
|
||||||
|
UniqueTriggerActivation.triggerCivwideUnique(unique, civInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -303,8 +310,11 @@ class ReligionManager : IsPartOfGameInfoSerialization {
|
|||||||
when (religionState) {
|
when (religionState) {
|
||||||
ReligionState.FoundingReligion ->
|
ReligionState.FoundingReligion ->
|
||||||
foundReligion(iconName!!, religionName!!)
|
foundReligion(iconName!!, religionName!!)
|
||||||
ReligionState.EnhancingReligion ->
|
ReligionState.EnhancingReligion -> {
|
||||||
religionState = ReligionState.EnhancedReligion
|
religionState = ReligionState.EnhancedReligion
|
||||||
|
for (unique in civInfo.getTriggeredUniques(UniqueType.TriggerUponEnhancingReligion))
|
||||||
|
UniqueTriggerActivation.triggerCivwideUnique(unique, civInfo)
|
||||||
|
}
|
||||||
ReligionState.None -> {
|
ReligionState.None -> {
|
||||||
foundPantheon(beliefs[0].name, useFreeBeliefs)
|
foundPantheon(beliefs[0].name, useFreeBeliefs)
|
||||||
}
|
}
|
||||||
|
@ -707,6 +707,11 @@ enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags:
|
|||||||
TriggerUponConqueringCity("upon conquering a city", UniqueTarget.TriggerCondition),
|
TriggerUponConqueringCity("upon conquering a city", UniqueTarget.TriggerCondition),
|
||||||
TriggerUponConstructingBuilding("upon constructing [buildingFilter]", UniqueTarget.TriggerCondition),
|
TriggerUponConstructingBuilding("upon constructing [buildingFilter]", UniqueTarget.TriggerCondition),
|
||||||
|
|
||||||
|
TriggerUponFoundingPantheon("upon founding a Pantheon", UniqueTarget.TriggerCondition),
|
||||||
|
TriggerUponFoundingReligion("upon founding a Religion", UniqueTarget.TriggerCondition),
|
||||||
|
TriggerUponEnhancingReligion("upon enahncing a Religion", UniqueTarget.TriggerCondition),
|
||||||
|
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
///////////////////////////////////////////// region META /////////////////////////////////////////////
|
///////////////////////////////////////////// region META /////////////////////////////////////////////
|
||||||
|
@ -727,7 +727,7 @@ object UnitActions {
|
|||||||
|
|
||||||
fun getFoundReligionAction(unit: MapUnit): () -> Unit {
|
fun getFoundReligionAction(unit: MapUnit): () -> Unit {
|
||||||
return {
|
return {
|
||||||
unit.civInfo.religionManager.useProphetForFoundingReligion(unit)
|
unit.civInfo.religionManager.foundReligion(unit)
|
||||||
unit.consume()
|
unit.consume()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user