Skip to content

Commit

Permalink
Check the ruler faith's Clerical Gender doctrine before appointing co…
Browse files Browse the repository at this point in the history
…urt chaplain (#2134)
  • Loading branch information
IhateTrains authored Sep 3, 2024
1 parent 2d0e0ef commit 0b64c57
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions ImperatorToCK3/CK3/Titles/Title.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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) {
Expand Down

0 comments on commit 0b64c57

Please sign in to comment.