﻿activity_dlm_colosseum = {
	activity_group_type = activities
	sort_order = 85

	is_shown = {
		is_landed = yes
		dlm_unlock_maa_colosseum_gladiators = yes
	}

		can_start_showing_failures_only = {
			is_available_adult = yes
			gold >= 75
			prestige >= 150
			NOT = { is_activity_type_on_cooldown = activity_dlm_colosseum }
		}

	is_valid = {
		scope:host = {
			is_alive = yes
			is_capable_adult = yes
			is_imprisoned = no
			is_landed = yes
			NOT = { is_incapable = yes }
		}
	}

	on_invalidated = {}

	on_host_death = {
		if = {
			limit = { exists = scope:host.player_heir }
			scope:host.player_heir = { save_scope_as = new_host }
		}
		else = {
			scope:host.primary_heir = { save_scope_as = new_host }
		}
		set_activity_host = scope:new_host
		scope:new_host = {
			trigger_event = { id = activity_system.0080 days = 1 }
		}
	}

	is_single_location = yes
	province_filter = realm
	ai_province_filter = capital
	ai_will_select_province = 100
	max_province_icons = 5
	max_guests = 1
	wait_time_before_start = { days = 0 }
	max_guest_arrival_delay_time = { days = 0 }
	cooldown = { years = 5 }
	special_option_category = special_type

	is_location_valid = {
		this = scope:host.capital_province
		dlm_has_colosseum = yes
	}

	province_score = { value = 0 }

	province_description = {
		triggered_desc = {
			trigger = { this = scope:host.capital_province }
			desc = activity_dlm_colosseum_province_capital
		}
		triggered_desc = {
			trigger = { dlm_has_colosseum = yes }
			desc = activity_dlm_colosseum_province_desc
		}
	}

	cost = {
		gold = {
			add = {
					add = {
						value = feast_activity_cost
						multiply = 1.75
						desc = feast_activity_cost_desc
					}
					add = {
						value = feast_activity_cost
						multiply = activity_cost_scale_by_era
						subtract = feast_activity_cost
						multiply = 1.75
						desc = activity_cost_scale_by_era_desc
					}
			}
		}
	}

	ui_predicted_cost = {
			gold = {
				value = feast_activity_cost
				multiply = 1.75
				add = {
					value = feast_activity_cost
					multiply = activity_cost_scale_by_era
					subtract = feast_activity_cost
					multiply = 1.75
				}
			}
		}

	open_invite = yes

	host_intents = {
		default = reduce_stress_intent
		intents = {
			reduce_stress_intent
		}
	}

	guest_intents = {
		default = reduce_stress_intent
		intents = {
			reduce_stress_intent
		}
	}

	options = {
		special_type = {
			dlm_colosseum_type_recreational = {
				default = yes
				ai_will_do = {
					value = 100
				}
			}
			dlm_colosseum_type_bloody = {
				ai_will_do = {
					value = 20
				}
			}
			dlm_colosseum_type_lavish = {
				cost = {
					gold = {
						add = 50
					}
				}
				ai_will_do = {
					value = 30
				}
			}
		}
	}

		phases = {
			dlm_colosseum_opening_bout_phase = {
				is_predefined = yes
				order = 1
				location_source = scripted

			select_scripted_location = {
				if = {
					limit = {
						root.capital_province = { dlm_has_colosseum = yes }
					}
					root.capital_province = { save_scope_as = province }
				}
				else = {
					random_sub_realm_county = {
						limit = {
							holder = root
							title_province = { dlm_has_colosseum = yes }
						}
						title_province = { save_scope_as = province }
					}
				}
			}

				on_enter_phase = {
					if = {
						limit = { this = scope:host }
						scope:activity = { progress_activity_phase_after = { days = 2 } }
					}
				}

				on_phase_active = {
					if = {
						limit = { this = scope:host }
						scope:activity.activity_location.county = {
							save_scope_as = dlm_target_county
						}
						dlm_begin_colosseum_games_activity_effect = yes
						trigger_event = dlm_ducal_landmarks.0022
					}
				}
			}

			dlm_colosseum_opening_result_phase = {
				is_predefined = yes
				order = 2
				location_source = scripted

				select_scripted_location = {
					if = {
						limit = { exists = scope:activity.activity_location }
						scope:activity.activity_location = { save_scope_as = province }
					}
					else_if = {
						limit = {
							root.capital_province = { dlm_has_colosseum = yes }
						}
						root.capital_province = { save_scope_as = province }
					}
					else = {
						random_sub_realm_county = {
							limit = {
								holder = root
								title_province = { dlm_has_colosseum = yes }
							}
							title_province = { save_scope_as = province }
						}
					}
				}

				on_enter_phase = {
					if = {
						limit = { this = scope:host }
						scope:activity = { progress_activity_phase_after = { days = 2 } }
					}
				}

					on_phase_active = {
						if = {
							limit = { this = scope:host }
							trigger_event = dlm_ducal_landmarks.0023
						}
					}
				}

			dlm_colosseum_second_bout_phase = {
				is_predefined = yes
				order = 3
				location_source = scripted

				select_scripted_location = {
					if = {
						limit = { exists = scope:activity.activity_location }
						scope:activity.activity_location = { save_scope_as = province }
					}
					else_if = {
						limit = {
							root.capital_province = { dlm_has_colosseum = yes }
						}
						root.capital_province = { save_scope_as = province }
					}
					else = {
						random_sub_realm_county = {
							limit = {
								holder = root
								title_province = { dlm_has_colosseum = yes }
							}
							title_province = { save_scope_as = province }
						}
					}
				}

				on_enter_phase = {
					if = {
						limit = { this = scope:host }
						scope:activity = { progress_activity_phase_after = { days = 2 } }
					}
				}

				on_phase_active = {
					if = {
						limit = { this = scope:host }
						dlm_setup_colosseum_round_two_effect = yes
						trigger_event = dlm_ducal_landmarks.0024
					}
				}
			}

			dlm_colosseum_second_result_phase = {
				is_predefined = yes
				order = 4
				location_source = scripted

				select_scripted_location = {
					if = {
						limit = { exists = scope:activity.activity_location }
						scope:activity.activity_location = { save_scope_as = province }
					}
					else_if = {
						limit = {
							root.capital_province = { dlm_has_colosseum = yes }
						}
						root.capital_province = { save_scope_as = province }
					}
					else = {
						random_sub_realm_county = {
							limit = {
								holder = root
								title_province = { dlm_has_colosseum = yes }
							}
							title_province = { save_scope_as = province }
						}
					}
				}

				on_enter_phase = {
					if = {
						limit = { this = scope:host }
						scope:activity = { progress_activity_phase_after = { days = 2 } }
					}
				}

					on_phase_active = {
						if = {
							limit = { this = scope:host }
							trigger_event = dlm_ducal_landmarks.0025
						}
					}
				}

			dlm_colosseum_final_bout_phase = {
				is_predefined = yes
				order = 5
				location_source = scripted

				select_scripted_location = {
					if = {
						limit = { exists = scope:activity.activity_location }
						scope:activity.activity_location = { save_scope_as = province }
					}
					else_if = {
						limit = {
							root.capital_province = { dlm_has_colosseum = yes }
						}
						root.capital_province = { save_scope_as = province }
					}
					else = {
						random_sub_realm_county = {
							limit = {
								holder = root
								title_province = { dlm_has_colosseum = yes }
							}
							title_province = { save_scope_as = province }
						}
					}
				}

				on_enter_phase = {
					if = {
						limit = { this = scope:host }
						scope:activity = { progress_activity_phase_after = { days = 2 } }
					}
				}

				on_phase_active = {
					if = {
						limit = { this = scope:host }
						dlm_setup_colosseum_final_round_effect = yes
						trigger_event = dlm_ducal_landmarks.0027
					}
				}
			}

			dlm_colosseum_final_result_phase = {
				is_predefined = yes
				order = 6
				location_source = scripted

				select_scripted_location = {
					if = {
						limit = { exists = scope:activity.activity_location }
						scope:activity.activity_location = { save_scope_as = province }
					}
					else_if = {
						limit = {
							root.capital_province = { dlm_has_colosseum = yes }
						}
						root.capital_province = { save_scope_as = province }
					}
					else = {
						random_sub_realm_county = {
							limit = {
								holder = root
								title_province = { dlm_has_colosseum = yes }
							}
							title_province = { save_scope_as = province }
						}
					}
				}

				on_enter_phase = {
					if = {
						limit = { this = scope:host }
						scope:activity = { progress_activity_phase_after = { days = 2 } }
					}
				}

					on_phase_active = {
						if = {
							limit = { this = scope:host }
							trigger_event = dlm_ducal_landmarks.0028
						}
					}
				}
		}

		background = {
			texture = "gfx/interface/illustrations/event_scenes/ep3_hippodrome_chariot_race.dds"
			environment = "environment_ep3_chariot_race"
			ambience = "event:/DLC/FP2/SFX/Events/courtyard"
		}
	}
