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

	royal_court = any

	court_generate_commanders = no
	domicile_type = red_keep_estate

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

	can_get_government = { #Triggers other than faith don't seem to work
		trigger_if = {
			limit = {
				government_has_flag = government_is_administrative
			}
			OR = {
				has_variable = free_city_govt_swap_to_lp_feudal
				agot_is_valid_for_lp_feudal_govt_when_converting_from_admin = yes
			}
		}
		trigger_else = {
			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_group = lp_feudal_vassal

	ai = {
		use_legends = yes
	}

	flags = {
		government_is_feudal
		government_is_settled
		government_uses_crown_authority
		government_uses_domain_limit
		government_is_lp_feudal
		government_is_settled
		government_is_default #For grouping governments that should use the regular lifestyle perks.
	}
	color = rgb{ 130 100 100 }
}

lorathi_principality_government = {
	government_rules = {
		create_cadet_branches = no
		court_generate_spouses = no
		council = no
		religious = no
		rulers_should_have_dynasty = no
		dynasty_named_realms = no
		inherit_from_dynastic_government = no
	}

	court_generate_commanders = no

	primary_holding = church_holding

	can_get_government = {
		is_landed = no
		OR = {
			has_title = title:d_harvest_principality
			has_title = title:d_fisher_principality
			has_title = title:d_principality_of_the_streets
		}
	}

	ai = {
		arrange_marriage = no
		use_goals = no
		use_decisions = no
		perform_religious_reformation = no
	}

	flags = {
		government_is_lorathi_principality
		government_is_settled
		government_is_default #For grouping governments that should use the regular lifestyle perks.
	}

	color = rgb{ 119 188 112 }
}

silent_sisterhood_government = {
	government_rules = {
		create_cadet_branches = no
		court_generate_spouses = no
		council = no
		religious = yes
		rulers_should_have_dynasty = no
		dynasty_named_realms = no
		allow_accolades = no
	}

	court_generate_commanders = no

	primary_holding = castle_holding

	can_get_government = {
		is_landed = no
		has_title = title:d_the_silent_sisterhood
	}

	ai = {
		arrange_marriage = no
		use_goals = no
		use_decisions = no
		perform_religious_reformation = no
	}

	flags = {
		government_is_silent_sisters
		government_is_settled
		government_is_default #For grouping governments that should use the regular lifestyle perks.
	}

	character_modifier = {
		knight_limit = -100
	}

	color = rgb{ 214 245 250 }
}

kingsguard_government = {
	government_rules = {
		create_cadet_branches = no
		court_generate_spouses = no
		council = no
		religious = no
		rulers_should_have_dynasty = no
		dynasty_named_realms = no
		allow_accolades = no
	}

	court_generate_commanders = no

	primary_holding = castle_holding

	can_get_government = {
		is_landed = no
		has_title = title:d_kingsguard
	}

	ai = {
		arrange_marriage = no
		use_goals = no
		use_decisions = no
		perform_religious_reformation = no
	}

	flags = {
		government_is_kg
		government_is_settled
		government_is_default #For grouping governments that should use the regular lifestyle perks.
	}

	color = rgb{ 214 245 250 }
}

nights_watch_government = {
	government_rules = {
		create_cadet_branches = no
		rulers_should_have_dynasty = no
		dynasty_named_realms = no
		court_generate_spouses = no
		allow_accolades = yes
	}

	court_generate_commanders = no

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

	can_get_government = {
		OR = {
			has_title = title:k_the_wall
			any_liege_or_above = {
				has_title = title:k_the_wall
			}
		}
		OR = {
			has_trait = nightswatch
			has_trait = nightswatch_temp
			has_trait = nightswatch_historical
		}
	}
	character_modifier = {
		monthly_dread = 0.5 #scary man
		army_maintenance_mult = -0.6 #army don't get a regular soldier salary
		men_at_arms_maintenance = -0.7 #army don't get a regular soldier salary
		martial_per_prestige_level = 2 #famous smart stronkly
		prowess_per_prestige_level = 2 #famous stronk
		holy_order_hire_cost_mult = 1000
		# Make it more likely for the NW AI to start wars against wildlings
		ai_war_chance = 2
		ai_war_cooldown = -0.5
	}

	vassal_contract_group = nights_watch_vassal

	flags = {
		government_is_nw
		government_is_settled
		government_is_default #For grouping governments that should use the regular lifestyle perks.
	}

	color = hsv{ 0.9 0.0 0.22 }
}

the_citadel_government = {
	government_rules = {
		create_cadet_branches = no
		rulers_should_have_dynasty = no
		dynasty_named_realms = no
		court_generate_spouses = no
		allow_accolades = no
	}

	court_generate_commanders = no

	primary_holding = city_holding

	can_get_government = {
		trigger_if = {
			limit = {
				exists = global_var:citadel_title
			}
			has_title = global_var:citadel_title
		}
		trigger_else = {
			has_title = title:b_the_citadel
		}
		has_trait = archmaester
	}

	ai = {
		arrange_marriage = no
		use_goals = no
		use_scripted_guis = no
		perform_religious_reformation = no
	}

	flags = {
		government_is_the_citadel
		government_is_settled
		government_is_default #For grouping governments that should use the regular lifestyle perks.
	}

	color = hsv{ 0.00 1.00 0.98 }
}

ruins_government = {
	government_rules = {
		court_generate_spouses = no
		council = no
		create_cadet_branches = no
		rulers_should_have_dynasty = no
		dynasty_named_realms = no
		allow_accolades = no
	}

	character_modifier = {
		knight_limit = -100
		county_opinion_add = 100
		monthly_income_mult = -10
	}

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

	ai = {
		use_lifestyle = no
		arrange_marriage = no
		use_goals = no
		use_decisions = no
		use_scripted_guis = no
		use_legends = no
		perform_religious_reformation = no
	}

	flags = {
		government_is_ruins
		government_is_uninteractable
		government_is_settled
		government_is_default #For grouping governments that should use the regular lifestyle perks.
	}

	color = hsv{ 1 0.0 0.1 }
}

unknown_government = {
	government_rules = {
		court_generate_spouses = no
		council = no
		create_cadet_branches = no
		rulers_should_have_dynasty = no
		dynasty_named_realms = no
		allow_accolades = no
	}

	character_modifier = {
		knight_limit = -100
		county_opinion_add = 100
		monthly_income_mult = -10
	}

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

	ai = {
		use_lifestyle = no
		arrange_marriage = no
		use_goals = no
		use_decisions = no
		use_scripted_guis = no
		use_legends = no
		perform_religious_reformation = no
	}

	flags = {
		government_is_unknown
		government_is_uninteractable
		government_is_settled
		government_is_default #For grouping governments that should use the regular lifestyle perks.
	}

	color = hsv{ 1 0.0 0.1 }
}

wilderness_government = {
	government_rules = {
		court_generate_spouses = no
		council = no
		create_cadet_branches = no
		rulers_should_have_dynasty = no
		dynasty_named_realms = no
		allow_accolades = no
	}

	character_modifier = {
		knight_limit = -100
		county_opinion_add = 100
		monthly_income_mult = -10
	}

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

	ai = {
		use_lifestyle = no
		arrange_marriage = no
		use_goals = no
		use_decisions = no
		use_scripted_guis = no
		use_legends = no
		perform_religious_reformation = no
	}

	flags = {
		government_is_wilderness
		government_is_uninteractable
		government_is_settled
		government_is_default #For grouping governments that should use the regular lifestyle perks.
	}

	color = hsv{ 1 0.0 0.1 }
}

pirate_government = {
	government_rules = {
		create_cadet_branches = yes
		rulers_should_have_dynasty = yes
		dynasty_named_realms = yes
		landless_playable = yes
		sticky_government = yes
		allow_accolades = no
	}

	royal_court = any

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

	domicile_type = agot_pirate_ship

	can_get_government = {}

	vassal_contract_group = pirate_vassal

	flags = {
		agot_pirate_gov_succ_block
		agot_pirate_sailing_requirements
		government_can_raid_rule
		agot_unlocks_conquest_cb
		government_is_pirate
		government_is_settled
		has_unique_government_perks
		government_uses_domicile_but_not_adventurer
		government_is_pirate_trigger_check
	}

	color = rgb{ 57 174 119 }
}

pirate_no_dlc_government = {
	government_rules = {
		create_cadet_branches = yes
		rulers_should_have_dynasty = yes
		dynasty_named_realms = yes
		allow_accolades = no
	}

	royal_court = any

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

	vassal_contract_group = pirate_vassal

	flags = {
		agot_pirate_gov_succ_block
		agot_pirate_sailing_requirements
		government_can_raid_rule
		agot_unlocks_conquest_cb
		government_is_pirate_without_landless_dlc
		government_is_settled
		government_is_default
		government_is_pirate_trigger_check
	}

	color = rgb{ 57 174 119 }
}


# A dummy government that is NOT meant to be used in-game. We use this in the bookmark frontend GUI to mix landed and landless on one screen.
dummy_adventurer_govt_for_bms = {
	government_rules = {
		create_cadet_branches = no
		rulers_should_have_dynasty = no
		dynasty_named_realms = no
		allow_accolades = no
	}

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

	character_modifier = {
		legitimacy_gain_mult = -0.5
	}

	flags = {
		government_is_custom_landless
	}

	can_get_government = { always = no }

	color = hsv{ 1 0.0 0.1 }
}

dummy_admin_govt_for_bms = {
	government_rules = {
		create_cadet_branches = no
		rulers_should_have_dynasty = no
		dynasty_named_realms = no
		allow_accolades = no
	}

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

	flags = {
		government_is_custom_administrative
	}

	can_get_government = { always = no }

	color = { 70 6 90 }
}

first_ranger_government = {
	government_rules = {
		create_cadet_branches = no
		rulers_should_have_dynasty = no
		dynasty_named_realms = no
		court_generate_spouses = no
		landless_playable = yes
		allow_accolades = no
	}

	domicile_type = agot_ranger_camp

	court_generate_commanders = no

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

	can_get_government = {
		has_title = title:d_nw_landless_first_ranger
		any_liege_or_above = { has_title = title:k_the_wall }
		OR = {
			has_trait = nightswatch
			has_trait = nightswatch_temp
			has_trait = nightswatch_historical
		}
		has_trait = lifestyle_nw_ranger
	}
	character_modifier = {
		monthly_dread = 0.5 #scary man
		army_maintenance_mult = -0.6 #army don't get a regular soldier salary
		men_at_arms_maintenance = -0.7 #army don't get a regular soldier salary
		martial_per_prestige_level = 2 #famous smart stronkly
		prowess_per_prestige_level = 2 #famous stronk
		holy_order_hire_cost_mult = 1000
		# Make it more likely for the NW AI to start wars against wildlings
		ai_war_chance = 0.5
		ai_war_cooldown = -0.25
	}

	flags = {
		government_is_first_ranger
		government_is_nw
		government_is_custom_landless
	}

	color = hsv{ 0.9 0.0 0.21 }
}

command_government = {
	government_rules = {
		create_cadet_branches = no
		rulers_should_have_dynasty = no
		dynasty_named_realms = no
		allow_accolades = yes
	}

	primary_holding = castle_holding
	valid_holdings = { city_holding }

	can_get_government = {
		primary_title = title:b_goldguard_heights
	}

	vassal_contract_group = command_vassal

	flags = {
		government_is_settled
		government_is_default #For grouping governments that should use the regular lifestyle perks.
		government_is_command
	}

	color = rgb{ 90 140 210 }
}

#Modified from vanilla administrative
norvos_government = {
	government_rules = {
		create_cadet_branches = yes
		rulers_should_have_dynasty = yes
		dynasty_named_realms = no
		administrative = yes
		landless_playable = yes
		state_faith = yes
		use_as_base_on_landed = yes
		use_as_base_on_rank_up = yes
		inherit_from_dynastic_government = no
		sticky_government = yes
		house_aspirations = yes
		noble_families = yes
		admin_allows_holding_multiple_primary_tier_titles = yes
		treasury = yes
		replace_gold_cost_by_treasury = yes
		allow_accolades = no
	}

	royal_court = any

	domicile_type = estate
	main_administrative_tier = county
	min_appointment_tier = county
	minimum_provincial_maa_tier = county

	primary_holding = castle_holding
	valid_holdings = { church_holding city_holding temple_citadel_holding ruin_holding settlement_holding }
	required_county_holdings = { castle_holding city_holding church_holding }

	vassal_contract_group = admin_vassal

	can_get_government = {
		OR = {
			has_title = title:k_norvos
			any_liege_or_above = { has_title = title:k_norvos }
			has_character_flag = has_norvos_government
		}
	}

	character_modifier = {
		levy_size = -0.7
		feudal_government_tax_contribution_mult = -0.5
		feudal_government_levy_contribution_mult = -0.5
		clan_government_tax_contribution_mult = -0.5
		clan_government_levy_contribution_mult = -0.5
		men_at_arms_cap = -3
		men_at_arms_limit = -5
		knight_limit = -5
		vassal_limit = 100
		accolades = -1
		title_creation_cost_mult = -0.05
		mercenary_hire_cost_mult = 2
		men_at_arms_maintenance = 0.5

		monthly_treasury_from_liege_mult = -0.15

		# Norvos Specific
		zealot_tax_contribution_mult = 0.05
		zealot_levy_contribution_mult = 0.05
		monthly_piety_gain_mult = 0.15
	}

	top_liege_character_modifier = {
		monthly_treasury_from_vassals = 0.85
		men_at_arms_maintenance = 1.5
		men_at_arms_recruitment_cost = 1
	}

	# Use flags instead of has_government for moddability if possible (i.e., wherever not visible to the player).
	flags = {
		government_is_administrative
		government_has_influence
		government_has_treasury
		government_has_title_men_at_arms
		government_has_powerful_families
		government_is_settled
		government_uses_domicile_but_not_adventurer
		government_uses_domain_limit
		government_uses_admin_province_obligations
		government_is_default
		government_is_free_city
		government_is_norvos
		government_has_county_tier_noble_families
	}


	mechanic_type = administrative

	color = { 69 69 55 }
	realm_mask_offset = { 0.0 0.01 }
	realm_mask_scale = { 1 1 }
}