##########################################
# COUNCILLOR ACTIONS
##########################################
# attribute = [diplomacy/stewardship/intrigue/martial/learning] - Character attribute is multiplied with the modifiers
# trigger = Province scope trigger to determine if the action is meaningful in a province (the player character is FROM)
# Events that can trigger off this action. This info is only used by the GUI.
# All modifiers (like 'local_build_time_modifier') are multiplied by the attribute


# display_on_map = {
#	tooltip = JOB_PROSELYTIZE_DIFFERENT_RELIGION  # Key of the loc to add to the tooltip
#	trigger = {                                   # Trigger for when this should happen. Same scopes as the allow/potential for the job action itself
#		NOT = { religion = FROM }
#	}
#	color = { 255 0 0 }                           # What color to use on the map
# }

# Chancellor
action_improve_relations = {
	attribute = diplomacy
	
	potential = {
	}

	trigger = {
		any_province_lord = {
			NOT = { character = FROM }
			is_theocracy = no
		}
		is_within_diplo_range = FROM
	}

	events = { 910 911 912 }
}

action_clan_sentiment = {
	attribute = diplomacy
	
	potential = {
		FROM = {
			is_nomadic = yes
		}
	}
	
	trigger = {
		owner = {
			is_nomadic = yes
			NOT = { character = FROM }

			FROM = {
				job_chancellor = {
					NOT = { character = PREVPREV } # Can't be sent to improve relations with himself...
				}
			}
			
			OR = {
				vassal_of = FROM
				same_liege = FROM
				overlord_of = FROM
			}
		}
	}
	
	events = { 20235 }
}

action_fabricate_claims = {
	attribute = diplomacy

	potential = {
		FROM = {
			prestige = 0
			wealth = 0
			is_nomadic = no			
		}
	}
	trigger = {
		OR = {
			county = {
				NOT = { claimed_by = FROM }
				holder_scope = {
					NOT = { character = FROM }
					FROM = {
						job_chancellor = {
							NOT = { character = PREVPREV } # Can't be sent to improve relations with himself...
						}
					}
				}
			}
			duchy = {
				NOT = { claimed_by = FROM }
				holder_scope = {
					NOT = { character = FROM }
					FROM = {
						job_chancellor = {
							NOT = { character = PREVPREV } # Can't be sent to improve relations with himself...
						}
					}
				}
			}
		}
		is_within_diplo_range = FROM
	}

	events = { 913 914 }
}

action_sow_dissent = {
	attribute = diplomacy

	potential = {
	}
	
	trigger = {
		OR = {
			any_province_lord = {
				NOT = { character = FROM }
				NOT = { is_liege_or_above = FROM }
			}
			owner = {
				NOT = { character = FROM }
				religion = ROOT
				religion = FROM
				any_vassal = {
					NOT = { character = FROM }
					OR = { higher_tier_than = baron is_patrician = yes }
				}
			}
		}
		is_within_diplo_range = FROM
	}

	events = { 916 917 }
}

action_statecraft = {
	attribute = diplomacy

	potential = {
		has_dlc = Mystics
	}

	liege_modifier = statecraft_liege_mod

	offmap = yes
	
	events = { MNM.78000 MNM.78003 } 
}

# Steward
action_squeeze_peasants = {
	attribute = stewardship

	potential = {
		FROM = {
			is_tribal = no
			is_nomadic = no
		}
	}

	trigger = {
		any_province_lord = {
			character = FROM
		}
	}

	local_tax_modifier = 0.025

	events = { 920 921 }
}

action_collect_tribute = {
	attribute = stewardship

	potential = {
		FROM = {
			is_nomadic = yes
		}
	}

	trigger = {
		num_of_settlements = 1
		any_province_lord = {
			NOT = { character = FROM }
			
			FROM = {
				job_treasurer = {
					NOT = { character = PREVPREV } # Can't be sent to himself...
				}
			}
			
			OR = {
				vassal_of = FROM
				pays_tribute_to = FROM
			}
			capital_scope = {
				province = ROOT
			}
		}
	}
	
	events = { 20225 }
}

action_settle_tribe = {
	attribute = stewardship

	potential = {
		FROM = {
			OR = {
				is_tribal = yes
				is_nomadic = yes
			}
		}
	}

	trigger = {
		owner = {
			character = FROM
		}
		OR = {
			NOT = { culture = FROM }
			AND = {
				FROM = { is_tribal = yes }
				num_of_empty_holdings = 1
				culture = FROM
				NOT = { any_province_holding = { holding_type = city } }
				NOT = { has_province_modifier = building_new_city }
			}
		}
	}
	
	events = { 925 20206 940 }
}

action_oversee_construction = {
	attribute = stewardship

	potential = {
	}
	
	trigger = {
		any_province_lord = {
			character = FROM
		}
	}

	local_build_time_modifier = -0.025

	events = { 923 924 }
}

action_advance_eco_tech = {
	attribute = stewardship

	potential = {
		FROM = {
			is_tribal = no
			is_nomadic = no			
		}
	}

	trigger = {
		any_province_lord = {
			character = FROM
		}
		technology_can_spread = yes
	}

	tech_growth_modifier_economy = 0.05

	events = { 320500 320502 }
}

action_build_legend = {
	attribute = stewardship

	potential = {
		FROM = {
			is_tribal = yes
		}
	}

	trigger = {
		FROM = {
			is_capital = PREV
		}
	}
	
	monthly_character_prestige = 0.1
	
	events = { 20208 }
}

action_administer_realm = {
	attribute = stewardship

	potential = {
		has_dlc = Mystics
	}

	offmap = yes
	
	events = { MNM.70005 MNM.78007 }
}

# Spymaster
action_uncover_plots = {
	attribute = intrigue
	
	potential = {
		NOT = { has_dlc = Mystics }
	}
	
	trigger = {
		any_province_lord = {
			OR = {
				character = FROM
				is_liege_or_above = FROM
				same_liege = FROM
			}
		}
	}

	plot_discovery_chance = 0.005

	events = { 929 }
}

action_uncover_plots_offmap = {
	attribute = intrigue
	
	potential = {
		has_dlc = Mystics
	}
	
	offmap = yes

	plot_discovery_chance = 0.01
	
	events = { 929 MNM.70024 MNM.70023 }
}

action_study_technology = {
	attribute = intrigue
	
	potential = {
	}

	trigger = {
		has_higher_tech_than = FROM
		any_province_lord = {
			NOT = { is_liege_or_above = FROM }
			NOT = { character = FROM }
		}
		is_within_diplo_range = FROM
	}

	events = { 932 933 }
}

action_organize_spies = {
	attribute = intrigue
	
	potential = {
		NOT = {
			has_dlc = "Mystics"
		}
	}

	trigger = {
		FROM = {
			is_capital = PREV
		}
	}

	plot_power_modifier = 0.005

	events = { 935 936 }
}

action_organize_spies_mystics = {
	attribute = intrigue
	
	potential = {
		has_dlc = "Mystics"
	}
	
	trigger = {
		any_province_lord = {
			NOT = { character = FROM }
		}
		is_within_diplo_range = FROM
	}
	
	plot_power_modifier = 0.005
	
	events = { 935 936 931 9000 9020 }
}

action_sabotage_province = {
	attribute = intrigue

	potential = {
		has_dlc = Mystics
	}

	trigger = {
		any_province_lord = {
			NOT = {
				tier = BARON
			}
			NOT = { character = FROM }
		}
		can_be_sabotaged_trigger = yes
		is_within_diplo_range = FROM
	}
	
	events = { MNM.70020 933 }
}

# Marshal
action_advance_mil_tech = {
	attribute = martial

	potential = {
		FROM = {
			is_tribal = no
		}
	}
	
	trigger = {
		any_province_lord = {
			character = FROM
		}
	}

	tech_growth_modifier_military = 0.05

	events = { 938 939 }
}

action_organize_raid = {
	attribute = martial

	potential = {
		FROM = {
			is_tribal = yes
		}
	}

	trigger = {
		FROM = {
			is_capital = PREV
		}
	}
	
	events = { 20221 }
}

action_train_troops = {
	attribute = martial
	
	potential = {
		FROM = {
			is_nomadic = no
		}
	}

	trigger = {
		any_province_lord = {
			OR = {
				character = FROM
				is_liege_or_above = FROM
			}
		}
	}

	levy_size = 0.025
	levy_reinforce_rate = 0.05

	events = { 941 942 }
}

action_train_troops_nomadic = {
	attribute = martial
	
	potential = {
		FROM = {
			is_nomadic = yes
		}
	}

	trigger = {
		FROM = {
			is_capital = ROOT
		}
	}
	
	manpower_growth = 0.015
	
	events = { }
}

action_assist_arrest = {
	attribute = martial
	
	potential = {
	}

	trigger = {
		any_province_lord = {
			OR = {
				character = FROM
				is_liege_or_above = FROM
			}
		}
	}

	arrest_chance_modifier = 0.01
	local_revolt_risk = -0.005

	events = { 944 }
}

action_organize_army = {
	attribute = martial

	potential = {
		has_dlc = Mystics
	}

	offmap = yes
	
	liege_modifier = organize_army_liege_mod
	
	attribute_cap = 25
	
	events = { MNM.70010 MNM.70012 MNM.70015 } 
}

# Lord Spiritual
action_inquisition = {
	attribute = learning

	potential = {
		FROM = {
			OR = {
				ai = no
				NOT = { religion_group = muslim }
				PREV = {
					is_heresy_of = FROM
				}
				PREV = {
					is_parent_religion = FROM
				}
			}
		}
		NOT = {
			FROM = {
				top_liege = {
					religion = tengri_pagan
					OR = {
						has_landed_title = e_il-khanate
						has_landed_title = e_golden_horde
					}
				}
			}
		}
	}
	trigger = {
		num_of_settlements = 1
		NAND = {
			FROM = { job_spiritual = { has_character_modifier = spiritual_refused_pagans } }  # See Event ZE.5040
			owner = {
				is_pagan_religion = yes
				is_reformed_pagan_religion = no
			}
		}
		FROM = {
			OR = {
				ai = no
				NOT = { religion_group = muslim }
				PREV = {
					is_heresy_of = FROM
				}
				PREV = {
					is_parent_religion = FROM
				}
			}
		}
		NOT = {
			FROM = {
				top_liege = {
					religion = tengri_pagan
					OR = {
						has_landed_title = e_il-khanate
						has_landed_title = e_golden_horde
					}
				}
			}
		}
		OR = {
			owner = {
				FROM = {
					OR = {
						is_pagan_religion = no
						is_reformed_pagan_religion = yes
					}
					OR = {
						NOT = { religion_group = indian_group }
						ai = no
					}
				}
				independent = yes
				NOR = {
					rightful_religious_head_scope = { character = PREV }
					religion = FROM
					is_heresy_of = FROM
					is_parent_religion = FROM
				}
				is_pagan_religion = yes
				is_reformed_pagan_religion = no
				capital_scope = { province = ROOT }
				controls_religion = no
				FROM = {
					higher_tier_than = COUNT
					OR = {
						independent = yes
						higher_tier_than = DUKE
					}
				}
				NOT = {
					has_opinion_modifier = { who = FROM modifier = opinion_sent_preacher }
				}
			}
			AND = {
				NOT = { religion = FROM }
				any_province_lord = {
					OR = {
						character = FROM
						is_liege_or_above = FROM
					}
				}
			}
		}
		is_within_diplo_range = FROM
	}
	display_on_map = {
		tooltip = JOB_PROSELYTIZE_SAME_RELIGION
		trigger = {
			religion = FROM
			any_province_lord = {
				OR = {
					character = FROM
					is_liege_or_above = FROM
				}
			}
		}
		color = { 0 0 255 }
	}
	display_on_map = {
		tooltip = JOB_PROSELYTIZE_DIFFERENT_RELIGION
		trigger = {
			NOT = { religion = FROM }
			any_province_lord = {
				OR = {
					character = FROM
					is_liege_or_above = FROM
				}
			}
		}
		color = { 0 255 0 }
	}
	
	display_on_map = {
		tooltip = JOB_PROSELYTIZE_CONVERT_INDEPENDENT
		trigger = {
			proselytize_convert_independent_trigger = yes
		}
		color = { 255 35 35 }
	}
	events = { 900 901 902 903 39651 39652 39653 39656 }
}

action_improve_rel_relations = {
	attribute = learning

	potential = {
		FROM = {
			NOT = { religion_group = muslim }
		}
	}
	
	trigger = {
		any_province_lord = {
			religion = FROM
			is_theocracy = yes
			FROM = {
				job_spiritual = {
					NOT = { character = PREVPREV } # Can't be sent to improve relations with himself...
				}
			}
		}
		is_within_diplo_range = FROM
	}

	events = { 906 907 }
}

action_advance_cul_tech = {
	attribute = learning

	potential = {
		FROM = {
			is_tribal = no
		}
	}
	
	trigger = {
		any_province_lord = {
			OR = {
				character = FROM
				is_liege_or_above = FROM
			}
		}
		technology_can_spread = yes
	}

	tech_growth_modifier_culture = 0.05

	events = { 926 927 }
}

action_build_zeal = {
	attribute = learning

	potential = {
		FROM = {
			is_tribal = yes
		}
	}

	trigger = {
		FROM = {
			is_capital = PREV
		}
	}
	
	monthly_character_piety = 0.05
	
	events = { 20218 }
}

action_hunt_heretics = {
	attribute = learning

	potential = {
		has_dlc = Mystics
	}
	
	liege_modifier = apostate_liege_mod

	offmap = yes
	
	events = { MNM.70100 }
}

# Lord Spiritual (Muslim only)
action_charity = {
	attribute = learning

	potential = {
		FROM = { 
			religion_group = muslim 			
		}
	}

	trigger = {
		any_province_lord = {
			character = FROM
		}
	}

	local_revolt_risk = -0.002

	events = { 20040 20043 20048 20050 }
}

