namespace = apb_venture

# Sector choice, fired by the apb_fund_a_venture edict (country scope)
country_event = {
	id = apb_venture.1
	title = apb_venture.1.name
	desc = apb_venture.1.desc
	picture = GFX_evt_financial_instruments
	show_sound = event_administrative_work
	is_triggered_only = yes

	immediate = {
		apb_venture_reserve_slot = yes
	}

	option = {
		name = apb_venture.1.a
		trigger = { check_variable = { which = apb_vc_pending value > 0 } }
		custom_tooltip = apb_venture.1.a.tt
		hidden_effect = { apb_venture_choose = { SECTOR = 1 } }
		ai_chance = { factor = 1 }
	}
	option = {
		name = apb_venture.1.b
		trigger = { check_variable = { which = apb_vc_pending value > 0 } }
		custom_tooltip = apb_venture.1.b.tt
		hidden_effect = { apb_venture_choose = { SECTOR = 2 } }
		ai_chance = { factor = 1 }
	}
	option = {
		name = apb_venture.1.c
		trigger = { check_variable = { which = apb_vc_pending value > 0 } }
		custom_tooltip = apb_venture.1.c.tt
		hidden_effect = { apb_venture_choose = { SECTOR = 3 } }
		ai_chance = { factor = 1 }
	}
	# Safety net: every slot was already taken (should not happen; the edict checks this)
	option = {
		name = apb_venture.1.refund
		trigger = { NOT = { check_variable = { which = apb_vc_pending value > 0 } } }
		add_resource = {
			energy = 1
			mult = value:apb_venture_stake
		}
	}
}

# Venture in slot 1 matures (fired 1800 days after launch by apb_venture_launch)
country_event = {
	id = apb_venture.11
	title = apb_venture.result.name
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_1 value = 1 }
			check_variable = { which = apb_vc_outcome_1 value = 1 }
		}
		text = apb_venture.result.mining_bust
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_1 value = 1 }
			check_variable = { which = apb_vc_outcome_1 value = 2 }
		}
		text = apb_venture.result.mining_steady
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_1 value = 1 }
			check_variable = { which = apb_vc_outcome_1 value = 3 }
		}
		text = apb_venture.result.mining_boom
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_1 value = 1 }
			check_variable = { which = apb_vc_outcome_1 value = 4 }
		}
		text = apb_venture.result.mining_unicorn
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_1 value = 2 }
			check_variable = { which = apb_vc_outcome_1 value = 1 }
		}
		text = apb_venture.result.research_bust
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_1 value = 2 }
			check_variable = { which = apb_vc_outcome_1 value = 2 }
		}
		text = apb_venture.result.research_steady
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_1 value = 2 }
			check_variable = { which = apb_vc_outcome_1 value = 3 }
		}
		text = apb_venture.result.research_boom
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_1 value = 2 }
			check_variable = { which = apb_vc_outcome_1 value = 4 }
		}
		text = apb_venture.result.research_unicorn
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_1 value = 3 }
			check_variable = { which = apb_vc_outcome_1 value = 1 }
		}
		text = apb_venture.result.luxury_bust
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_1 value = 3 }
			check_variable = { which = apb_vc_outcome_1 value = 2 }
		}
		text = apb_venture.result.luxury_steady
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_1 value = 3 }
			check_variable = { which = apb_vc_outcome_1 value = 3 }
		}
		text = apb_venture.result.luxury_boom
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_1 value = 3 }
			check_variable = { which = apb_vc_outcome_1 value = 4 }
		}
		text = apb_venture.result.luxury_unicorn
	}
	picture = {
		trigger = { check_variable = { which = apb_vc_sector_1 value = 1 } }
		picture = GFX_evt_mining_operations
	}
	picture = {
		trigger = { check_variable = { which = apb_vc_sector_1 value = 2 } }
		picture = GFX_evt_engineering_research
	}
	picture = {
		trigger = { check_variable = { which = apb_vc_sector_1 value = 3 } }
		picture = GFX_evt_busy_spaceport
	}
	show_sound = event_administrative_work
	is_triggered_only = yes

	immediate = {
		apb_venture_roll = { SLOT = 1 }
	}

	option = {
		name = {
			trigger = { check_variable = { which = apb_vc_outcome_1 value = 1 } }
			text = apb_venture.result.a_bust
		}
		name = {
			trigger = { check_variable = { which = apb_vc_outcome_1 value >= 2 } }
			text = apb_venture.result.a
		}
		apb_venture_payout = { SLOT = 1 }
	}
}

# Venture in slot 2 matures (fired 1800 days after launch by apb_venture_launch)
country_event = {
	id = apb_venture.12
	title = apb_venture.result.name
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_2 value = 1 }
			check_variable = { which = apb_vc_outcome_2 value = 1 }
		}
		text = apb_venture.result.mining_bust
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_2 value = 1 }
			check_variable = { which = apb_vc_outcome_2 value = 2 }
		}
		text = apb_venture.result.mining_steady
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_2 value = 1 }
			check_variable = { which = apb_vc_outcome_2 value = 3 }
		}
		text = apb_venture.result.mining_boom
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_2 value = 1 }
			check_variable = { which = apb_vc_outcome_2 value = 4 }
		}
		text = apb_venture.result.mining_unicorn
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_2 value = 2 }
			check_variable = { which = apb_vc_outcome_2 value = 1 }
		}
		text = apb_venture.result.research_bust
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_2 value = 2 }
			check_variable = { which = apb_vc_outcome_2 value = 2 }
		}
		text = apb_venture.result.research_steady
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_2 value = 2 }
			check_variable = { which = apb_vc_outcome_2 value = 3 }
		}
		text = apb_venture.result.research_boom
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_2 value = 2 }
			check_variable = { which = apb_vc_outcome_2 value = 4 }
		}
		text = apb_venture.result.research_unicorn
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_2 value = 3 }
			check_variable = { which = apb_vc_outcome_2 value = 1 }
		}
		text = apb_venture.result.luxury_bust
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_2 value = 3 }
			check_variable = { which = apb_vc_outcome_2 value = 2 }
		}
		text = apb_venture.result.luxury_steady
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_2 value = 3 }
			check_variable = { which = apb_vc_outcome_2 value = 3 }
		}
		text = apb_venture.result.luxury_boom
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_2 value = 3 }
			check_variable = { which = apb_vc_outcome_2 value = 4 }
		}
		text = apb_venture.result.luxury_unicorn
	}
	picture = {
		trigger = { check_variable = { which = apb_vc_sector_2 value = 1 } }
		picture = GFX_evt_mining_operations
	}
	picture = {
		trigger = { check_variable = { which = apb_vc_sector_2 value = 2 } }
		picture = GFX_evt_engineering_research
	}
	picture = {
		trigger = { check_variable = { which = apb_vc_sector_2 value = 3 } }
		picture = GFX_evt_busy_spaceport
	}
	show_sound = event_administrative_work
	is_triggered_only = yes

	immediate = {
		apb_venture_roll = { SLOT = 2 }
	}

	option = {
		name = {
			trigger = { check_variable = { which = apb_vc_outcome_2 value = 1 } }
			text = apb_venture.result.a_bust
		}
		name = {
			trigger = { check_variable = { which = apb_vc_outcome_2 value >= 2 } }
			text = apb_venture.result.a
		}
		apb_venture_payout = { SLOT = 2 }
	}
}

# Venture in slot 3 matures (fired 1800 days after launch by apb_venture_launch)
country_event = {
	id = apb_venture.13
	title = apb_venture.result.name
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_3 value = 1 }
			check_variable = { which = apb_vc_outcome_3 value = 1 }
		}
		text = apb_venture.result.mining_bust
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_3 value = 1 }
			check_variable = { which = apb_vc_outcome_3 value = 2 }
		}
		text = apb_venture.result.mining_steady
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_3 value = 1 }
			check_variable = { which = apb_vc_outcome_3 value = 3 }
		}
		text = apb_venture.result.mining_boom
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_3 value = 1 }
			check_variable = { which = apb_vc_outcome_3 value = 4 }
		}
		text = apb_venture.result.mining_unicorn
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_3 value = 2 }
			check_variable = { which = apb_vc_outcome_3 value = 1 }
		}
		text = apb_venture.result.research_bust
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_3 value = 2 }
			check_variable = { which = apb_vc_outcome_3 value = 2 }
		}
		text = apb_venture.result.research_steady
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_3 value = 2 }
			check_variable = { which = apb_vc_outcome_3 value = 3 }
		}
		text = apb_venture.result.research_boom
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_3 value = 2 }
			check_variable = { which = apb_vc_outcome_3 value = 4 }
		}
		text = apb_venture.result.research_unicorn
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_3 value = 3 }
			check_variable = { which = apb_vc_outcome_3 value = 1 }
		}
		text = apb_venture.result.luxury_bust
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_3 value = 3 }
			check_variable = { which = apb_vc_outcome_3 value = 2 }
		}
		text = apb_venture.result.luxury_steady
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_3 value = 3 }
			check_variable = { which = apb_vc_outcome_3 value = 3 }
		}
		text = apb_venture.result.luxury_boom
	}
	desc = {
		trigger = {
			check_variable = { which = apb_vc_sector_3 value = 3 }
			check_variable = { which = apb_vc_outcome_3 value = 4 }
		}
		text = apb_venture.result.luxury_unicorn
	}
	picture = {
		trigger = { check_variable = { which = apb_vc_sector_3 value = 1 } }
		picture = GFX_evt_mining_operations
	}
	picture = {
		trigger = { check_variable = { which = apb_vc_sector_3 value = 2 } }
		picture = GFX_evt_engineering_research
	}
	picture = {
		trigger = { check_variable = { which = apb_vc_sector_3 value = 3 } }
		picture = GFX_evt_busy_spaceport
	}
	show_sound = event_administrative_work
	is_triggered_only = yes

	immediate = {
		apb_venture_roll = { SLOT = 3 }
	}

	option = {
		name = {
			trigger = { check_variable = { which = apb_vc_outcome_3 value = 1 } }
			text = apb_venture.result.a_bust
		}
		name = {
			trigger = { check_variable = { which = apb_vc_outcome_3 value >= 2 } }
			text = apb_venture.result.a
		}
		apb_venture_payout = { SLOT = 3 }
	}
}
