﻿# Native selectable work for the Aureliani Senate's council positions.
# Each office keeps an infinite default task. Its alternate commission pays
# only when the native percentage task completes.

aureliani_task_presiding_proceedings = {
	default_task = yes
	position = aureliani_presiding_senator
	task_type = task_type_general
	task_progress = task_progress_infinite
	monthly_on_action = aureliani_presiding_task_monthly_on_action
	is_valid_showing_failures_only = { custom_description = { text = aureliani_office_req_task_holder aureliani_senate_office_rostered_trigger = yes } }
	is_shown = { aureliani_senate_office_rostered_trigger = yes }
	asset = {
		icon = "gfx/interface/icons/council_task_types/task_domestic_affairs.dds"
		background = "gfx/interface/buttons/button_round_bg.dds"
		frame = "gfx/interface/buttons/button_round_frame.dds"
		glow = "gfx/particles/halo.dds"
	}

	council_owner_modifier = { name = aureliani_task_presiding_proceedings direct_vassal_opinion = 10 scale = aureliani_office_task_presiding_scale }
	effect_desc = { desc = aureliani_task_presiding_proceedings_desc }
}

aureliani_task_presiding_conciliation = {
	position = aureliani_presiding_senator
	task_type = task_type_general
	task_progress = task_progress_percentage
	restart_on_finish = yes
	monthly_on_action = aureliani_presiding_task_monthly_on_action
	is_valid_showing_failures_only = { custom_description = { text = aureliani_office_req_task_holder aureliani_senate_office_rostered_trigger = yes } }
	is_shown = { aureliani_senate_office_rostered_trigger = yes }
	asset = {
		icon = "gfx/interface/icons/council_task_types/task_foreign_affairs.dds"
		background = "gfx/interface/buttons/button_round_bg.dds"
		frame = "gfx/interface/buttons/button_round_frame.dds"
		glow = "gfx/particles/halo.dds"
	}
	effect_desc = {
		first_valid = {
			triggered_desc = { trigger = { aureliani_office_task_presiding_scale >= 1.1 house:house_aureliani = { has_variable = aureliani_senate_deliberating } aureliani_senator_personal_support_trigger = yes } desc = aureliani_task_presiding_conciliation_debate_desc }
			triggered_desc = { trigger = { aureliani_office_task_presiding_scale >= 1.1 } desc = aureliani_task_presiding_conciliation_good_desc }
			desc = aureliani_task_presiding_conciliation_desc
		}
		desc = aureliani_task_commission_rules_desc
	}
	progress = {
		value = 0
		add = { value = 6 desc = aureliani_task_base_progress }
		add = { value = diplomacy multiply = 0.15 desc = aureliani_task_skill_progress }
		if = { limit = { has_trait = diligent } add = { value = 1 desc = aureliani_task_diligence_progress } }
		if = { limit = { aureliani_senator_personal_support_trigger = yes } add = { value = 1 desc = aureliani_task_faction_progress } }
		if = { limit = { opinion = { target = scope:councillor_liege value >= 20 } } add = { value = 1 desc = aureliani_task_opinion_progress } }
		if = { limit = { opinion = { target = scope:councillor_liege value <= -20 } } subtract = { value = 2 desc = aureliani_task_opinion_progress } }
	}
	on_finish_task = {
		scope:councillor_liege = { remove_character_modifier = aureliani_task_chamber_reconciled }
		if = { limit = { aureliani_office_task_presiding_scale >= 1.1 house:house_aureliani = { has_variable = aureliani_senate_deliberating } aureliani_senator_personal_support_trigger = yes } house:house_aureliani = { remove_variable = aureliani_senate_deliberating } }
		else_if = { limit = { aureliani_office_task_presiding_scale >= 1.1 } scope:councillor_liege = { add_prestige = 75 } }
		else = { scope:councillor_liege = { add_prestige = 50 } }
	}
}

aureliani_task_treasurer_accounts = {
	default_task = yes
	position = aureliani_senate_treasurer
	task_type = task_type_general
	task_progress = task_progress_infinite
	monthly_on_action = aureliani_treasurer_task_monthly_on_action
	is_valid_showing_failures_only = { custom_description = { text = aureliani_office_req_task_holder aureliani_senate_office_rostered_trigger = yes } }
	is_shown = { aureliani_senate_office_rostered_trigger = yes }
	asset = {
		icon = "gfx/interface/icons/council_task_types/task_collect_taxes.dds"
		background = "gfx/interface/buttons/button_round_bg.dds"
		frame = "gfx/interface/buttons/button_round_frame.dds"
		glow = "gfx/particles/halo.dds"
	}

	council_owner_modifier = { name = aureliani_task_treasurer_accounts domain_tax_mult = 0.12 scale = aureliani_office_task_treasurer_scale }
	effect_desc = { desc = aureliani_task_treasurer_accounts_desc }
}

aureliani_task_treasurer_audit = {
	position = aureliani_senate_treasurer
	task_type = task_type_general
	task_progress = task_progress_percentage
	restart_on_finish = yes
	monthly_on_action = aureliani_treasurer_task_monthly_on_action
	is_valid_showing_failures_only = { custom_description = { text = aureliani_office_req_task_holder aureliani_senate_office_rostered_trigger = yes } }
	is_shown = { aureliani_senate_office_rostered_trigger = yes }
	asset = {
		icon = "gfx/interface/icons/council_task_types/task_manage_talent.dds"
		background = "gfx/interface/buttons/button_round_bg.dds"
		frame = "gfx/interface/buttons/button_round_frame.dds"
		glow = "gfx/particles/halo.dds"
	}
	effect_desc = {
		first_valid = {
			triggered_desc = { trigger = { aureliani_office_task_treasurer_scale >= 1.1 house:house_aureliani = { has_variable = aureliani_senate_stage var:aureliani_senate_stage ?= 2 has_variable = aureliani_senate_policy_1_level OR = { var:aureliani_senate_policy_1_level ?= 4 has_variable = aureliani_senate_policy_1_level var:aureliani_senate_policy_1_level ?= 5 } } } desc = aureliani_task_treasurer_audit_roman_desc }
			triggered_desc = { trigger = { aureliani_office_task_treasurer_scale >= 1.1 } desc = aureliani_task_treasurer_audit_good_desc }
			desc = aureliani_task_treasurer_audit_desc
		}
		desc = aureliani_task_commission_rules_desc
	}
	progress = {
		value = 0
		add = { value = 6 desc = aureliani_task_base_progress }
		add = { value = stewardship multiply = 0.15 desc = aureliani_task_skill_progress }
		if = { limit = { has_trait = diligent } add = { value = 1 desc = aureliani_task_diligence_progress } }
		if = { limit = { aureliani_senator_personal_support_trigger = yes } add = { value = 1 desc = aureliani_task_faction_progress } }
		if = { limit = { opinion = { target = scope:councillor_liege value >= 20 } } add = { value = 1 desc = aureliani_task_opinion_progress } }
		if = { limit = { opinion = { target = scope:councillor_liege value <= -20 } } subtract = { value = 2 desc = aureliani_task_opinion_progress } }
	}
	on_finish_task = {
		if = {
			limit = { aureliani_office_task_treasurer_scale >= 1.1 }
			if = { limit = { house:house_aureliani = { var:aureliani_senate_stage ?= 2 has_variable = aureliani_senate_stage has_variable = aureliani_senate_policy_1_level var:aureliani_senate_policy_1_level ?= 4 } } scope:councillor_liege = { add_gold = 75 } }
			else_if = { limit = { house:house_aureliani = { var:aureliani_senate_stage ?= 2 has_variable = aureliani_senate_stage has_variable = aureliani_senate_policy_1_level var:aureliani_senate_policy_1_level ?= 5 } } scope:councillor_liege = { add_gold = 75 } }
			else = { scope:councillor_liege = { add_gold = 50 } }
		}
		else = { scope:councillor_liege = { add_gold = 35 } }
	}
}

aureliani_task_records_archive = {
	default_task = yes
	position = aureliani_keeper_of_records
	task_type = task_type_general
	task_progress = task_progress_infinite
	monthly_on_action = aureliani_records_task_monthly_on_action
	is_valid_showing_failures_only = { custom_description = { text = aureliani_office_req_task_holder aureliani_senate_office_rostered_trigger = yes } }
	is_shown = { aureliani_senate_office_rostered_trigger = yes }
	council_owner_modifier = { name = aureliani_task_records_archive monthly_prestige = 1.1 scale = aureliani_office_task_records_scale }
	asset = {
		icon = "gfx/interface/icons/council_task_types/task_religious_relations.dds"
		background = "gfx/interface/buttons/button_round_bg.dds"
		frame = "gfx/interface/buttons/button_round_frame.dds"
		glow = "gfx/particles/halo.dds"
	}

	effect_desc = { desc = aureliani_task_records_archive_desc }
}

aureliani_task_records_petitions = {
	position = aureliani_keeper_of_records
	task_type = task_type_general
	task_progress = task_progress_percentage
	restart_on_finish = yes
	monthly_on_action = aureliani_records_task_monthly_on_action
	is_valid_showing_failures_only = { custom_description = { text = aureliani_office_req_task_holder aureliani_senate_office_rostered_trigger = yes } }
	is_shown = { aureliani_senate_office_rostered_trigger = yes }
	asset = {
		icon = "gfx/interface/icons/council_task_types/task_justify_rule.dds"
		background = "gfx/interface/buttons/button_round_bg.dds"
		frame = "gfx/interface/buttons/button_round_frame.dds"
		glow = "gfx/particles/halo.dds"
	}
	effect_desc = {
		first_valid = {
			triggered_desc = { trigger = { aureliani_office_task_records_scale >= 1.1 } desc = aureliani_task_records_petitions_good_desc }
			desc = aureliani_task_records_petitions_desc
		}
		desc = aureliani_task_commission_rules_desc
		desc = aureliani_task_completion_cost_desc
	}
	progress = {
		value = 0
		add = { value = 6 desc = aureliani_task_base_progress }
		add = { value = learning multiply = 0.15 desc = aureliani_task_skill_progress }
		if = { limit = { has_trait = diligent } add = { value = 1 desc = aureliani_task_diligence_progress } }
		if = { limit = { aureliani_senator_personal_support_trigger = yes } add = { value = 1 desc = aureliani_task_faction_progress } }
		if = { limit = { opinion = { target = scope:councillor_liege value >= 20 } } add = { value = 1 desc = aureliani_task_opinion_progress } }
		if = { limit = { opinion = { target = scope:councillor_liege value <= -20 } } subtract = { value = 2 desc = aureliani_task_opinion_progress } }
	}
	on_finish_task = {
		if = {
			limit = { scope:councillor_liege = { gold >= 50 } }
			scope:councillor_liege = { remove_short_term_gold = 50 }
			scope:councillor_liege.capital_county = { remove_county_modifier = aureliani_task_petitions_registered remove_county_modifier = aureliani_task_petitions_settled }
			if = { limit = { aureliani_office_task_records_scale >= 1.1 } scope:councillor_liege = { add_prestige = 100 } }
			else = { scope:councillor_liege = { add_prestige = 75 } }
		}
	}
}

aureliani_task_works_maintenance = {
	default_task = yes
	position = aureliani_minister_works
	task_type = task_type_general
	task_progress = task_progress_infinite
	monthly_on_action = aureliani_works_task_monthly_on_action
	is_valid_showing_failures_only = { custom_description = { text = aureliani_office_req_task_holder aureliani_senate_office_rostered_trigger = yes } }
	is_shown = { aureliani_senate_office_rostered_trigger = yes }
	asset = {
		icon = "gfx/interface/icons/council_task_types/task_collect_taxes.dds"
		background = "gfx/interface/buttons/button_round_bg.dds"
		frame = "gfx/interface/buttons/button_round_frame.dds"
		glow = "gfx/particles/halo.dds"
	}

	on_start_task = {
		scope:councillor_liege.capital_county = {
			remove_county_modifier = aureliani_office_task_works_maintained
			remove_county_modifier = aureliani_office_task_works_maintained_carefully
		}
		if = {
			limit = { aureliani_office_task_treasurer_scale >= 1.1 }
			scope:councillor_liege.capital_county = { add_county_modifier = { modifier = aureliani_office_task_works_maintained_carefully days = 45 } }
		}
		else = { scope:councillor_liege.capital_county = { add_county_modifier = { modifier = aureliani_office_task_works_maintained days = 45 } } }
	}
	on_monthly = {
		scope:councillor_liege.capital_county = {
			remove_county_modifier = aureliani_office_task_works_maintained
			remove_county_modifier = aureliani_office_task_works_maintained_carefully
		}
		if = {
			limit = { aureliani_office_task_treasurer_scale >= 1.1 }
			scope:councillor_liege.capital_county = { add_county_modifier = { modifier = aureliani_office_task_works_maintained_carefully days = 45 } }
		}
		else = { scope:councillor_liege.capital_county = { add_county_modifier = { modifier = aureliani_office_task_works_maintained days = 45 } } }
	}
	on_cancel_task = {
		scope:councillor_liege.capital_county = {
			remove_county_modifier = aureliani_office_task_works_maintained
			remove_county_modifier = aureliani_office_task_works_maintained_carefully
		}
	}
	effect_desc = { first_valid = { triggered_desc = { trigger = { aureliani_office_task_treasurer_scale >= 1.1 } desc = aureliani_task_works_maintenance_good_desc } desc = aureliani_task_works_maintenance_desc } }
}

aureliani_task_works_projects = {
	position = aureliani_minister_works
	task_type = task_type_general
	task_progress = task_progress_percentage
	restart_on_finish = yes
	monthly_on_action = aureliani_works_task_monthly_on_action
	is_valid_showing_failures_only = { custom_description = { text = aureliani_office_req_task_holder aureliani_senate_office_rostered_trigger = yes } }
	is_shown = { aureliani_senate_office_rostered_trigger = yes }
	asset = {
		icon = "gfx/interface/icons/council_task_types/task_manage_talent.dds"
		background = "gfx/interface/buttons/button_round_bg.dds"
		frame = "gfx/interface/buttons/button_round_frame.dds"
		glow = "gfx/particles/halo.dds"
	}

	effect_desc = {
		first_valid = {
			triggered_desc = { trigger = { aureliani_office_task_treasurer_scale >= 1.1 } desc = aureliani_task_works_projects_good_desc }
			desc = aureliani_task_works_projects_desc
		}
		desc = aureliani_task_commission_rules_desc
		desc = aureliani_task_completion_cost_desc
	}
	progress = {
		value = 0
		add = { value = 6 desc = aureliani_task_base_progress }
		add = { value = stewardship multiply = 0.15 desc = aureliani_task_skill_progress }
		if = { limit = { has_trait = diligent } add = { value = 1 desc = aureliani_task_diligence_progress } }
		if = { limit = { aureliani_senator_personal_support_trigger = yes } add = { value = 1 desc = aureliani_task_faction_progress } }
		if = { limit = { opinion = { target = scope:councillor_liege value >= 20 } } add = { value = 1 desc = aureliani_task_opinion_progress } }
		if = { limit = { opinion = { target = scope:councillor_liege value <= -20 } } subtract = { value = 2 desc = aureliani_task_opinion_progress } }
	}
	on_finish_task = {
		if = {
			limit = { scope:councillor_liege = { gold >= 50 } }
			scope:councillor_liege = { remove_short_term_gold = 50 }
			scope:councillor_liege.capital_county = { remove_county_modifier = aureliani_task_works_improved remove_county_modifier = aureliani_task_works_completed }
			if = { limit = { aureliani_office_task_treasurer_scale >= 1.1 } scope:councillor_liege.capital_county = { change_development_progress_with_overflow = 10 } }
			else = { scope:councillor_liege.capital_county = { change_development_progress_with_overflow = 5 } }
		}
	}
}

aureliani_task_war_readiness = {
	default_task = yes
	position = aureliani_minister_war
	task_type = task_type_general
	task_progress = task_progress_infinite
	monthly_on_action = aureliani_fifth_task_monthly_on_action
	is_valid_showing_failures_only = { custom_description = { text = aureliani_office_req_task_holder aureliani_senate_office_rostered_trigger = yes } }
	is_shown = { aureliani_senate_office_rostered_trigger = yes }
	asset = {
		icon = "gfx/interface/icons/council_task_types/task_train_commanders.dds"
		background = "gfx/interface/buttons/button_round_bg.dds"
		frame = "gfx/interface/buttons/button_round_frame.dds"
		glow = "gfx/particles/halo.dds"
	}

	council_owner_modifier = { name = aureliani_task_war_readiness levy_reinforcement_rate = 0.35 scale = aureliani_office_task_war_scale }
	effect_desc = { desc = aureliani_task_war_readiness_desc }
}

aureliani_task_war_supply = {
	position = aureliani_minister_war
	task_type = task_type_general
	task_progress = task_progress_percentage
	restart_on_finish = yes
	monthly_on_action = aureliani_fifth_task_monthly_on_action
	is_valid_showing_failures_only = { custom_description = { text = aureliani_office_req_task_holder aureliani_senate_office_rostered_trigger = yes } }
	is_shown = { aureliani_senate_office_rostered_trigger = yes }
	asset = {
		icon = "gfx/interface/icons/council_task_types/task_organize_levies.dds"
		background = "gfx/interface/buttons/button_round_bg.dds"
		frame = "gfx/interface/buttons/button_round_frame.dds"
		glow = "gfx/particles/halo.dds"
	}
	effect_desc = {
		first_valid = {
			triggered_desc = { trigger = { aureliani_office_task_war_scale >= 1.1 } desc = aureliani_task_war_supply_good_desc }
			desc = aureliani_task_war_supply_desc
		}
		desc = aureliani_task_commission_rules_desc
		desc = aureliani_task_completion_cost_desc
	}
	progress = {
		value = 0
		add = { value = 6 desc = aureliani_task_base_progress }
		add = { value = martial multiply = 0.15 desc = aureliani_task_skill_progress }
		if = { limit = { has_trait = diligent } add = { value = 1 desc = aureliani_task_diligence_progress } }
		if = { limit = { aureliani_senator_personal_support_trigger = yes } add = { value = 1 desc = aureliani_task_faction_progress } }
		if = { limit = { opinion = { target = scope:councillor_liege value >= 20 } } add = { value = 1 desc = aureliani_task_opinion_progress } }
		if = { limit = { opinion = { target = scope:councillor_liege value <= -20 } } subtract = { value = 2 desc = aureliani_task_opinion_progress } }
	}
	on_finish_task = {
		if = {
			limit = { scope:councillor_liege = { gold >= 75 } }
			scope:councillor_liege = { remove_short_term_gold = 75 remove_character_modifier = aureliani_task_army_provisioned remove_character_modifier = aureliani_task_army_supplied remove_character_modifier = aureliani_task_retinues_supplied }
			if = { limit = { aureliani_office_task_war_scale >= 1.1 } scope:councillor_liege = { add_martial_lifestyle_xp = 150 } }
			else = { scope:councillor_liege = { add_martial_lifestyle_xp = 100 } }
		}
	}
}

aureliani_task_justice_petitions = {
	default_task = yes
	position = aureliani_minister_justice
	task_type = task_type_general
	task_progress = task_progress_infinite
	monthly_on_action = aureliani_fifth_task_monthly_on_action
	is_valid_showing_failures_only = { custom_description = { text = aureliani_office_req_task_holder aureliani_senate_office_rostered_trigger = yes } }
	is_shown = { aureliani_senate_office_rostered_trigger = yes }
	asset = {
		icon = "gfx/interface/icons/council_task_types/task_justify_rule.dds"
		background = "gfx/interface/buttons/button_round_bg.dds"
		frame = "gfx/interface/buttons/button_round_frame.dds"
		glow = "gfx/particles/halo.dds"
	}

	council_owner_modifier = { name = aureliani_task_justice_petitions tyranny_loss_mult = 0.25 scale = aureliani_office_task_justice_scale }
	effect_desc = { desc = aureliani_task_justice_petitions_desc }
}

aureliani_task_justice_inquiries = {
	position = aureliani_minister_justice
	task_type = task_type_general
	task_progress = task_progress_percentage
	restart_on_finish = yes
	monthly_on_action = aureliani_fifth_task_monthly_on_action
	is_valid_showing_failures_only = { custom_description = { text = aureliani_office_req_task_holder aureliani_senate_office_rostered_trigger = yes } }
	is_shown = { aureliani_senate_office_rostered_trigger = yes }
	asset = {
		icon = "gfx/interface/icons/council_task_types/task_manage_talent.dds"
		background = "gfx/interface/buttons/button_round_bg.dds"
		frame = "gfx/interface/buttons/button_round_frame.dds"
		glow = "gfx/particles/halo.dds"
	}
	effect_desc = {
		first_valid = {
			triggered_desc = { trigger = { aureliani_office_task_justice_scale >= 1.1 } desc = aureliani_task_justice_inquiries_good_desc }
			desc = aureliani_task_justice_inquiries_desc
		}
		desc = aureliani_task_commission_rules_desc
		desc = aureliani_task_justice_completion_cost_desc
	}
	progress = {
		value = 0
		add = { value = 6 desc = aureliani_task_base_progress }
		add = { value = learning multiply = 0.15 desc = aureliani_task_skill_progress }
		if = { limit = { has_trait = just } add = { value = 1 desc = aureliani_task_diligence_progress } }
		if = { limit = { aureliani_senator_personal_support_trigger = yes } add = { value = 1 desc = aureliani_task_faction_progress } }
		if = { limit = { opinion = { target = scope:councillor_liege value >= 20 } } add = { value = 1 desc = aureliani_task_opinion_progress } }
		if = { limit = { opinion = { target = scope:councillor_liege value <= -20 } } subtract = { value = 2 desc = aureliani_task_opinion_progress } }
	}
	on_finish_task = {
		if = {
			limit = { scope:councillor_liege = { prestige >= 50 capital_county = { county_control < 100 } } }
			scope:councillor_liege = { add_prestige = -50 remove_character_modifier = aureliani_task_appeals_heard remove_character_modifier = aureliani_task_appeals_settled }
			if = { limit = { aureliani_office_task_justice_scale >= 1.1 } scope:councillor_liege.capital_county = { change_county_control = 10 } }
			else = { scope:councillor_liege.capital_county = { change_county_control = 5 } }
		}
	}
}
