﻿smuggler_task_monitor_camp_supplies = {
	court_position_types = { 
		smuggler_court_position 
	}
	is_shown = {
		NOR = {
			is_landed_or_landless_administrative = yes
			government_has_flag = government_is_nomadic
		}
	}
	is_valid_showing_failures_only = {
	}
	cost = {
		round = no
		prestige = {
			add = {
				value = monthly_court_position_task_cost
				multiply = 2
				desc = COURT_POSITION_TASK_COST_BREAKDOWN_BASE
				format = "BASE_VALUE_FORMAT_DECIMALS_PLUS_NEGATIVE"
			}
		}
	}

	on_start = {
		scope:liege = {
			set_variable = {
				name = smuggler_is_monitoring_supplies
				value = yes
			}
		}
		custom_tooltip = increased_smuggle_artifact_defense_tt
	}

	on_monthly = {
		if = {
			limit = { scope:liege.var:smuggler_is_monitoring_supplies = no }
			set_variable = {
				name = smuggler_is_monitoring_supplies
				value = yes
			}
		}
	}

	on_end = { 
		# remove_character_flag = blocked_from_leaving # Removing travel block
		scope:liege = {
			set_variable = {
				name = smuggler_is_monitoring_supplies
				value = no
			}
		}
	}

	scaling_employer_modifiers = {
		terrible = {
			character_travel_speed = 5
			supply_duration = 0.1
		}
		poor = {
			character_travel_speed = 5
			supply_duration = 0.15
		}
		average = {
			character_travel_speed = 10
			supply_duration = 0.2
		}
		good = {
			character_travel_speed = 10
			supply_duration = 0.25
		}
		excellent = {
			character_travel_speed = 15
			supply_duration = 0.3
		}
	}

	ai_will_do = {
		value = {
			add = 25
			add = ai_compassion
			add = ai_rationality
			subtract = ai_greed
		}
	}
}

smuggler_task_plan_heist = {
	court_position_types = { 
		smuggler_court_position
	}
	is_shown = {
	}
	is_valid_showing_failures_only = {
	}
	cost = {
		round = no
		gold = {
			value = 0
			if = {
				limit = {
					scope:liege = {
						has_treasury = no
					}
				}
			}
			add = {
				value = monthly_court_position_task_cost
				desc = COURT_POSITION_TASK_COST_BREAKDOWN_BASE
				format = "BASE_VALUE_FORMAT_DECIMALS_PLUS_NEGATIVE"
			}
		}
		treasury = {
			value = 0
			if = {
				limit = {
					scope:liege = {
						has_treasury = yes
					}
				}
				add = {
					value = monthly_court_position_task_cost
					desc = COURT_POSITION_TASK_COST_BREAKDOWN_BASE
					format = "BASE_VALUE_FORMAT_DECIMALS_PLUS_NEGATIVE"
				}
			}
		}
	}

	employee_modifier = {
		monthly_prestige = minor_court_position_task_prestige_salary
	}

	# Set Planning Heist variable on start
	on_start = { 
		# add_character_flag = blocked_from_leaving # Stop character from traveling
		scope:liege = {
			set_variable = {
				name = smuggler_is_planning_heist
				value = yes
			}
		}
		custom_tooltip = allow_steal_artifact_scheme_tt
	}

	# If it's fallen off while still working, reapply when we can; this can happen if say a Liege dies
	on_monthly = {
		if = {
			limit = { scope:liege.var:smuggler_is_planning_heist = no }
			set_variable = {
				name = smuggler_is_planning_heist
				value = yes
			}
		}
	}

	on_end = { 
		# remove_character_flag = blocked_from_leaving # Removing travel block
		scope:liege = {
			set_variable = {
				name = smuggler_is_planning_heist
				value = no
			}
		}
	}

	ai_will_do = {
		value = {
			add = 25
			add = ai_greed
			add = ai_boldness
			subtract = ai_honor
			subtract = ai_compassion
		}
	}
}

smuggler_task_plan_prison_break = {
	court_position_types = { 
		smuggler_court_position
	}
	is_shown = {
	}
	is_valid_showing_failures_only = {
	}
	cost = {
		round = no
		gold = {
			value = 0
			if = {
				limit = {
					scope:liege = {
						has_treasury = no
					}
				}
			}
			add = {
				value = monthly_court_position_task_cost
				desc = COURT_POSITION_TASK_COST_BREAKDOWN_BASE
				format = "BASE_VALUE_FORMAT_DECIMALS_PLUS_NEGATIVE"
			}
		}
		treasury = {
			value = 0
			if = {
				limit = {
					scope:liege = {
						has_treasury = yes
					}
				}
				add = {
					value = monthly_court_position_task_cost
					desc = COURT_POSITION_TASK_COST_BREAKDOWN_BASE
					format = "BASE_VALUE_FORMAT_DECIMALS_PLUS_NEGATIVE"
				}
			}
		}
	}

	employee_modifier = {
		monthly_prestige = minor_court_position_task_prestige_salary
	}

	# Set Planning Prison Break variable on start
	on_start = { 
		# add_character_flag = blocked_from_leaving # Stop character from traveling
		scope:liege = {
			set_variable = {
				name = smuggler_is_planning_prison_break
				value = yes
			}
		}
		custom_tooltip = allow_break_out_of_prison_scheme_tt
	}

	# If it's fallen off while still working, reapply when we can; this can happen if say a Liege dies
	on_monthly = {
		if = {
			limit = { scope:liege.var:smuggler_is_planning_prison_break = no }
			set_variable = {
				name = smuggler_is_planning_prison_break
				value = yes
			}
		}
	}

	on_end = { 
		# remove_character_flag = blocked_from_leaving # Removing travel block
		scope:liege = {
			set_variable = {
				name = smuggler_is_planning_prison_break
				value = no
			}
		}
	}

	ai_will_do = {
		value = {
			add = 25
			add = ai_compassion
			subtract = ai_greed
		}
	}
}

smuggler_task_monitor_supplies = {
	court_position_types = { 
		smuggler_court_position 
	}
	is_shown = {
		OR = {
			is_landed_or_landless_administrative = yes
			government_has_flag = government_is_nomadic
		}
	}
	is_valid_showing_failures_only = {
	}
	cost = {
		round = no
		prestige = {
			add = {
				value = monthly_court_position_task_cost
				multiply = 2
				desc = COURT_POSITION_TASK_COST_BREAKDOWN_BASE
				format = "BASE_VALUE_FORMAT_DECIMALS_PLUS_NEGATIVE"
			}
		}
	}

	on_start = {
		scope:liege = {
			set_variable = {
				name = smuggler_is_monitoring_supplies
				value = yes
			}
		}
		custom_tooltip = increased_smuggle_artifact_defense_tt
	}

	on_monthly = {
		if = {
			limit = { scope:liege.var:smuggler_is_monitoring_supplies = no }
			set_variable = {
				name = smuggler_is_monitoring_supplies
				value = yes
			}
		}
	}

	on_end = { 
		# remove_character_flag = blocked_from_leaving # Removing travel block
		scope:liege = {
			set_variable = {
				name = smuggler_is_monitoring_supplies
				value = no
			}
		}
	}

	scaling_employer_modifiers = {
		terrible = {
			supply_limit_mult = 0.04
			build_speed = -0.05
		}
		poor = {
			supply_limit_mult = 0.08
			build_speed = -0.1
		}
		average = {
			build_speed = -0.15
			supply_limit_mult = 0.12
		}
		good = {
			build_speed = -0.2
			supply_limit_mult = 0.16
		}
		excellent = {
			build_speed = -0.3
			supply_limit_mult = 0.2
		}
	}

	ai_will_do = {
		value = {
			add = 25
			add = ai_compassion
			add = ai_rationality
			subtract = ai_greed
		}
	}
}
