mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-22 02:42:16 -04:00
chore: renames
This commit is contained in:
parent
c3a4a18bba
commit
fc22f0900b
@ -41,7 +41,7 @@ object ReligionAutomation {
|
||||
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() >
|
||||
4 * civInfo.units.getCivUnits().count { it.canDoReligiousAction(Constants.spreadReligion) || it.canDoReligiousAction(Constants.removeHeresy) }
|
||||
4 * civInfo.units.getCivUnits().count { it.canDoLimitedAction(Constants.spreadReligion) || it.canDoLimitedAction(Constants.removeHeresy) }
|
||||
) {
|
||||
val (city, pressureDifference) = citiesWithoutOurReligion.map { city ->
|
||||
city to city.religion.getPressureDeficit(civInfo.religionManager.religion?.name)
|
||||
@ -77,7 +77,7 @@ object ReligionAutomation {
|
||||
// Todo: buy Great People post industrial era
|
||||
|
||||
// Just buy missionaries to spread our religion outside of our civ
|
||||
if (civInfo.units.getCivUnits().count { it.canDoReligiousAction(Constants.spreadReligion) } < 4) {
|
||||
if (civInfo.units.getCivUnits().count { it.canDoLimitedAction(Constants.spreadReligion) } < 4) {
|
||||
buyMissionaryInAnyCity(civInfo)
|
||||
return
|
||||
}
|
||||
@ -160,7 +160,7 @@ object ReligionAutomation {
|
||||
private fun buyInquisitorNear(civInfo: Civilization, city: City) {
|
||||
if (civInfo.religionManager.religionState < ReligionState.Religion) return
|
||||
var inquisitors = civInfo.gameInfo.ruleset.units.values.filter {
|
||||
it.getMapUnit(civInfo).canDoReligiousAction(Constants.removeHeresy)
|
||||
it.getMapUnit(civInfo).canDoLimitedAction(Constants.removeHeresy)
|
||||
|| it.hasUnique(UniqueType.PreventSpreadingReligion)
|
||||
}
|
||||
|
||||
|
@ -366,7 +366,7 @@ object SpecificUnitAutomation {
|
||||
&& (cityToConvert == holyCity
|
||||
|| pressureDeficit > Constants.aiPreferInquisitorOverMissionaryPressureDifference
|
||||
|| cityToConvert.religion.isBlockedHolyCity && cityToConvert.religion.religionThisIsTheHolyCityOf == civReligion?.name
|
||||
) && unit.canDoReligiousAction(Constants.removeHeresy) -> {
|
||||
) && unit.canDoLimitedAction(Constants.removeHeresy) -> {
|
||||
cityToConvert.getCenterTile()
|
||||
}
|
||||
cityToProtect != null && unit.hasUnique(UniqueType.PreventSpreadingReligion) -> {
|
||||
@ -398,7 +398,7 @@ object SpecificUnitAutomation {
|
||||
private fun determineBestInquisitorCityToConvert(
|
||||
unit: MapUnit,
|
||||
): City? {
|
||||
if (unit.religion != unit.civ.religionManager.religion?.name || !unit.canDoReligiousAction(Constants.removeHeresy))
|
||||
if (unit.religion != unit.civ.religionManager.religion?.name || !unit.canDoLimitedAction(Constants.removeHeresy))
|
||||
return null
|
||||
|
||||
val holyCity = unit.civ.religionManager.getHolyCity()
|
||||
|
@ -259,7 +259,7 @@ object UnitAutomation {
|
||||
if (unit.civ.religionManager.maySpreadReligionAtAll(unit))
|
||||
return SpecificUnitAutomation.automateMissionary(unit)
|
||||
|
||||
if (unit.hasUnique(UniqueType.PreventSpreadingReligion) || unit.canDoReligiousAction(Constants.removeHeresy))
|
||||
if (unit.hasUnique(UniqueType.PreventSpreadingReligion) || unit.canDoLimitedAction(Constants.removeHeresy))
|
||||
return SpecificUnitAutomation.automateInquisitor(unit)
|
||||
|
||||
if (unit.hasUnique(UniqueType.ConstructImprovementConsumingUnit)
|
||||
|
@ -405,7 +405,7 @@ class ReligionManager : IsPartOfGameInfoSerialization {
|
||||
fun maySpreadReligionAtAll(missionary: MapUnit): Boolean {
|
||||
if (!civInfo.isMajorCiv()) return false // Only major civs
|
||||
if (!civInfo.gameInfo.isReligionEnabled()) return false // No religion, no spreading
|
||||
if (!missionary.canDoReligiousAction(Constants.spreadReligion)) return false
|
||||
if (!missionary.canDoLimitedAction(Constants.spreadReligion)) return false
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -815,12 +815,12 @@ class MapUnit : IsPartOfGameInfoSerialization {
|
||||
return civ.gameInfo.religions[religion]!!.getReligionDisplayName()
|
||||
}
|
||||
|
||||
fun religiousActionsUnitCanDo(): Sequence<String> {
|
||||
fun limitedActionsUnitCanDo(): Sequence<String> {
|
||||
return getMatchingUniques(UniqueType.CanActionSeveralTimes)
|
||||
.map { it.params[0] }
|
||||
}
|
||||
|
||||
fun canDoReligiousAction(action: String): Boolean {
|
||||
fun canDoLimitedAction(action: String): Boolean {
|
||||
return getMatchingUniques(UniqueType.CanActionSeveralTimes).any { it.params[0] == action }
|
||||
}
|
||||
|
||||
@ -833,7 +833,7 @@ class MapUnit : IsPartOfGameInfoSerialization {
|
||||
}
|
||||
|
||||
fun setupAbilityUses(buildCity: City? = null) {
|
||||
for (action in religiousActionsUnitCanDo()) {
|
||||
for (action in limitedActionsUnitCanDo()) {
|
||||
val baseAmount = getBaseMaxActionUses(action)
|
||||
val additional =
|
||||
if (buildCity == null) 0
|
||||
|
@ -227,7 +227,7 @@ class Unique(val text: String, val sourceObjectType: UniqueTarget? = null, val s
|
||||
state.ourCombatant != null && state.ourCombatant.getHealth() < condition.params[0].toInt()
|
||||
UniqueType.ConditionalHasNotUsedOtherActions ->
|
||||
state.unit != null &&
|
||||
state.unit.run { religiousActionsUnitCanDo().all { abilityUsesLeft[it] == maxAbilityUses[it] } }
|
||||
state.unit.run { limitedActionsUnitCanDo().all { abilityUsesLeft[it] == maxAbilityUses[it] } }
|
||||
|
||||
UniqueType.ConditionalInTiles ->
|
||||
relevantTile?.matchesFilter(condition.params[0], state.civInfo) == true
|
||||
|
@ -360,8 +360,6 @@ enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags:
|
||||
MayFoundReligion("May found a religion", UniqueTarget.Unit),
|
||||
MayEnhanceReligion("May enhance a religion", UniqueTarget.Unit),
|
||||
|
||||
|
||||
|
||||
@Deprecated("as of 4.5.3", ReplaceWith("Empire enters a [amount]-turn Golden Age <by consuming this unit>"))
|
||||
StartGoldenAge("Can start an [amount]-turn golden age", UniqueTarget.Unit),
|
||||
AddInCapital("Can be added to [comment] in the Capital", UniqueTarget.Unit),
|
||||
@ -511,6 +509,7 @@ enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags:
|
||||
|
||||
UnitActionConsumeUnit("by consuming this unit", UniqueTarget.UnitActionModifier),
|
||||
UnitActionMovementCost("for [amount] movement", UniqueTarget.UnitActionModifier),
|
||||
UnitActionLimitedTimes("[amount] times", UniqueTarget.UnitActionModifier),
|
||||
|
||||
// endregion
|
||||
|
||||
|
@ -201,12 +201,12 @@ class UnitTable(val worldScreen: WorldScreen) : Table() {
|
||||
unitDescriptionTable.add(unit.promotions.XP.toString() + "/" + unit.promotions.xpForNextPromotion())
|
||||
}
|
||||
|
||||
if (unit.canDoReligiousAction(Constants.spreadReligion)) {
|
||||
if (unit.canDoLimitedAction(Constants.spreadReligion)) {
|
||||
unitDescriptionTable.add(ImageGetter.getStatIcon("Faith")).size(20f)
|
||||
unitDescriptionTable.add(unit.getActionString(Constants.spreadReligion))
|
||||
}
|
||||
|
||||
if (unit.canDoReligiousAction(Constants.removeHeresy)) {
|
||||
if (unit.canDoLimitedAction(Constants.removeHeresy)) {
|
||||
unitDescriptionTable.add(ImageGetter.getImage("OtherIcons/Remove Heresy")).size(20f)
|
||||
unitDescriptionTable.add(unit.getActionString(Constants.removeHeresy))
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ object UnitActionsReligion {
|
||||
|
||||
fun addActionsWithLimitedUses(unit: MapUnit, actionList: ArrayList<UnitAction>, tile: Tile) {
|
||||
|
||||
val actionsToAdd = unit.religiousActionsUnitCanDo()
|
||||
val actionsToAdd = unit.limitedActionsUnitCanDo()
|
||||
if (actionsToAdd.none()) return
|
||||
if (unit.religion == null || unit.civ.gameInfo.religions[unit.religion]!!.isPantheon()) return
|
||||
val city = tile.getCity() ?: return
|
||||
|
Loading…
x
Reference in New Issue
Block a user