mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-06 16:28:40 +07:00
Fixed ruins having two faith bonuses that could apply at the same time (#5545)
* Fixed ruins having two faith bonuses that could apply at the same time * Added turn restrictions on ruins
This commit is contained in:
@ -20,7 +20,7 @@
|
||||
{
|
||||
"name": "your exploring unit receives training",
|
||||
"notification": "An ancient tribe trained us in their ways of combat!",
|
||||
"uniques": ["This Unit gains [10] XP"]
|
||||
"uniques": ["This Unit gains [10] XP", "Only available after [10] turns"]
|
||||
},
|
||||
{
|
||||
"name": "survivors (adds population to a city)",
|
||||
@ -58,13 +58,13 @@
|
||||
{
|
||||
"name": "discover holy symbols",
|
||||
"notification": "We have found holy symbols in the ruins, giving us a deeper understanding of religion! (+[faithAmount] Faith)",
|
||||
"uniques": ["Hidden when religion is disabled", "Gain enough Faith for a Pantheon"],
|
||||
"uniques": ["Hidden when religion is disabled", "Gain enough Faith for a Pantheon", "Hidden after founding a Pantheon", "Only available after [20] turns"],
|
||||
"color": "#CDDDF4"
|
||||
},
|
||||
{
|
||||
"name": "an ancient prophecy",
|
||||
"notification": "We have found an ancient prophecy in the ruins, greatly increasing our spiritual connection! (+[faithAmount] Faith)",
|
||||
"uniques": ["Hidden when religion is disabled", "Gain enough Faith for [33]% of a Great Prophet", "Hidden after generating a Great Prophet"],
|
||||
"uniques": ["Hidden when religion is disabled", "Gain enough Faith for [33]% of a Great Prophet", "Hidden after generating a Great Prophet", "Hidden before founding a Pantheon", "Only available after [20] turns"],
|
||||
"color": "#CDDDF4"
|
||||
}
|
||||
]
|
@ -2,8 +2,10 @@ package com.unciv.logic.civilization.RuinsManager
|
||||
|
||||
import com.unciv.Constants
|
||||
import com.unciv.logic.civilization.CivilizationInfo
|
||||
import com.unciv.logic.civilization.ReligionState
|
||||
import com.unciv.logic.map.MapUnit
|
||||
import com.unciv.models.ruleset.RuinReward
|
||||
import com.unciv.models.ruleset.unique.Unique
|
||||
import com.unciv.models.ruleset.unique.UniqueTriggerActivation
|
||||
import com.unciv.models.ruleset.unique.UniqueType
|
||||
import kotlin.random.Random
|
||||
@ -43,13 +45,15 @@ class RuinsManager {
|
||||
for (possibleReward in possibleRewards) {
|
||||
if (civInfo.gameInfo.difficulty in possibleReward.excludedDifficulties) continue
|
||||
if (possibleReward.hasUnique(UniqueType.HiddenWithoutReligion) && !civInfo.gameInfo.isReligionEnabled()) continue
|
||||
if ("Hidden after generating a Great Prophet" in possibleReward.uniques
|
||||
if (possibleReward.hasUnique(UniqueType.HiddenAfterGreatProphet)
|
||||
&& civInfo.civConstructions.boughtItemsWithIncreasingPrice[civInfo.religionManager.getGreatProphetEquivalent()] ?: 0 > 0
|
||||
) continue
|
||||
if (possibleReward.uniqueObjects.any { unique ->
|
||||
unique.placeholderText == "Only available after [] turns"
|
||||
&& unique.params[0].toInt() < civInfo.gameInfo.turns
|
||||
}) continue
|
||||
if (possibleReward.hasUnique(UniqueType.HiddenAfterPantheon) && civInfo.religionManager.religionState >= ReligionState.Pantheon)
|
||||
continue
|
||||
if (possibleReward.hasUnique(UniqueType.HiddenBeforePantheon) && civInfo.religionManager.religionState == ReligionState.None)
|
||||
continue
|
||||
if (possibleReward.getMatchingUniques(UniqueType.AvailableAfterCertainTurns).any { it.params[0].toInt() < civInfo.gameInfo.turns })
|
||||
continue
|
||||
|
||||
var atLeastOneUniqueHadEffect = false
|
||||
for (unique in possibleReward.uniqueObjects) {
|
||||
|
@ -265,8 +265,6 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget) {
|
||||
CannotEnterOcean("Cannot enter ocean tiles", UniqueTarget.Unit),
|
||||
CannotEnterOceanUntilAstronomy("Cannot enter ocean tiles until Astronomy", UniqueTarget.Unit),
|
||||
|
||||
HiddenWithoutReligion("Hidden when religion is disabled", UniqueTarget.Unit, UniqueTarget.Building, UniqueTarget.Ruins),
|
||||
|
||||
///////////////////////////////////////// TILE UNIQUES /////////////////////////////////////////
|
||||
|
||||
|
||||
@ -408,6 +406,15 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget) {
|
||||
TimedAttackStrength("+[amount]% attack strength to all [mapUnitFilter] Units for [amount] turns", UniqueTarget.Global), // used in Policy
|
||||
FreeStatBuildings("Provides the cheapest [stat] building in your first [amount] cities for free", UniqueTarget.Global), // used in Policy
|
||||
FreeSpecificBuildings("Provides a [buildingName] in your first [amount] cities for free", UniqueTarget.Global), // used in Policy
|
||||
|
||||
///////////////////////////////////////////// META /////////////////////////////////////////////
|
||||
|
||||
|
||||
HiddenWithoutReligion("Hidden when religion is disabled", UniqueTarget.Unit, UniqueTarget.Building, UniqueTarget.Ruins),
|
||||
HiddenBeforePantheon("Hidden before founding a Pantheon", UniqueTarget.Ruins),
|
||||
HiddenAfterPantheon("Hidden after founding a Pantheon", UniqueTarget.Ruins),
|
||||
HiddenAfterGreatProphet("Hidden after generating a Great Prophet", UniqueTarget.Ruins),
|
||||
AvailableAfterCertainTurns("Only available after [amount] turns", UniqueTarget.Ruins),
|
||||
;
|
||||
|
||||
/** For uniques that have "special" parameters that can accept multiple types, we can override them manually
|
||||
|
Reference in New Issue
Block a user