﻿## Vanilla doctrines ##
doctrine_monogamy = {
	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { has_doctrine = doctrine_monogamy }
			multiply = faith_unchanged_doctrine_cost_mult
		}

		# Harem Politics
		if = {
			limit = { 
				OR = {
					has_doctrine = doctrine_polygamy
					has_doctrine = doctrine_polygamy_4
				}
			}
			multiply = faith_changed_doctrine_cost_mult_point_five_step 
		}
		if = {
			limit = { 
				has_doctrine = doctrine_polygamy_10
			}
			multiply = faith_changed_doctrine_cost_mult_one_step 
		}
		if = {
			limit = { 
				has_doctrine = doctrine_polygamy_15
			}
			multiply = faith_changed_doctrine_cost_mult_one_point_five_step 
		}
		if = {
			limit = { 
				has_doctrine = doctrine_polygamy_25
			}
			multiply = faith_changed_doctrine_cost_mult_two_step 
		}
		if = {
			limit = { 
				has_doctrine = doctrine_polygamy_50
			}
			multiply = faith_changed_doctrine_cost_mult_two_point_five_step 
		}
		if = {
			limit = { 
				has_doctrine = doctrine_polygamy_100
			}
			multiply = faith_changed_doctrine_cost_mult_three_step 
		}
	}
	parameters = {
		number_of_spouses = 1
	}
}

doctrine_polygamy = {
	is_shown = {
		always = no
	}
	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = {
				OR = {
					has_doctrine = doctrine_polygamy
					has_doctrine = doctrine_polygamy_4
				}
			}
			multiply = faith_unchanged_doctrine_cost_mult
		}

		# Harem Politics
		if = {
			limit = { 
				OR = {
					has_doctrine = doctrine_monogamy
					has_doctrine = doctrine_polygamy_10
				}
			}
			multiply = faith_changed_doctrine_cost_mult_point_five_step 
		}
		if = {
			limit = { 
				has_doctrine = doctrine_polygamy_15
			}
			multiply = faith_changed_doctrine_cost_mult_one_step 
		}

		if = {
			limit = { 
				has_doctrine = doctrine_polygamy_25
			}
			multiply = faith_changed_doctrine_cost_mult_one_point_five_step 
		}
		if = {
			limit = { 
				has_doctrine = doctrine_polygamy_50
			}
			multiply = faith_changed_doctrine_cost_mult_two_step 
		}
		if = {
			limit = { 
				has_doctrine = doctrine_polygamy_100
			}
			multiply = faith_changed_doctrine_cost_mult_two_point_five_step 
		}
	}
	parameters = {
		number_of_spouses = 4
		spouse_piety_loss = yes
		allows_polygamy = yes
	}
}

doctrine_concubines = {
	is_shown = {
		always = no
	}
	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = {
				OR = { 
					has_doctrine = doctrine_concubines
					has_doctrine = doctrine_concubines_3
				}
			}
			multiply = faith_unchanged_doctrine_cost_mult
		}

		# Harem Politics
		if = {
			limit = { 					
				OR = { 
					has_doctrine = doctrine_concubines_0
					has_doctrine = doctrine_concubines_10
				} 
			}
			multiply = faith_changed_doctrine_cost_mult_point_five_step 
		}
		if = {
			limit = { 					
				has_doctrine = doctrine_concubines_30
			}
			multiply = faith_changed_doctrine_cost_mult_one_step 
		}
		if = {
			limit = { 
				has_doctrine = doctrine_concubines_50
			}
			multiply = faith_changed_doctrine_cost_mult_one_point_five_step 
		}
		if = {
			limit = { 
				has_doctrine = doctrine_concubines_100
			}
			multiply = faith_changed_doctrine_cost_mult_two_step 
		}
		if = {
			limit = { 
				has_doctrine = doctrine_concubines_130
			}
			multiply = faith_changed_doctrine_cost_mult_two_point_five_step 
		}
	}
	parameters = {
		number_of_spouses = 1
		number_of_consorts = 3
		allows_concubinage = yes
	}
}

########################
## Marriage doctrines ##
########################
doctrine_polygamy_4 = {
	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = {
				OR = {
					has_doctrine = doctrine_polygamy
					has_doctrine = doctrine_polygamy_4
				}
			}
			multiply = faith_unchanged_doctrine_cost_mult
		}

		if = {
			limit = { 
				OR = {
					has_doctrine = doctrine_monogamy
					has_doctrine = doctrine_polygamy_10
				}
			}
			multiply = faith_changed_doctrine_cost_mult_point_five_step 
		}
		if = {
			limit = { 
				has_doctrine = doctrine_polygamy_15
			}
			multiply = faith_changed_doctrine_cost_mult_one_step 
		}

		if = {
			limit = { 
				has_doctrine = doctrine_polygamy_25
			}
			multiply = faith_changed_doctrine_cost_mult_one_point_five_step 
		}
		if = {
			limit = { 
				has_doctrine = doctrine_polygamy_50
			}
			multiply = faith_changed_doctrine_cost_mult_two_step 
		}
		if = {
			limit = { 
				has_doctrine = doctrine_polygamy_100
			}
			multiply = faith_changed_doctrine_cost_mult_two_point_five_step 
		}
	}
	parameters = {
		number_of_spouses = 4
		spouse_piety_loss = yes
		allows_polygamy = yes
	}
}

doctrine_polygamy_10 = {
	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = {
				has_doctrine = doctrine_polygamy_10
			}
			multiply = faith_unchanged_doctrine_cost_mult
		}
		
		if = {
			limit = { 
				OR = {
					has_doctrine = doctrine_monogamy
					has_doctrine = doctrine_polygamy_25
				}
			}
			multiply = faith_changed_doctrine_cost_mult_one_step 
		}			
		if = {
			limit = { 
				OR = {
					has_doctrine = doctrine_polygamy
					has_doctrine = doctrine_polygamy_4
					has_doctrine = doctrine_polygamy_15
				}
			}
			multiply = faith_changed_doctrine_cost_mult_point_five_step 
		}			
		if = {
			limit = { 
				has_doctrine = doctrine_polygamy_50
			}
			multiply = faith_changed_doctrine_cost_mult_one_point_five_step 
		}
		if = {
			limit = { 
				has_doctrine = doctrine_polygamy_100
			}
			multiply = faith_changed_doctrine_cost_mult_two_step 
		}
	}
	parameters = {
		number_of_spouses = 10
		spouse_piety_loss = yes
		allows_polygamy = yes
	}
}

doctrine_polygamy_15 = {
	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = {
				has_doctrine = doctrine_polygamy_15
			}
			multiply = faith_unchanged_doctrine_cost_mult
		}
		
		if = {
			limit = { 
				OR = {
					has_doctrine = doctrine_monogamy
					has_doctrine = doctrine_polygamy_100
				}
			}
			multiply = faith_changed_doctrine_cost_mult_one_point_five_step 
		}			
		if = {
			limit = { 
				OR = {
					has_doctrine = doctrine_polygamy
					has_doctrine = doctrine_polygamy_4
					has_doctrine = doctrine_polygamy_50
				}
			}
			multiply = faith_changed_doctrine_cost_mult_one_step 
		}	
		if = {
			limit = { 
				OR = {
					has_doctrine = doctrine_polygamy_10
					has_doctrine = doctrine_polygamy_25
				}
			}
			multiply = faith_changed_doctrine_cost_mult_point_five_step 
		}
	}
	parameters = {
		number_of_spouses = 15
		spouse_piety_loss = yes
		allows_polygamy = yes
	}
}

doctrine_polygamy_25 = {
	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = {
				has_doctrine = doctrine_polygamy_25
			}
			multiply = faith_unchanged_doctrine_cost_mult
		}
		
		if = {
			limit = { 
				has_doctrine = doctrine_monogamy
			}
			multiply = faith_changed_doctrine_cost_mult_two_step 
		}			
		if = {
			limit = { 
				OR = {
					has_doctrine = doctrine_polygamy
					has_doctrine = doctrine_polygamy_4
				}
			}
			multiply = faith_changed_doctrine_cost_mult_one_point_five_step 
		}	
		if = {
			limit = { 
				OR = {
					has_doctrine = doctrine_polygamy_10
					has_doctrine = doctrine_polygamy_100
				}
			}
			multiply = faith_changed_doctrine_cost_mult_one_step 
		}
		if = {
			limit = { 
				OR = {
					has_doctrine = doctrine_polygamy_15
					has_doctrine = doctrine_polygamy_50
				}
			}
			multiply = faith_changed_doctrine_cost_mult_point_five_step 
		}
	}
	parameters = {
		number_of_spouses = 25
		spouse_piety_loss = yes
		allows_polygamy = yes
	}
}

doctrine_polygamy_50 = {
	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = {
				has_doctrine = doctrine_polygamy_50
			}
			multiply = faith_unchanged_doctrine_cost_mult
		}
		
		if = {
			limit = { 
				has_doctrine = doctrine_monogamy
			}
			multiply = faith_changed_doctrine_cost_mult_two_point_five_step 
		}			
		if = {
			limit = { 
				OR = {
					has_doctrine = doctrine_polygamy
					has_doctrine = doctrine_polygamy_4
				}
			}
			multiply = faith_changed_doctrine_cost_mult_two_step 
		}	
		if = {
			limit = { 
				has_doctrine = doctrine_polygamy_10
			}
			multiply = faith_changed_doctrine_cost_mult_one_point_five_step 
		}
		if = {
			limit = { 
				has_doctrine = doctrine_polygamy_15
			}
			multiply = faith_changed_doctrine_cost_mult_one_step 
		}
		if = {
			limit = { 
				OR = {
					has_doctrine = doctrine_polygamy_25
					has_doctrine = doctrine_polygamy_100
				}
			}
			multiply = faith_changed_doctrine_cost_mult_point_five_step 
		}
	}
	parameters = {
		number_of_spouses = 50
		spouse_piety_loss = yes
		allows_polygamy = yes
	}
}

doctrine_polygamy_100 = {
	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = {
				has_doctrine = doctrine_polygamy_100
			}
			multiply = faith_unchanged_doctrine_cost_mult
		}
		
		if = {
			limit = { 
				has_doctrine = doctrine_monogamy
			}
			multiply = faith_changed_doctrine_cost_mult_three_step 
		}			
		if = {
			limit = { 
				OR = {
					has_doctrine = doctrine_polygamy
					has_doctrine = doctrine_polygamy_4
				}
			}
			multiply = faith_changed_doctrine_cost_mult_two_point_five_step 
		}	
		if = {
			limit = { 
				has_doctrine = doctrine_polygamy_10
			}
			multiply = faith_changed_doctrine_cost_mult_two_step 
		}
		if = {
			limit = { 
				has_doctrine = doctrine_polygamy_15
			}
			multiply = faith_changed_doctrine_cost_mult_one_point_five_step 
		}
		if = {
			limit = { 
				has_doctrine = doctrine_polygamy_25
			}
			multiply = faith_changed_doctrine_cost_mult_one_step 
		}

		if = {
			limit = { 
				has_doctrine = doctrine_polygamy_50
			}
			multiply = faith_changed_doctrine_cost_mult_point_five_step 
		}
	}
	parameters = {
		number_of_spouses = 100
		spouse_piety_loss = yes
		allows_polygamy = yes
	}
}
###########################
## Concubinage doctrines ##
###########################

doctrine_concubines_0 = {
	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { 					
				has_doctrine = doctrine_concubines_0
			}
			multiply = faith_unchanged_doctrine_cost_mult
		}

		if = {
			limit = { 					
				OR = { 
					has_doctrine = doctrine_concubines
					has_doctrine = doctrine_concubines_3
				}
			}
			multiply = faith_changed_doctrine_cost_mult_point_five_step 
		}
		if = {
			limit = { 
				has_doctrine = doctrine_concubines_10					
			}
			multiply = faith_changed_doctrine_cost_mult_one_step 
		}
		if = {
			limit = { 
				has_doctrine = doctrine_concubines_30
			}
			multiply = faith_changed_doctrine_cost_mult_one_point_five_step 
		}
		if = {
			limit = { 
				has_doctrine = doctrine_concubines_50
			}
			multiply = faith_changed_doctrine_cost_mult_two_step 
		}
		if = {
			limit = { 
				has_doctrine = doctrine_concubines_100
			}
			multiply = faith_changed_doctrine_cost_mult_two_point_five_step 
		}
		if = {
			limit = { 
				has_doctrine = doctrine_concubines_130
			}
			multiply = faith_changed_doctrine_cost_mult_three_step 
		}
	}
	parameters = {
		number_of_consorts_zero_loc = yes
	}
}

doctrine_concubines_3 = {
	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { 					
				OR = { 
					has_doctrine = doctrine_concubines
					has_doctrine = doctrine_concubines_3
				} 
			}
			multiply = faith_unchanged_doctrine_cost_mult
		}

		if = {
			limit = { 					
				OR = { 
					has_doctrine = doctrine_concubines_0
					has_doctrine = doctrine_concubines_10
				} 
			}
			multiply = faith_changed_doctrine_cost_mult_point_five_step 
		}
		if = {
			limit = { 					
				has_doctrine = doctrine_concubines_30
			}
			multiply = faith_changed_doctrine_cost_mult_one_step 
		}
		if = {
			limit = { 
				has_doctrine = doctrine_concubines_50
			}
			multiply = faith_changed_doctrine_cost_mult_one_point_five_step 
		}
		if = {
			limit = { 
				has_doctrine = doctrine_concubines_100
			}
			multiply = faith_changed_doctrine_cost_mult_two_step
		}
		if = {
			limit = { 
				has_doctrine = doctrine_concubines_130
			}
			multiply = faith_changed_doctrine_cost_mult_two_point_five_step
		}
	}
	parameters = {
		number_of_consorts = 3
		allows_concubinage = yes
	}
}

doctrine_concubines_10 = {
	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { 					
				has_doctrine = doctrine_concubines_10
			}
			multiply = faith_unchanged_doctrine_cost_mult
		}

		if = {
			limit = { 					
				OR = { 
					has_doctrine = doctrine_concubines_0
					has_doctrine = doctrine_concubines_50
				} 
			}
			multiply = faith_changed_doctrine_cost_mult_one_step 
		}
		if = {
			limit = { 	
				OR = { 
					has_doctrine = doctrine_concubines
					has_doctrine = doctrine_concubines_3
					has_doctrine = doctrine_concubines_30
				}
			}
			multiply = faith_changed_doctrine_cost_mult_point_five_step 
		}
		if = {
			limit = { 
				has_doctrine = doctrine_concubines_100
			}
			multiply = faith_changed_doctrine_cost_mult_one_point_five_step 
		}
		if = {
			limit = { 
				has_doctrine = doctrine_concubines_130
			}
			multiply = faith_changed_doctrine_cost_mult_two_step 
		}
	}
	parameters = {
		number_of_consorts = 10
		allows_concubinage = yes
	}
}

doctrine_concubines_30 = {
	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { 					
				has_doctrine = doctrine_concubines_30
			}
			multiply = faith_unchanged_doctrine_cost_mult
		}

		if = {
			limit = { 					
				OR = { 
					has_doctrine = doctrine_concubines_0
					has_doctrine = doctrine_concubines_130
				} 
			}
			multiply = faith_changed_doctrine_cost_mult_one_point_five_step 
		}
		if = {
			limit = { 	
				OR = { 
					has_doctrine = doctrine_concubines
					has_doctrine = doctrine_concubines_3
					has_doctrine = doctrine_concubines_100
				}
			}
			multiply = faith_changed_doctrine_cost_mult_one_step 
		}
		if = {
			limit = { 	
				OR = { 
					has_doctrine = doctrine_concubines_10
					has_doctrine = doctrine_concubines_50
				}
			}
			multiply = faith_changed_doctrine_cost_mult_point_five_step 
		}
	}
	parameters = {
		number_of_consorts = 30
		allows_concubinage = yes
	}
}

doctrine_concubines_50 = {
	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { 					
				has_doctrine = doctrine_concubines_50
			}
			multiply = faith_unchanged_doctrine_cost_mult
		}

		if = {
			limit = { 					
				has_doctrine = doctrine_concubines_0
			}
			multiply = faith_changed_doctrine_cost_mult_two_step 
		}
		if = {
			limit = { 	
				OR = { 
					has_doctrine = doctrine_concubines
					has_doctrine = doctrine_concubines_3
				}
			}
			multiply = faith_changed_doctrine_cost_mult_one_point_five_step 
		}
		if = {
			limit = { 	
				OR = { 
					has_doctrine = doctrine_concubines_10
					has_doctrine = doctrine_concubines_130
				}
			}
			multiply = faith_changed_doctrine_cost_mult_one_step 
		}
		if = {
			limit = { 	
				OR = { 
					has_doctrine = doctrine_concubines_30
					has_doctrine = doctrine_concubines_100
				}
			}
			multiply = faith_changed_doctrine_cost_mult_point_five_step 
		}
	}
	parameters = {
		number_of_consorts = 50
		allows_concubinage = yes
	}
}

doctrine_concubines_100 = {
	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { 					
				has_doctrine = doctrine_concubines_100
			}
			multiply = faith_unchanged_doctrine_cost_mult
		}

		if = {
			limit = { 					
				has_doctrine = doctrine_concubines_0
			}
			multiply = faith_changed_doctrine_cost_mult_two_point_five_step 
		}
		if = {
			limit = { 	
				OR = { 
					has_doctrine = doctrine_concubines
					has_doctrine = doctrine_concubines_3
				}
			}
			multiply = faith_changed_doctrine_cost_mult_two_step 
		}
		if = {
			limit = { 	
				has_doctrine = doctrine_concubines_10
			}
			multiply = faith_changed_doctrine_cost_mult_one_point_five_step 
		}
		if = {
			limit = { 	
				has_doctrine = doctrine_concubines_30
			}
			multiply = faith_changed_doctrine_cost_mult_one_step 
		}
		if = {
			limit = { 	
				OR = { 
					has_doctrine = doctrine_concubines_50
					has_doctrine = doctrine_concubines_130
				}
			}
			multiply = faith_changed_doctrine_cost_mult_point_five_step 
		}
	}
	parameters = {
		number_of_consorts = 100
		allows_concubinage = yes
	}
}

doctrine_concubines_130 = {
	piety_cost = {
		value = faith_doctrine_cost_mid
		if = {
			limit = { 					
				has_doctrine = doctrine_concubines_130
			}
			multiply = faith_unchanged_doctrine_cost_mult
		}

		if = {
			limit = { 					
				has_doctrine = doctrine_concubines_0
			}
			multiply = faith_changed_doctrine_cost_mult_three_step 
		}
		if = {
			limit = { 	
				OR = { 
					has_doctrine = doctrine_concubines
					has_doctrine = doctrine_concubines_3
				}
			}
			multiply = faith_changed_doctrine_cost_mult_two_point_five_step 
		}
		if = {
			limit = { 	
				has_doctrine = doctrine_concubines_10
			}
			multiply = faith_changed_doctrine_cost_mult_two_step 
		}
		if = {
			limit = { 	
				has_doctrine = doctrine_concubines_30
			}
			multiply = faith_changed_doctrine_cost_mult_one_point_five_step 
		}
		if = {
			limit = { 	
				has_doctrine = doctrine_concubines_50
			}
			multiply = faith_changed_doctrine_cost_mult_one_step 
		}
		if = {
			limit = { 	
				has_doctrine = doctrine_concubines_100
			}
			multiply = faith_changed_doctrine_cost_mult_point_five_step 
		}
	}
	parameters = {
		number_of_consorts = 130
		allows_concubinage = yes
	}
}

#################################
## Realm Celebration doctrines ##
#################################
doctrine_marriage_realm_celebration_disallowed = {
	piety_cost = {
		value = faith_doctrine_cost_low
		if = {
			limit = { has_doctrine = doctrine_marriage_realm_celebration_disallowed }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}
}
doctrine_marriage_realm_celebration_first = {
	piety_cost = {
		if = {
			limit = { #Monogamy
				doctrine:doctrine_monogamy = { is_in_list = selected_doctrines }
				doctrine:doctrine_concubines_0 = { is_in_list = selected_doctrines }
			}
			value = faith_doctrine_cost_low
		}
		else_if = {
			limit = { #Both
				NOR = { 
					doctrine:doctrine_monogamy = { is_in_list = selected_doctrines } 
					doctrine:doctrine_concubines_0 = { is_in_list = selected_doctrines }
				}
			}
			value = faith_doctrine_cost_massive
		} 
		else_if = {
			limit = { #Polygamy
				NOT = { doctrine:doctrine_monogamy = { is_in_list = selected_doctrines } }
			}
			value = faith_doctrine_cost_high
		}
		else = { #Concubinage
			value = faith_doctrine_cost_mid
		}

		if = {
			limit = { has_doctrine = doctrine_marriage_realm_celebration_first }
			multiply = faith_unchanged_doctrine_cost_mult
		}
	}
	parameters = {
		marriage_event = yes
	}
}