﻿namespace = rf_wheel

# The wheel turns: one event per phase. root = the ruler whose realm turned.

##### Regnabo — "I shall reign" #####
rf_wheel.1 = {
	type = character_event
	title = rf_wheel.1.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = primary_title.var:rf_previous_phase
					primary_title.var:rf_previous_phase = 4
				}
				desc = rf_wheel.1.desc_rebirth
			}
			desc = rf_wheel.1.desc
		}
	}
	theme = realm
	override_background = { reference = throne_room }
	left_portrait = { character = root animation = personality_bold }

	option = { # The sword
		name = rf_wheel.1.a
		add_character_modifier = { modifier = rf_choice_sword_modifier years = 15 }
		primary_title = { set_variable = { name = rf_sword_years value = yes years = 15 } }
		custom_tooltip = rf_wheel.1.a.tt
		ai_chance = {
			base = 30
			modifier = { add = 30 has_trait = ambitious }
			modifier = { add = 20 has_trait = wrathful }
			modifier = { add = 20 martial >= 14 }
		}
	}
	option = { # The trowel
		name = rf_wheel.1.b
		add_character_modifier = { modifier = rf_choice_trowel_modifier years = 15 }
		ai_chance = {
			base = 30
			modifier = { add = 30 stewardship >= 14 }
			modifier = { add = 20 has_trait = diligent }
		}
	}
	option = { # The crown
		name = rf_wheel.1.c
		add_character_modifier = { modifier = rf_choice_crown_modifier years = 15 }
		ai_chance = {
			base = 30
			modifier = { add = 30 diplomacy >= 14 }
			modifier = { add = 20 has_trait = gregarious }
		}
	}
}

##### Regno — "I reign" #####
rf_wheel.2 = {
	type = character_event
	title = rf_wheel.2.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = primary_title.var:rf_previous_phase
					primary_title.var:rf_previous_phase = 3
				}
				desc = rf_wheel.2.desc_renovatio
			}
			desc = rf_wheel.2.desc
		}
	}
	theme = realm
	override_background = { reference = throne_room }
	left_portrait = { character = root animation = happiness }

	option = { # Triumph
		name = rf_wheel.2.a
		add_prestige = 300
		add_character_modifier = { modifier = rf_choice_triumph_modifier years = 15 }
		primary_title = { rf_change_menace_effect = { AMOUNT = 10 } }
		custom_tooltip = rf_wheel.2.a.tt
		ai_chance = {
			base = 25
			modifier = { add = 35 has_trait = arrogant }
			modifier = { add = 20 has_trait = ambitious }
		}
	}
	option = { # Memento mori
		name = rf_wheel.2.b
		add_piety = 150
		add_prestige = -100
		primary_title = { set_variable = { name = rf_memento_mori value = yes years = 25 } }
		custom_tooltip = rf_wheel.2.b.tt
		ai_chance = {
			base = 25
			modifier = { add = 35 has_trait = humble }
			modifier = { add = 20 has_trait = zealous }
			modifier = { add = 20 learning >= 14 }
		}
	}
	option = { # Share the glory
		name = rf_wheel.2.c
		remove_short_term_gold = { value = monthly_character_income multiply = 6 min = 25 }
		add_character_modifier = { modifier = rf_choice_share_glory_modifier years = 15 }
		ai_chance = {
			base = 25
			modifier = { add = 30 has_trait = generous }
			modifier = { add = 20 diplomacy >= 14 }
		}
	}
}

##### Regnavi — "I have reigned" #####
rf_wheel.3 = {
	type = character_event
	title = rf_wheel.3.t
	desc = rf_wheel.3.desc
	theme = realm
	override_background = { reference = council_chamber }
	left_portrait = { character = root animation = worry }

	option = { # Reform
		name = rf_wheel.3.a
		trigger = { gold >= 50 }
		remove_short_term_gold = { value = rf_renovatio_gold_value divide = 2 }
		primary_title = { rf_change_fortune_effect = { AMOUNT = 6 } }
		custom_tooltip = rf_wheel.3.a.tt
		ai_chance = {
			base = 30
			modifier = { add = 30 stewardship >= 14 }
			modifier = { add = 20 has_trait = diligent }
		}
	}
	option = { # A scapegoat
		name = rf_wheel.3.b
		add_dread = medium_dread_gain
		add_tyranny = 10
		primary_title = { rf_change_fortune_effect = { AMOUNT = 3 } }
		custom_tooltip = rf_wheel.3.b.tt
		ai_chance = {
			base = 15
			modifier = { add = 40 has_trait = callous }
			modifier = { add = 30 has_trait = paranoid }
			modifier = { factor = 0 has_trait = compassionate }
		}
	}
	option = { # All things pass
		name = rf_wheel.3.c
		add_piety = 100
		add_stress = medium_stress_loss
		ai_chance = {
			base = 20
			modifier = { add = 30 has_trait = content }
			modifier = { add = 20 has_trait = zealous }
		}
	}
}

##### Sum sine regno — "I am without a realm" #####
rf_wheel.4 = {
	type = character_event
	title = rf_wheel.4.t
	desc = rf_wheel.4.desc
	theme = war
	override_background = { reference = council_chamber }
	left_portrait = { character = root animation = shock }

	option = { # Hold at any cost
		name = rf_wheel.4.a
		add_character_modifier = { modifier = rf_choice_hold_modifier years = 10 }
		add_tyranny = 15
		ai_chance = {
			base = 25
			modifier = { add = 40 has_trait = stubborn }
			modifier = { add = 30 has_trait = wrathful }
			modifier = { add = 20 martial >= 14 }
		}
	}
	option = { # Concessions
		name = rf_wheel.4.b
		add_character_modifier = { modifier = rf_choice_concessions_modifier years = 10 }
		every_vassal = {
			limit = { highest_held_title_tier >= tier_county }
			add_opinion = { target = root modifier = rf_concessions_opinion }
		}
		ai_chance = {
			base = 30
			modifier = { add = 30 has_trait = just }
			modifier = { add = 20 diplomacy >= 14 }
		}
	}
	option = { # Pray
		name = rf_wheel.4.c
		add_piety = 200
		primary_title = { rf_change_fortune_effect = { AMOUNT = 5 } }
		ai_chance = {
			base = 20
			modifier = { add = 40 has_trait = zealous }
		}
	}
}

##### Hidden: a new holder takes up the realm's state. #####
rf_wheel.100 = {
	type = character_event
	hidden = yes
	trigger = { rf_is_realm_trigger = yes }
	immediate = {
		rf_ensure_state_effect = yes
		rf_apply_phase_modifier_effect = yes
	}
}

##### Renovatio decision result #####
rf_wheel.200 = {
	type = character_event
	title = rf_wheel.200.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { has_character_flag = rf_renovatio_success }
				desc = rf_wheel.200.desc_success
			}
			desc = rf_wheel.200.desc_failure
		}
	}
	theme = stewardship
	override_background = { reference = council_chamber }
	left_portrait = {
		character = root
		triggered_animation = { trigger = { has_character_flag = rf_renovatio_success } animation = happiness }
		animation = stress
	}

	option = {
		name = rf_wheel.200.a
		trigger = { has_character_flag = rf_renovatio_success }
		primary_title = { rf_change_fortune_effect = { AMOUNT = 15 } }
		add_character_modifier = { modifier = rf_renovatio_modifier years = 10 }
		remove_character_flag = rf_renovatio_success
	}
	option = {
		name = rf_wheel.200.b
		trigger = { NOT = { has_character_flag = rf_renovatio_success } }
		primary_title = { rf_change_fortune_effect = { AMOUNT = -5 } }
		add_stress = medium_stress_gain
	}
}
