Skip to content

Check the ruler faith's Clerical Gender doctrine before appointing court chaplain #2134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading