##########################################
# 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

# Chancellor
action_improve_relations = {
	attribute = diplomacy
	
	potential = {
		FROM = {
			job_chancellor = {
				NOT = {
					has_character_modifier = in_seclusion
				}
			}
		}
	}

	trigger = {
		any_province_lord = {
			OR = { higher_tier_than = baron is_patrician = yes }
			NOT = { character = FROM }
			is_theocracy = no
			FROM = {
				job_chancellor = {
					NOT = { character = PREVPREV } # Can't be sent to improve relations with himself...
				}
			}
		}
		is_within_diplo_range = FROM
	}

	events = { 910 911 912 }
}

action_clan_sentiment = {
	attribute = diplomacy
	
	potential = {
		FROM = {
			is_nomadic = yes			
			job_chancellor = {
				NOT = {
					has_character_modifier = in_seclusion
				}
			}	
		}		
	}
	
	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			
			job_chancellor = {
				NOT = {
					has_character_modifier = in_seclusion
				}
			}	
		}
	}
	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 = {
		FROM = {
			job_chancellor = {
				NOT = {
					has_character_modifier = in_seclusion
				}
			}
		}
	}
	
	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 }
}

# Steward
action_squeeze_peasants = {
	attribute = stewardship

	potential = {
		FROM = {
			is_tribal = no
			is_nomadic = no		
			job_treasurer = {
				NOT = {
					has_character_modifier = in_seclusion
				}
			}	
		}
	}

	trigger = {
		any_province_lord = {
			character = FROM
		}
	}

	local_tax_modifier = 0.025

	events = { 920 921 }
}

action_collect_tribute = {
	attribute = stewardship

	potential = {
		FROM = {
			is_nomadic = yes			
			job_treasurer = {
				NOT = {
					has_character_modifier = in_seclusion
				}
			}		
		}
	}

	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
			}			
			job_treasurer = {
				NOT = {
					has_character_modifier = in_seclusion
				}
			}	
		}
	}

	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 = {
		FROM = {
			job_treasurer = {
				NOT = {
					has_character_modifier = in_seclusion
				}
			}
		}
	}
	
	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			
			job_treasurer = {
				NOT = {
					has_character_modifier = in_seclusion
				}
			}	
		}
	}

	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			
			job_treasurer = {
				NOT = {
					has_character_modifier = in_seclusion
				}
			}	
		}
	}

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

# Spymaster
action_uncover_plots = {
	attribute = intrigue
	
	potential = {
		FROM = {
			job_spymaster = {
				NOT = {
					has_character_modifier = in_seclusion
				}
			}
		}
	}
	
	trigger = {
		any_province_lord = {
			OR = {
				character = FROM
				is_liege_or_above = FROM
				same_liege = FROM
			}
		}
	}

	plot_discovery_chance = 0.005

	events = { 929 }
}

action_study_technology = {
	attribute = intrigue
	
	potential = {
		FROM = {
			job_spymaster = {
				NOT = {
					has_character_modifier = in_seclusion
				}
			}
		}
	}

	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 = {
		FROM = {
			job_spymaster = {
				NOT = {
					has_character_modifier = in_seclusion
				}
			}
		}
	}

	trigger = {
		FROM = {
			is_capital = PREV
		}
	}

	plot_power_modifier = 0.005

	events = { 935 936 }
}

# Marshal
action_advance_mil_tech = {
	attribute = martial

	potential = {
		FROM = {
			is_tribal = no			
			job_marshal = {
				NOT = {
					has_character_modifier = in_seclusion
				}
			}	
		}
	}
	
	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			
			job_marshal = {
				NOT = {
					has_character_modifier = in_seclusion
				}
			}	
		}
	}

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

action_train_troops = {
	attribute = martial
	
	potential = {
		FROM = {
			is_nomadic = no			
			job_marshal = {
				NOT = {
					has_character_modifier = in_seclusion
				}
			}	
		}
	}

	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			
			job_marshal = {
				NOT = {
					has_character_modifier = in_seclusion
				}
			}	
		}
	}

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

action_assist_arrest = {
	attribute = martial
	
	potential = {
		FROM = {
			job_marshal = {
				NOT = {
					has_character_modifier = in_seclusion
				}
			}
		}
	}

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

	arrest_chance_modifier = 0.01
	local_revolt_risk = -0.005

	events = { 944 }
}

# Lord Spiritual
action_inquisition = {
	attribute = learning

	potential = {
		FROM = {
			job_spiritual = {
				NOT = {
					has_character_modifier = in_seclusion
				}
			}	
			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 = { religion_group = pagan_group }
		}
		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 = {
						NOT = { religion_group = pagan_group }
						is_reformed_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
				}
				religion_group = pagan_group
				is_reformed_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
	}

	events = { 900 901 902 903 39651 39652 39653 39656 }
}

action_improve_rel_relations = {
	attribute = learning

	potential = {
		FROM = {
			NOT = { religion_group = muslim }			
			job_spiritual = {
				NOT = {
					has_character_modifier = in_seclusion
				}
			}	
		}
	}

	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			
			job_spiritual = {
				NOT = {
					has_character_modifier = in_seclusion
				}
			}	
		}
	}
	
	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			
			job_spiritual = {
				NOT = {
					has_character_modifier = in_seclusion
				}
			}	
		}
	}

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

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

	potential = {
		FROM = { 
			religion_group = muslim 			
			job_spiritual = {
				NOT = {
					has_character_modifier = in_seclusion
				}
			}	
		}
	}

	trigger = {
		any_province_lord = {
			character = FROM
		}
	}

	local_revolt_risk = -0.002

	events = { 20040 20043 20048 20050 }
}

