﻿lp_feudal_government = {
	government_rules = {
		create_cadet_branches = yes
		rulers_should_have_dynasty = yes
		dynasty_named_realms = yes
		royal_court = yes
		legitimacy = yes
		court_generate_spouses = no
	}

	domicile_type = feudal_domicile

	court_generate_commanders = no

	primary_holding = castle_holding
	valid_holdings = { ruin_holding }
	required_county_holdings = { castle_holding }

	can_get_government = { #Triggers other than faith don't seem to work
		OR = {
			agot_is_valid_lp_feudal_government_target = yes
			any_liege_or_above = { agot_is_valid_lp_feudal_government_target = yes }
		}
		NOT = {
			any_liege_or_above = { has_trait = nightswatch }
		}
	}

	vassal_contract = {
		feudal_government_taxes
		feudal_government_levies
		special_contract
		religious_rights
		fortification_rights
		coinage_rights
		war_declaration_rights
		council_rights
		title_revocation_rights
		marriage_favor_rights
	}

	ai = {
		use_legends = yes
	}

	flag = government_is_feudal
	flag = government_is_lp_feudal
	color = rgb{ 130 100 100 }
}

feudal_government = {
	government_rules = {
		create_cadet_branches = yes
		rulers_should_have_dynasty = yes
		dynasty_named_realms = yes
		royal_court = yes
		legitimacy = yes
	}

	fallback = 1

	domicile_type = feudal_domicile

	primary_holding = castle_holding
	#AGOT Disabled
	#required_county_holdings = { castle_holding city_holding church_holding }

	#AGOT Added
	can_get_government = {
		NOR = {
			agot_is_valid_lp_feudal_government_target = yes
			any_liege_or_above = { agot_is_valid_lp_feudal_government_target = yes }
		}
	}

	vassal_contract = {
		feudal_government_taxes
		feudal_government_levies
		special_contract
		religious_rights
		fortification_rights
		coinage_rights
		#AGOT Disabled
		#succession_rights
		war_declaration_rights
		council_rights
		title_revocation_rights
		#AGOT Added
		marriage_favor_rights
	}

	ai = {
		use_legends = yes
	}

	flag = may_elevate_co_monarch
	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flag = government_is_feudal
	color = hsv{ 0.67 1.00 0.78 }
}

clan_government = {
	government_rules = {
		create_cadet_branches = yes
		rulers_should_have_dynasty = yes
		royal_court = yes
		legitimacy = yes
		#AGOT Disabled
		#dynasty_named_realms = yes
	}

	primary_holding = castle_holding
	#AGOT Disabled, unused
	#primary_heritages = { heritage_arabic heritage_iranian heritage_turkic }
	
	fallback = 2

	domicile_type = clan_domicile

	#AGOT Disabled
	#preferred_religions = { islam_religion }

	valid_holdings = { castle_holding }
	#AGOT Disabled
	#required_county_holdings = { castle_holding city_holding church_holding }
	always_use_patronym = yes

	house_unity = clan_house_unity
	tax_slot_type = clan_tax_slot

	vassal_contract = {
		clan_tax_collector_obligations
		special_contract
		religious_rights
		war_declaration_rights
		council_rights
		title_revocation_rights
		marriage_favor_rights
	}

	ai = {
		use_legends = yes
	}

	opinion_of_liege = {
		scope:vassal = {
			if = {
				limit = {
					NOT = {
						is_allied_to = scope:liege
					}
				}
				if = {
					limit = {
						is_powerful_vassal = yes
					}
					value = clan_powerful_vassal_no_alliance_opinion_penalty_value
				}
				else = {
					value = clan_vassal_no_alliance_opinion_penalty_value
				}
			}
		}
	}
	opinion_of_liege_desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:vassal = {
						NOT = {
							is_allied_to = scope:liege
						}
						is_powerful_vassal = yes
					}
				}
				desc = "GOVERNMENT_CLAN_NOT_ALLIED_POWERFUL"
			}
			triggered_desc = {
				trigger = {
					scope:vassal = {
						NOT = {
							is_allied_to = scope:liege
						}
						is_powerful_vassal = no
					}
				}
				desc = "GOVERNMENT_CLAN_NOT_ALLIED"
			}
		}
	}

	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flag = government_is_clan
	flag = may_appoint_viziers
	color = hsv{ 0.39 0.93 0.54 }
}

free_city_government = { # Basically feudal but allowed cities
	government_rules = {
		create_cadet_branches = yes
		rulers_should_have_dynasty = yes
		dynasty_named_realms = yes
		royal_court = yes
	}

	domicile_type = feudal_domicile

	primary_holding = castle_holding
	valid_holdings = { city_holding }
	required_county_holdings = { castle_holding city_holding church_holding }

	vassal_contract = {
		feudal_government_taxes
		feudal_government_levies
		special_contract
		religious_rights
		fortification_rights
		coinage_rights
		succession_rights
		war_declaration_rights
		council_rights
		title_revocation_rights
	}
	
	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flag = government_is_free_city
	color = hsv{ 0.33 1.00 0.78 }
}

pirate_government = {
	government_rules = {
		create_cadet_branches = yes
		rulers_should_have_dynasty = yes
		dynasty_named_realms = yes
		royal_court = yes
	}

	domicile_type = tribal_camp

	primary_holding = pirate_den_holding
	valid_holdings = { pirate_den_holding }
	required_county_holdings = { pirate_den_holding }

	can_get_government = { #Triggers other than faith don't seem to work
	}

	vassal_contract = {
		feudal_government_taxes
		feudal_government_levies
		special_contract
		religious_rights
		fortification_rights
		coinage_rights
		succession_rights
		war_declaration_rights
		council_rights
		title_revocation_rights
		marriage_favor_rights
	}

	flag = agot_pirate_gov_succ_block
	flag = government_can_raid_rule
	flag = agot_unlocks_conquest_cb
	flag = government_is_pirate

	color = rgb{ 57 174 119 }
}

tribal_government = {
	government_rules = {
		rulers_should_have_dynasty = yes
		regiments_prestige_as_gold = yes
		royal_court = yes
		legitimacy = yes
	}

	domicile_type = tribal_camp

	supply_limit_mult_for_others = -0.5
	primary_holding = tribal_holding
	required_county_holdings = { tribal_holding }

	valid_holdings = { castle_holding }

	prestige_opinion_override = { -10 0 3 5 10 20 }
	always_use_patronym = yes
	affected_by_development = no

	vassal_contract = { tribal_government_obligations }

	ai = {
		use_legends = yes
	}

	character_modifier = {
		title_creation_cost_mult = -0.5
		army_maintenance_mult = -0.5

		feudal_government_vassal_opinion = -20
		clan_government_vassal_opinion = -20
		republic_government_vassal_opinion = -20

		character_travel_safety = 10

		ai_war_chance = 0.25
		monthly_prestige = 0.2
	}

	flag = government_can_raid_rule
	flag = may_elevate_co_monarch
	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flag = government_is_tribal
	color = hsv{ 0.02 0.75 0.36 }
}