diff --git a/ImperatorToCK3/CK3/Titles/Title.cs b/ImperatorToCK3/CK3/Titles/Title.cs index 0d133ff79..8d9c7319e 100644 --- a/ImperatorToCK3/CK3/Titles/Title.cs +++ b/ImperatorToCK3/CK3/Titles/Title.cs @@ -1357,10 +1357,13 @@ private void AppointCouncilMembersFromImperator(ReligionCollection religionColle if (rulerFaithId is null || rulerFaithId != ck3Official.GetFaithId(bookmarkDate)) { continue; } - + // If the faith has Disallowed Clerical Marriage, don't allow married court chaplains. var rulerFaith = religionCollection.GetFaith(rulerFaithId); - if (rulerFaith?.HasDoctrine("doctrine_clerical_marriage_disallowed") == true) { + if (rulerFaith is null) { + continue; + } + if (rulerFaith.HasDoctrine("doctrine_clerical_marriage_disallowed")) { if (ck3Official.GetSpouseIds(bookmarkDate).Count > 0) { continue; } @@ -1369,11 +1372,22 @@ private void AppointCouncilMembersFromImperator(ReligionCollection religionColle // If the court faith has doctrine_theocracy_temporal (Theocratic Clerical Tradition), the court chaplain should // be either theocratic or landless. // For the purpose of the conversion, we simply require them to be landless. - if (rulerFaith?.HasDoctrine("doctrine_theocracy_temporal") == true) { + if (rulerFaith.HasDoctrine("doctrine_theocracy_temporal")) { if (heldTitlesCount > 0) { continue; } } + + // Skip if the faith doesn't allow the character's gender to be clergy. + var clerigalGenderDoctrine = rulerFaith.GetDoctrineIdForDoctrineCategoryId("doctrine_clerical_gender"); + if (clerigalGenderDoctrine is not null) { + if (clerigalGenderDoctrine == "doctrine_clerical_gender_female_only" && !ck3Official.Female) { + continue; + } + if (clerigalGenderDoctrine == "doctrine_clerical_gender_male_only" && ck3Official.Female) { + continue; + } + } } else if (ck3Position == "councillor_steward" || ck3Position == "councillor_chancellor" || ck3Position == "councillor_marshal") { // Unless they are rulers, stewards, chancellors and marshals need to have the dominant gender of the faith. if (heldTitlesCount == 0) {