﻿# The chance curve exactly follows vanilla's 1.19 Legendary Game assignment:
# terrible 1%, poor 2%, average 4%, good 9%, excellent 17% per yearly pulse.

cagm_master_fisher_seek_legendary_catch = {
	court_position_types = { cagm_master_fisher_court_position }

	is_shown = { is_landed = yes }
	is_valid_showing_failures_only = { }

	cost = {
		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" }
			}
		}
		round = no
	}

	employee_modifier = { monthly_prestige = 0.25 stress_gain_mult = -0.10 }

	on_yearly = {
		if = {
			limit = {
				scope:liege = {
					is_alive = yes
					NOT = { has_character_flag = cagm_fishing_legendary_rumor }
				}
			}
			random = {
				chance = {
					value = 1
					if = { limit = { aptitude = { court_position = cagm_master_fisher_court_position value >= 1 } } add = 1 }
					if = { limit = { aptitude = { court_position = cagm_master_fisher_court_position value >= 2 } } add = 2 }
					if = { limit = { aptitude = { court_position = cagm_master_fisher_court_position value >= 3 } } add = 5 }
					if = { limit = { aptitude = { court_position = cagm_master_fisher_court_position value >= 4 } } add = 8 }
				}
				scope:liege = { cagm_grant_fishing_legendary_rumor_effect = yes }
			}
		}
	}

	on_start = { custom_tooltip = cagm_master_fisher_seek_legendary_catch_tt }
	on_end = { }

	ai_will_do = {
		value = 35
		if = { limit = { scope:liege = { has_character_flag = cagm_fishing_legendary_rumor } } add = -1000 }
	}
}

cagm_master_whaler_seek_legendary_leviathan = {
	court_position_types = { cagm_master_whaler_court_position }

	is_shown = {
		is_landed = yes
		cagm_whaling_practice_access_trigger = yes
	}
	is_valid_showing_failures_only = {
		scope:liege = { cagm_whaling_practice_access_trigger = yes }
	}

	cost = {
		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" }
			}
		}
		round = no
	}

	employee_modifier = { monthly_prestige = 0.35 stress_gain_mult = 0.05 }

	on_yearly = {
		if = {
			limit = {
				scope:liege = {
					is_alive = yes
					cagm_whaling_practice_access_trigger = yes
					NOT = { has_character_flag = cagm_whaling_legendary_rumor }
				}
			}
			random = {
				chance = {
					value = 1
					if = { limit = { aptitude = { court_position = cagm_master_whaler_court_position value >= 1 } } add = 1 }
					if = { limit = { aptitude = { court_position = cagm_master_whaler_court_position value >= 2 } } add = 2 }
					if = { limit = { aptitude = { court_position = cagm_master_whaler_court_position value >= 3 } } add = 5 }
					if = { limit = { aptitude = { court_position = cagm_master_whaler_court_position value >= 4 } } add = 8 }
				}
				scope:liege = { cagm_grant_whaling_legendary_rumor_effect = yes }
			}
		}
	}

	on_start = { custom_tooltip = cagm_master_whaler_seek_legendary_leviathan_tt }
	on_end = { }

	ai_will_do = {
		value = 35
		if = { limit = { scope:liege = { has_character_flag = cagm_whaling_legendary_rumor } } add = -1000 }
	}
}
