﻿# These are the "goals" for freeing the Keeper of Souls
# The more completed goals, the better ritual you can perform
# This counts how many you have complete
regula_free_keeper_of_souls_triggers_completed = {
    
	# As you are always spellbound, freebie goal, we start at 1
    value = 1

	# Title/Realm requirements
	# You have a title of Duchy or higher
    if = {
        limit = { highest_held_title_tier >=3 }
        add = 1
    }
	
	# Your realm size is greater then 5
	if = {
        limit = { realm_size >= 5 }
        add = 1
    }

	# Primary Wife is secretly charmed (and that you have one!)
	if = {
        limit = {
			primary_spouse ?= {
				any_secret = {
					secret_type = regula_covert_conversion
				}
			}
		}
        add = 1
    }

	# Two powerful vassals are secretly charmed
	# If Feudal/Clan/Tribal
	if = {
        limit = {
			regula_num_covert_powerful_vassals >= 2
			OR = {
				has_government = feudal_government
				has_government = clan_government
				has_government = tribal_government
			}
		}
        add = 1
    }

	# You are at absolute Dominance or greater
	# If Nomad
	if = {
		limit = {
			government_has_flag = government_is_nomadic
			OR = {
				has_realm_law = nomadic_authority_4
				has_realm_law = nomadic_authority_5
			}
		}
		add = 1
	}

	# If Administrative, must be a powerful family or higher
	if = {
		limit = {
			has_government = administrative_government
			house ?= {
				OR = {
					is_powerful_family = yes
					is_dominant_family = yes
				}
			}
		}
		add = 1
	}

	# Any two Court position holders are secretly charmed
	if = {
        limit = {
			any_court_position_holder = {
				count >= 2
				any_secret = {
					secret_type = regula_covert_conversion
				}
			}
		}
        add = 1
    }
}

regula_free_keeper_of_souls_unlanded_triggers_completed = {
    
	# As you are always spellbound, freebie goal, we start at 1
    value = 1

	# Primary Wife is secretly charmed (and that you have one!)
	if = {
        limit = {
			primary_spouse ?= {
				any_secret = {
					secret_type = regula_covert_conversion
				}
			}
		}
        add = 1
    }

	# Any two camp position holders (officer) are secretly charmed
	if = {
        limit = {
			any_court_position_holder = {
				count >= 2
				any_secret = {
					secret_type = regula_covert_conversion
				}
			}
		}
        add = 1
    }

	# At least six followers are secretly charmed
	if = {
		limit = {
			any_courtier = {
				count >= 6
				any_secret = {
					secret_type = regula_covert_conversion
				}
			}
		}
		add = 1
	}

	# You have at least two building upgrades out of six (that are regula)
	if = {
		limit = {
			is_landless_adventurer = yes
			domicile ?= {
				calc_true_if = {
					amount >= 2
					has_domicile_building_or_higher = baggage_train_submissive_servants_01
					has_domicile_building_or_higher = barber_tent_healing_rituals_01
					has_domicile_building_or_higher = mess_tent_aphrodisiacs_01
					has_domicile_building_or_higher = camp_fire_enticing_offers_01
					has_domicile_building_or_higher = proving_grounds_famuli_trainer_01
					has_domicile_building_or_higher = camp_perimeter_captivating_maidens_01
				}
			}
		}
		add = 1
	}

	# If we are landless, but have an estate under admin, check if we are a powerful family
	if = {
		limit = {
			is_landless_adventurer = no
			government_allows = administrative
			house ?= {
				is_powerful_family = yes
			}
		}
		add = 1
	}
}

# Get half of the current MAA Troops
# Current Scope should be MAA Regiment
regula_maa_get_half_current_troops = {
	value = maa_current_troops_count
	multiply = 0.5
}