Hi
@Gleb Bazov (and everyone else), thanks for taking the time to answer. Broadly, I'm trying to recreate the effects of the Papal Primacy belief, but as part of a Leader Ability for a new leader I'm making instead of a belief. Papal Primacy reads: 'Type bonuses from city-states following your Religion are 50% more powerful.' This means that the bonuses you get from sending envoys (+2 science in the capital, +2 science in all campus districts, etc) are half again as effective (total of +3 science in the capital, and +3 science in all campus districts, etc).
More thoroughly, Papal Primacy's effects aren't implemented in the same manner as most other beliefs. In particular, instead of having attached modifiers in the BeliefModifiers table, it has its related modifiers in the TraitModifiers table for the City State leaders. Here is the relevant code, only for scientific CSes, to save space (from Leaders.xml):
Code:
<TraitModifiers>
<Row TraitType="MINOR_CIV_SCIENTIFIC_TRAIT" ModifierId="MINOR_CIV_SCIENTIFIC_SMALL_INFLUENCE_BONUS_PAPAL_PRIMACY"/>
<Row TraitType="MINOR_CIV_SCIENTIFIC_TRAIT" ModifierId="MINOR_CIV_SCIENTIFIC_MEDIUM_INFLUENCE_BONUS_PAPAL_PRIMACY"/>
<Row TraitType="MINOR_CIV_SCIENTIFIC_TRAIT" ModifierId="MINOR_CIV_SCIENTIFIC_LARGE_INFLUENCE_BONUS_PAPAL_PRIMACY"/>
</TraitModifiers>
<Modifiers>
<Row>
<ModifierId>MINOR_CIV_SCIENTIFIC_SMALL_INFLUENCE_BONUS_PAPAL_PRIMACY</ModifierId>
<ModifierType>MODIFIER_ALL_PLAYERS_ATTACH_MODIFIER</ModifierType>
<SubjectRequirementSetId>PLAYER_HAS_SMALL_INFLUENCE_AND_PAPAL_PRIMACY</SubjectRequirementSetId>
</Row>
<Row>
<ModifierId>MINOR_CIV_SCIENTIFIC_MEDIUM_INFLUENCE_BONUS_PAPAL_PRIMACY</ModifierId>
<ModifierType>MODIFIER_ALL_PLAYERS_ATTACH_MODIFIER</ModifierType>
<SubjectRequirementSetId>PLAYER_HAS_MEDIUM_INFLUENCE_AND_PAPAL_PRIMACY</SubjectRequirementSetId>
</Row>
<Row>
<ModifierId>MINOR_CIV_SCIENTIFIC_LARGE_INFLUENCE_BONUS_PAPAL_PRIMACY</ModifierId>
<ModifierType>MODIFIER_ALL_PLAYERS_ATTACH_MODIFIER</ModifierType>
<SubjectRequirementSetId>PLAYER_HAS_LARGE_INFLUENCE_AND_PAPAL_PRIMACY</SubjectRequirementSetId>
</Row>
<Row>
<ModifierId>MINOR_CIV_SCIENTIFIC_YIELD_FOR_CAPITAL_PAPAL_PRIMACY</ModifierId>
<ModifierType>MODIFIER_PLAYER_CAPITAL_CITY_ADJUST_CITY_YIELD_CHANGE</ModifierType>
</Row>
<Row>
<ModifierId>MINOR_CIV_SCIENTIFIC_YIELD_FOR_CAMPUS_PAPAL_PRIMACY</ModifierId>
<ModifierType>MODIFIER_PLAYER_DISTRICTS_ADJUST_YIELD_CHANGE</ModifierType>
<SubjectRequirementSetId>DISTRICT_IS_CAMPUS</SubjectRequirementSetId>
</Row>
</Modifiers>
<ModifierArguments>
<Row>
<ModifierId>MINOR_CIV_SCIENTIFIC_SMALL_INFLUENCE_BONUS_PAPAL_PRIMACY</ModifierId>
<Name>ModifierId</Name>
<Value>MINOR_CIV_SCIENTIFIC_YIELD_FOR_CAPITAL_PAPAL_PRIMACY</Value>
</Row>
<Row>
<ModifierId>MINOR_CIV_SCIENTIFIC_MEDIUM_INFLUENCE_BONUS_PAPAL_PRIMACY</ModifierId>
<Name>ModifierId</Name>
<Value>MINOR_CIV_SCIENTIFIC_YIELD_FOR_CAMPUS_PAPAL_PRIMACY</Value>
</Row>
<Row>
<ModifierId>MINOR_CIV_SCIENTIFIC_LARGE_INFLUENCE_BONUS_PAPAL_PRIMACY</ModifierId>
<Name>ModifierId</Name>
<Value>MINOR_CIV_SCIENTIFIC_YIELD_FOR_CAMPUS_PAPAL_PRIMACY</Value>
</Row>
<Row>
<ModifierId>MINOR_CIV_SCIENTIFIC_YIELD_FOR_CAPITAL_PAPAL_PRIMACY</ModifierId>
<Name>YieldType</Name>
<Value>YIELD_SCIENCE</Value>
</Row>
<Row>
<ModifierId>MINOR_CIV_SCIENTIFIC_YIELD_FOR_CAPITAL_PAPAL_PRIMACY</ModifierId>
<Name>Amount</Name>
<Value>1</Value>
</Row>
<Row>
<ModifierId>MINOR_CIV_SCIENTIFIC_YIELD_FOR_CAMPUS_PAPAL_PRIMACY</ModifierId>
<Name>YieldType</Name>
<Value>YIELD_SCIENCE</Value>
</Row>
<Row>
<ModifierId>MINOR_CIV_SCIENTIFIC_YIELD_FOR_CAMPUS_PAPAL_PRIMACY</ModifierId>
<Name>Amount</Name>
<Value>1</Value>
</Row>
</ModifierArguments>
<RequirementSets>
<Row>
<RequirementSetId>PLAYER_HAS_SMALL_INFLUENCE_AND_PAPAL_PRIMACY</RequirementSetId>
<RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>
</Row>
<Row>
<RequirementSetId>PLAYER_HAS_MEDIUM_INFLUENCE_AND_PAPAL_PRIMACY</RequirementSetId>
<RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>
</Row>
<Row>
<RequirementSetId>PLAYER_HAS_LARGE_INFLUENCE_AND_PAPAL_PRIMACY</RequirementSetId>
<RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>
</Row>
</RequirementSets>
<RequirementSetRequirements>
<Row>
<RequirementSetId>PLAYER_HAS_SMALL_INFLUENCE_AND_PAPAL_PRIMACY</RequirementSetId>
<RequirementId>REQUIRES_PLAYER_HAS_SMALL_INFLUENCE</RequirementId>
</Row>
<Row>
<RequirementSetId>PLAYER_HAS_SMALL_INFLUENCE_AND_PAPAL_PRIMACY</RequirementSetId>
<RequirementId>REQUIRES_PLAYER_AT_PEACE</RequirementId>
</Row>
<Row>
<RequirementSetId>PLAYER_HAS_SMALL_INFLUENCE_AND_PAPAL_PRIMACY</RequirementSetId>
<RequirementId>REQUIRES_PLAYER_FOUNDED_OUR_RELIGION</RequirementId>
</Row>
<Row>
<RequirementSetId>PLAYER_HAS_SMALL_INFLUENCE_AND_PAPAL_PRIMACY</RequirementSetId>
<RequirementId>REQUIRES_PLAYER_HAS_PAPAL_PRIMACY</RequirementId>
</Row>
<Row>
<RequirementSetId>PLAYER_HAS_MEDIUM_INFLUENCE_AND_PAPAL_PRIMACY</RequirementSetId>
<RequirementId>REQUIRES_PLAYER_HAS_MEDIUM_INFLUENCE</RequirementId>
</Row>
<Row>
<RequirementSetId>PLAYER_HAS_MEDIUM_INFLUENCE_AND_PAPAL_PRIMACY</RequirementSetId>
<RequirementId>REQUIRES_PLAYER_AT_PEACE</RequirementId>
</Row>
<Row>
<RequirementSetId>PLAYER_HAS_MEDIUM_INFLUENCE_AND_PAPAL_PRIMACY</RequirementSetId>
<RequirementId>REQUIRES_PLAYER_FOUNDED_OUR_RELIGION</RequirementId>
</Row>
<Row>
<RequirementSetId>PLAYER_HAS_MEDIUM_INFLUENCE_AND_PAPAL_PRIMACY</RequirementSetId>
<RequirementId>REQUIRES_PLAYER_HAS_PAPAL_PRIMACY</RequirementId>
</Row>
<Row>
<RequirementSetId>PLAYER_HAS_LARGE_INFLUENCE_AND_PAPAL_PRIMACY</RequirementSetId>
<RequirementId>REQUIRES_PLAYER_HAS_LARGE_INFLUENCE</RequirementId>
</Row>
<Row>
<RequirementSetId>PLAYER_HAS_LARGE_INFLUENCE_AND_PAPAL_PRIMACY</RequirementSetId>
<RequirementId>REQUIRES_PLAYER_AT_PEACE</RequirementId>
</Row>
<Row>
<RequirementSetId>PLAYER_HAS_LARGE_INFLUENCE_AND_PAPAL_PRIMACY</RequirementSetId>
<RequirementId>REQUIRES_PLAYER_FOUNDED_OUR_RELIGION</RequirementId>
</Row>
<Row>
<RequirementSetId>PLAYER_HAS_LARGE_INFLUENCE_AND_PAPAL_PRIMACY</RequirementSetId>
<RequirementId>REQUIRES_PLAYER_HAS_PAPAL_PRIMACY</RequirementId>
</Row>
</RequirementSetRequirements>
So, there are 3 modifiers attached to the City States' leaders' traits, one for the 1 envoy bonus, one for the 3 envoy bonus, and one for the 6 envoy bonus. These modifiers' collection is ALL players, but per the requirements they only affect players who have the requisite number of envoys, are at peace with the city state, and who have founded the religion that the CS has, as long as said religion has the Papal Primacy belief. Once the requirements are met, the modifiers attach a new modifier to the PLAYER entity, which grants the proper yield either to their capital or their cities (as long as the city has the requisite district). The modifier types are very simple, but it's the requirements that I need more than anything.
In its simplest form, my idea would be essentially to copy the code above, but replace the requirements PLAYER_FOUNDED_OUR_RELIGION and PLAYER_HAS_PAPAL_PRIMACY with whatever requirements would allow me to identify a single leader type (or even civilization type at this point, I'm not that picky). This seems impossible to do simply, but there might be some workarounds.
If I created a dummy tech or civic and granted it to the player (perhaps via lua?), then I can make a requirement to check for that. Though, I'd likely have to use lua to grant the tech, and I'd have to make sure that there's no way other players can get it, potentially through a later starting era or some AI trickery.
If I created a dummy building and granted it to every city that the leader owns, I could make a requirement to check for that (though on the modifers that get attached to the Player instead). Though, I'd have to make sure that it can only exist in the player's cities, and, for example, doesn't stay when the city is captured by another player; perhaps by making it a leader trait building and not setting an entry in the BuildingReplaces table.
Beyond one of those, I can't really see any way, outside of maybe just doing 90% of it in lua, to achieve the effect. The 2 requirements I need from the code above are PLAYER_HAS_X_INFLUENCE and PLAYER_AT_PEACE, and those I believe have to come from a modifier attached to the City State to function correctly, or at all.