add_namespace = rl

country_event = {
    id = rl.0
    title = rl.0.t
    desc = rl.0.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    trigger = { NOT = { has_global_flag = rl_mode_configured } }
    option = {
        name = rl.0.a
        custom_effect_tooltip = rl.0.a.tt
        hidden_effect = {
            set_global_flag = rl_mode_configured
            set_global_flag = rl_ruleset_configured
            set_global_flag = rl_ruleset_standard
            clr_global_flag = rl_ruleset_hardcore
            set_global_flag = rl_mode_player_only
            clr_global_flag = rl_mode_all
            country_event = { id = rl.2 }
        }
    }
    option = {
        name = rl.0.b
        custom_effect_tooltip = rl.0.b.tt
        hidden_effect = {
            set_global_flag = rl_mode_configured
            set_global_flag = rl_ruleset_configured
            set_global_flag = rl_ruleset_standard
            clr_global_flag = rl_ruleset_hardcore
            set_global_flag = rl_mode_all
            clr_global_flag = rl_mode_player_only
            country_event = { id = rl.2 }
        }
    }
    option = {
        name = rl.0.c
        custom_effect_tooltip = rl.0.c.tt
        hidden_effect = {
            set_global_flag = rl_mode_configured
            set_global_flag = rl_ruleset_configured
            set_global_flag = rl_ruleset_hardcore
            clr_global_flag = rl_ruleset_standard
            set_global_flag = rl_mode_player_only
            clr_global_flag = rl_mode_all
            country_event = { id = rl.2 }
        }
    }
    option = {
        name = rl.0.d_opt
        custom_effect_tooltip = rl.0.d_opt.tt
        hidden_effect = {
            set_global_flag = rl_mode_configured
            set_global_flag = rl_ruleset_configured
            set_global_flag = rl_ruleset_hardcore
            clr_global_flag = rl_ruleset_standard
            set_global_flag = rl_mode_all
            clr_global_flag = rl_mode_player_only
            country_event = { id = rl.2 }
        }
    }
}

country_event = {
    id = rl.2
    title = rl.2.t
    desc = rl.2.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    trigger = { NOT = { has_global_flag = rl_frequency_configured } }
    option = {
        name = rl.2.a
        hidden_effect = {
            set_global_flag = rl_frequency_configured
            set_global_flag = rl_freq_weekly
            clr_global_flag = rl_freq_biweekly
            clr_global_flag = rl_freq_monthly
            clr_global_flag = rl_freq_quarterly
            clr_global_flag = rl_freq_semiannual
            country_event = { id = rl.4 }
        }
    }
    option = {
        name = rl.2.b
        hidden_effect = {
            set_global_flag = rl_frequency_configured
            set_global_flag = rl_freq_biweekly
            clr_global_flag = rl_freq_weekly
            clr_global_flag = rl_freq_monthly
            clr_global_flag = rl_freq_quarterly
            clr_global_flag = rl_freq_semiannual
            country_event = { id = rl.4 }
        }
    }
    option = {
        name = rl.2.c
        hidden_effect = {
            set_global_flag = rl_frequency_configured
            set_global_flag = rl_freq_monthly
            clr_global_flag = rl_freq_weekly
            clr_global_flag = rl_freq_biweekly
            clr_global_flag = rl_freq_quarterly
            clr_global_flag = rl_freq_semiannual
            country_event = { id = rl.4 }
        }
    }
    option = {
        name = rl.2.d_opt
        hidden_effect = {
            set_global_flag = rl_frequency_configured
            set_global_flag = rl_freq_quarterly
            clr_global_flag = rl_freq_weekly
            clr_global_flag = rl_freq_biweekly
            clr_global_flag = rl_freq_monthly
            clr_global_flag = rl_freq_semiannual
            country_event = { id = rl.4 }
        }
    }
}

country_event = {
    id = rl.4
    title = rl.4.t
    desc = rl.4.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    trigger = { NOT = { has_global_flag = rl_rarity_mode_configured } }
    option = {
        name = rl.4.a
        hidden_effect = {
            set_global_flag = rl_rarity_mode_configured
            set_global_flag = rl_rarity_normal
            clr_global_flag = rl_rarity_chaos
            rl_clear_global_chaos_profiles = yes
            if = {
                limit = { has_global_flag = rl_ruleset_hardcore }
                country_event = { id = rl.6 }
            }
            else = {
                set_global_flag = rl_hc_replace_mode_configured
                set_global_flag = rl_hc_manual_replace
                clr_global_flag = rl_hc_auto_replace_weakest
                rl_finalize_roguelike_setup = yes
            }
        }
    }
    option = {
        name = rl.4.b
        hidden_effect = {
            set_global_flag = rl_rarity_mode_configured
            set_global_flag = rl_rarity_chaos
            clr_global_flag = rl_rarity_normal
            rl_clear_global_chaos_profiles = yes
            rl_select_global_chaos_distribution = yes
            if = {
                limit = { has_global_flag = rl_ruleset_hardcore }
                country_event = { id = rl.6 }
            }
            else = {
                set_global_flag = rl_hc_replace_mode_configured
                set_global_flag = rl_hc_manual_replace
                clr_global_flag = rl_hc_auto_replace_weakest
                rl_finalize_roguelike_setup = yes
            }
        }
    }
}

country_event = {
    id = rl.6
    title = rl.6.t
    desc = rl.6.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    trigger = {
        has_global_flag = rl_ruleset_hardcore
        NOT = { has_global_flag = rl_hc_replace_mode_configured }
    }
    option = {
        name = rl.6.a
        custom_effect_tooltip = rl.6.a.tt
        hidden_effect = {
            set_global_flag = rl_hc_replace_mode_configured
            set_global_flag = rl_hc_manual_replace
            clr_global_flag = rl_hc_auto_replace_weakest
            rl_finalize_roguelike_setup = yes
        }
    }
    option = {
        name = rl.6.b
        custom_effect_tooltip = rl.6.b.tt
        hidden_effect = {
            set_global_flag = rl_hc_replace_mode_configured
            set_global_flag = rl_hc_auto_replace_weakest
            clr_global_flag = rl_hc_manual_replace
            rl_finalize_roguelike_setup = yes
        }
    }
}

country_event = {
    id = rl.1
    title = rl.1.t
    desc = rl.1.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    immediate = {
        hidden_effect = {
            if = {
                limit = { NOT = { has_country_flag = rl_offers_ready } }
                rl_generate_three_offers = yes
            }
        }
    }
    option = {
        name = rl.1.a
        custom_effect_tooltip = rl.1.a.tt
        ai_chance = { factor = 1 }
        hidden_effect = {
            set_variable = { rl_selected_id = rl_offer_1_id }
            set_variable = { rl_selected_rarity = rl_offer_1_rarity }
            clr_country_flag = rl_offers_ready
            rl_apply_selected_upgrade = yes
        }
    }
    option = {
        name = rl.1.b
        custom_effect_tooltip = rl.1.b.tt
        ai_chance = { factor = 1 }
        hidden_effect = {
            set_variable = { rl_selected_id = rl_offer_2_id }
            set_variable = { rl_selected_rarity = rl_offer_2_rarity }
            clr_country_flag = rl_offers_ready
            rl_apply_selected_upgrade = yes
        }
    }
    option = {
        name = rl.1.c
        custom_effect_tooltip = rl.1.c.tt
        ai_chance = { factor = 1 }
        hidden_effect = {
            set_variable = { rl_selected_id = rl_offer_3_id }
            set_variable = { rl_selected_rarity = rl_offer_3_rarity }
            clr_country_flag = rl_offers_ready
            rl_apply_selected_upgrade = yes
        }
    }
    option = {
        name = rl.1.d_opt
        custom_effect_tooltip = rl.1.d_opt.tt
        trigger = { is_ai = no }
        hidden_effect = { country_event = { id = rl.10 } }
    }
}

country_event = {
    id = rl.10
    title = rl.10.t
    desc = rl.10.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    option = {
        name = rl.10.a
        trigger = { check_variable = { rl_fate_shards > 4 } }
        hidden_effect = { rl_reroll_current_offers = yes country_event = { id = rl.1 } }
    }
    option = {
        name = rl.10.b
        trigger = { check_variable = { rl_fate_shards > 7 } }
        hidden_effect = { country_event = { id = rl.11 } }
    }
    option = {
        name = rl.10.c
        trigger = { check_variable = { rl_fate_shards > 11 } }
        hidden_effect = { country_event = { id = rl.12 } }
    }
    option = { name = rl.10.back hidden_effect = { country_event = { id = rl.1 } } }
}

country_event = {
    id = rl.11
    title = rl.11.t
    desc = rl.11.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    option = { name = rl.11.a hidden_effect = { rl_lock_offer_1 = yes country_event = { id = rl.1 } } }
    option = { name = rl.11.b hidden_effect = { rl_lock_offer_2 = yes country_event = { id = rl.1 } } }
    option = { name = rl.11.c hidden_effect = { rl_lock_offer_3 = yes country_event = { id = rl.1 } } }
    option = { name = rl.11.back hidden_effect = { country_event = { id = rl.1 } } }
}

country_event = {
    id = rl.12
    title = rl.12.t
    desc = rl.12.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    option = { name = rl.12.a hidden_effect = { rl_banish_offer_1 = yes country_event = { id = rl.1 } } }
    option = { name = rl.12.b hidden_effect = { rl_banish_offer_2 = yes country_event = { id = rl.1 } } }
    option = { name = rl.12.c hidden_effect = { rl_banish_offer_3 = yes country_event = { id = rl.1 } } }
    option = { name = rl.12.back hidden_effect = { country_event = { id = rl.1 } } }
}

country_event = {
    id = rl.3
    title = rl.3.t
    desc = rl.3.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    option = { name = rl.3.a }
}

country_event = {
    id = rl.5
    title = rl.5.t
    desc = rl.5.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    option = { name = rl.5.a }
}

country_event = {
    id = rl.20
    title = rl.20.t
    desc = rl.20.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    option = { name = rl.20.a }
}

country_event = {
    id = rl.30
    title = rl.30.t
    desc = rl.30.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    option = { name = rl.30.a }
}


country_event = {
    id = rl.40
    title = rl.40.t
    desc = rl.40.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    trigger = { has_global_flag = rl_mode_player_only is_ai = no }
    option = { name = rl.40.a }
}



country_event = {
    id = rl.42
    title = rl.42.t
    desc = rl.42.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    option = { name = rl.42.a }
}

country_event = {
    id = rl.43
    title = rl.42.t
    desc = rl.43.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    option = { name = rl.42.a }
}

country_event = {
    id = rl.44
    title = rl.44.t
    desc = rl.44.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    option = { name = rl.44.a }
}

country_event = {
    id = rl.50
    title = rl.50.t
    desc = rl.50.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    immediate = {
        set_variable = { rl_offer_1_id = rl_hc_pending_id }
        set_variable = { rl_offer_1_rarity = rl_hc_pending_rarity }
    }
    option = { name = rl.50.a hidden_effect = { set_country_flag = rl_hc_replacement_mode country_event = { id = rl.51 } } }
    option = { name = rl.50.b hidden_effect = { rl_hc_reject_pending_upgrade = yes } }
}
country_event = {
    id = rl.51
    title = rl.hc.inventory.t
    desc = rl.hc.inventory.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    immediate = { set_variable = { rl_hc_current_page = 1 } rl_hc_prepare_page_1 = yes }
    option = {
        name = rl.hc.slot_01
        custom_effect_tooltip = rl.1.a.tt
        trigger = { check_variable = { rl_hc_slot_01_id > 0 } }
        hidden_effect = {
            set_variable = { rl_hc_target_slot = 1 }
            set_variable = { rl_hc_return_page = 51 }
            set_variable = { rl_offer_1_id = rl_hc_slot_01_id }
            set_variable = { rl_offer_1_rarity = rl_hc_slot_01_rarity }
            country_event = { id = rl.58 }
        }
    }
    option = {
        name = rl.hc.slot_02
        custom_effect_tooltip = rl.1.b.tt
        trigger = { check_variable = { rl_hc_slot_02_id > 0 } }
        hidden_effect = {
            set_variable = { rl_hc_target_slot = 2 }
            set_variable = { rl_hc_return_page = 51 }
            set_variable = { rl_offer_1_id = rl_hc_slot_02_id }
            set_variable = { rl_offer_1_rarity = rl_hc_slot_02_rarity }
            country_event = { id = rl.58 }
        }
    }
    option = {
        name = rl.hc.slot_03
        custom_effect_tooltip = rl.1.c.tt
        trigger = { check_variable = { rl_hc_slot_03_id > 0 } }
        hidden_effect = {
            set_variable = { rl_hc_target_slot = 3 }
            set_variable = { rl_hc_return_page = 51 }
            set_variable = { rl_offer_1_id = rl_hc_slot_03_id }
            set_variable = { rl_offer_1_rarity = rl_hc_slot_03_rarity }
            country_event = { id = rl.58 }
        }
    }
    option = { name = rl.hc.page_menu hidden_effect = { country_event = { id = rl.59 } } }
}
country_event = {
    id = rl.52
    title = rl.hc.inventory.t
    desc = rl.hc.inventory.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    immediate = { set_variable = { rl_hc_current_page = 2 } rl_hc_prepare_page_2 = yes }
    option = {
        name = rl.hc.slot_04
        custom_effect_tooltip = rl.1.a.tt
        trigger = { check_variable = { rl_hc_slot_04_id > 0 } }
        hidden_effect = {
            set_variable = { rl_hc_target_slot = 4 }
            set_variable = { rl_hc_return_page = 52 }
            set_variable = { rl_offer_1_id = rl_hc_slot_04_id }
            set_variable = { rl_offer_1_rarity = rl_hc_slot_04_rarity }
            country_event = { id = rl.58 }
        }
    }
    option = {
        name = rl.hc.slot_05
        custom_effect_tooltip = rl.1.b.tt
        trigger = { check_variable = { rl_hc_slot_05_id > 0 } }
        hidden_effect = {
            set_variable = { rl_hc_target_slot = 5 }
            set_variable = { rl_hc_return_page = 52 }
            set_variable = { rl_offer_1_id = rl_hc_slot_05_id }
            set_variable = { rl_offer_1_rarity = rl_hc_slot_05_rarity }
            country_event = { id = rl.58 }
        }
    }
    option = {
        name = rl.hc.slot_06
        custom_effect_tooltip = rl.1.c.tt
        trigger = { check_variable = { rl_hc_slot_06_id > 0 } }
        hidden_effect = {
            set_variable = { rl_hc_target_slot = 6 }
            set_variable = { rl_hc_return_page = 52 }
            set_variable = { rl_offer_1_id = rl_hc_slot_06_id }
            set_variable = { rl_offer_1_rarity = rl_hc_slot_06_rarity }
            country_event = { id = rl.58 }
        }
    }
    option = { name = rl.hc.page_menu hidden_effect = { country_event = { id = rl.59 } } }
}
country_event = {
    id = rl.53
    title = rl.hc.inventory.t
    desc = rl.hc.inventory.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    immediate = { set_variable = { rl_hc_current_page = 3 } rl_hc_prepare_page_3 = yes }
    option = {
        name = rl.hc.slot_07
        custom_effect_tooltip = rl.1.a.tt
        trigger = { check_variable = { rl_hc_slot_07_id > 0 } }
        hidden_effect = {
            set_variable = { rl_hc_target_slot = 7 }
            set_variable = { rl_hc_return_page = 53 }
            set_variable = { rl_offer_1_id = rl_hc_slot_07_id }
            set_variable = { rl_offer_1_rarity = rl_hc_slot_07_rarity }
            country_event = { id = rl.58 }
        }
    }
    option = {
        name = rl.hc.slot_08
        custom_effect_tooltip = rl.1.b.tt
        trigger = { check_variable = { rl_hc_slot_08_id > 0 } }
        hidden_effect = {
            set_variable = { rl_hc_target_slot = 8 }
            set_variable = { rl_hc_return_page = 53 }
            set_variable = { rl_offer_1_id = rl_hc_slot_08_id }
            set_variable = { rl_offer_1_rarity = rl_hc_slot_08_rarity }
            country_event = { id = rl.58 }
        }
    }
    option = {
        name = rl.hc.slot_09
        custom_effect_tooltip = rl.1.c.tt
        trigger = { check_variable = { rl_hc_slot_09_id > 0 } }
        hidden_effect = {
            set_variable = { rl_hc_target_slot = 9 }
            set_variable = { rl_hc_return_page = 53 }
            set_variable = { rl_offer_1_id = rl_hc_slot_09_id }
            set_variable = { rl_offer_1_rarity = rl_hc_slot_09_rarity }
            country_event = { id = rl.58 }
        }
    }
    option = { name = rl.hc.page_menu hidden_effect = { country_event = { id = rl.59 } } }
}
country_event = {
    id = rl.54
    title = rl.hc.inventory.t
    desc = rl.hc.inventory.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    immediate = { set_variable = { rl_hc_current_page = 4 } rl_hc_prepare_page_4 = yes }
    option = {
        name = rl.hc.slot_10
        custom_effect_tooltip = rl.1.a.tt
        trigger = { check_variable = { rl_hc_slot_10_id > 0 } }
        hidden_effect = {
            set_variable = { rl_hc_target_slot = 10 }
            set_variable = { rl_hc_return_page = 54 }
            set_variable = { rl_offer_1_id = rl_hc_slot_10_id }
            set_variable = { rl_offer_1_rarity = rl_hc_slot_10_rarity }
            country_event = { id = rl.58 }
        }
    }
    option = {
        name = rl.hc.slot_11
        custom_effect_tooltip = rl.1.b.tt
        trigger = { check_variable = { rl_hc_slot_11_id > 0 } }
        hidden_effect = {
            set_variable = { rl_hc_target_slot = 11 }
            set_variable = { rl_hc_return_page = 54 }
            set_variable = { rl_offer_1_id = rl_hc_slot_11_id }
            set_variable = { rl_offer_1_rarity = rl_hc_slot_11_rarity }
            country_event = { id = rl.58 }
        }
    }
    option = {
        name = rl.hc.slot_12
        custom_effect_tooltip = rl.1.c.tt
        trigger = { check_variable = { rl_hc_slot_12_id > 0 } }
        hidden_effect = {
            set_variable = { rl_hc_target_slot = 12 }
            set_variable = { rl_hc_return_page = 54 }
            set_variable = { rl_offer_1_id = rl_hc_slot_12_id }
            set_variable = { rl_offer_1_rarity = rl_hc_slot_12_rarity }
            country_event = { id = rl.58 }
        }
    }
    option = { name = rl.hc.page_menu hidden_effect = { country_event = { id = rl.59 } } }
}
country_event = {
    id = rl.55
    title = rl.hc.inventory.t
    desc = rl.hc.inventory.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    immediate = { set_variable = { rl_hc_current_page = 5 } rl_hc_prepare_page_5 = yes }
    option = {
        name = rl.hc.slot_13
        custom_effect_tooltip = rl.1.a.tt
        trigger = { check_variable = { rl_hc_slot_13_id > 0 } }
        hidden_effect = {
            set_variable = { rl_hc_target_slot = 13 }
            set_variable = { rl_hc_return_page = 55 }
            set_variable = { rl_offer_1_id = rl_hc_slot_13_id }
            set_variable = { rl_offer_1_rarity = rl_hc_slot_13_rarity }
            country_event = { id = rl.58 }
        }
    }
    option = {
        name = rl.hc.slot_14
        custom_effect_tooltip = rl.1.b.tt
        trigger = { check_variable = { rl_hc_slot_14_id > 0 } }
        hidden_effect = {
            set_variable = { rl_hc_target_slot = 14 }
            set_variable = { rl_hc_return_page = 55 }
            set_variable = { rl_offer_1_id = rl_hc_slot_14_id }
            set_variable = { rl_offer_1_rarity = rl_hc_slot_14_rarity }
            country_event = { id = rl.58 }
        }
    }
    option = {
        name = rl.hc.slot_15
        custom_effect_tooltip = rl.1.c.tt
        trigger = { check_variable = { rl_hc_slot_15_id > 0 } }
        hidden_effect = {
            set_variable = { rl_hc_target_slot = 15 }
            set_variable = { rl_hc_return_page = 55 }
            set_variable = { rl_offer_1_id = rl_hc_slot_15_id }
            set_variable = { rl_offer_1_rarity = rl_hc_slot_15_rarity }
            country_event = { id = rl.58 }
        }
    }
    option = { name = rl.hc.page_menu hidden_effect = { country_event = { id = rl.59 } } }
}
country_event = {
    id = rl.56
    title = rl.hc.inventory.t
    desc = rl.hc.inventory.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    immediate = { set_variable = { rl_hc_current_page = 6 } rl_hc_prepare_page_6 = yes }
    option = {
        name = rl.hc.slot_16
        custom_effect_tooltip = rl.1.a.tt
        trigger = { check_variable = { rl_hc_slot_16_id > 0 } }
        hidden_effect = {
            set_variable = { rl_hc_target_slot = 16 }
            set_variable = { rl_hc_return_page = 56 }
            set_variable = { rl_offer_1_id = rl_hc_slot_16_id }
            set_variable = { rl_offer_1_rarity = rl_hc_slot_16_rarity }
            country_event = { id = rl.58 }
        }
    }
    option = {
        name = rl.hc.slot_17
        custom_effect_tooltip = rl.1.b.tt
        trigger = { check_variable = { rl_hc_slot_17_id > 0 } }
        hidden_effect = {
            set_variable = { rl_hc_target_slot = 17 }
            set_variable = { rl_hc_return_page = 56 }
            set_variable = { rl_offer_1_id = rl_hc_slot_17_id }
            set_variable = { rl_offer_1_rarity = rl_hc_slot_17_rarity }
            country_event = { id = rl.58 }
        }
    }
    option = {
        name = rl.hc.slot_18
        custom_effect_tooltip = rl.1.c.tt
        trigger = { check_variable = { rl_hc_slot_18_id > 0 } }
        hidden_effect = {
            set_variable = { rl_hc_target_slot = 18 }
            set_variable = { rl_hc_return_page = 56 }
            set_variable = { rl_offer_1_id = rl_hc_slot_18_id }
            set_variable = { rl_offer_1_rarity = rl_hc_slot_18_rarity }
            country_event = { id = rl.58 }
        }
    }
    option = { name = rl.hc.page_menu hidden_effect = { country_event = { id = rl.59 } } }
}
country_event = {
    id = rl.57
    title = rl.hc.inventory.t
    desc = rl.hc.inventory.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    immediate = { set_variable = { rl_hc_current_page = 7 } rl_hc_prepare_page_7 = yes }
    option = {
        name = rl.hc.slot_19
        custom_effect_tooltip = rl.1.a.tt
        trigger = { check_variable = { rl_hc_slot_19_id > 0 } }
        hidden_effect = {
            set_variable = { rl_hc_target_slot = 19 }
            set_variable = { rl_hc_return_page = 57 }
            set_variable = { rl_offer_1_id = rl_hc_slot_19_id }
            set_variable = { rl_offer_1_rarity = rl_hc_slot_19_rarity }
            country_event = { id = rl.58 }
        }
    }
    option = {
        name = rl.hc.slot_20
        custom_effect_tooltip = rl.1.b.tt
        trigger = { check_variable = { rl_hc_slot_20_id > 0 } }
        hidden_effect = {
            set_variable = { rl_hc_target_slot = 20 }
            set_variable = { rl_hc_return_page = 57 }
            set_variable = { rl_offer_1_id = rl_hc_slot_20_id }
            set_variable = { rl_offer_1_rarity = rl_hc_slot_20_rarity }
            country_event = { id = rl.58 }
        }
    }
    option = { name = rl.hc.page_menu hidden_effect = { country_event = { id = rl.59 } } }
}
country_event = {
    id = rl.58
    title = rl.58.t
    desc = rl.58.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    option = {
        name = rl.58.a
        hidden_effect = {
            rl_hc_remove_target_slot = yes
            if = {
                limit = { has_country_flag = rl_hc_replacement_mode }
                rl_hc_resolve_pending_after_removal = yes
            }
            else = { rl_hc_return_to_inventory_page = yes }
        }
    }
    option = { name = rl.58.b hidden_effect = { rl_hc_return_to_inventory_page = yes } }
}


country_event = {
    id = rl.59
    title = rl.59.t
    desc = rl.59.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes

    option = {
        name = rl.59.a
        trigger = { check_variable = { rl_hc_current_page > 1 } }
        hidden_effect = {
            if = { limit = { check_variable = { rl_hc_current_page = 2 } } country_event = { id = rl.51 } }
            else_if = { limit = { check_variable = { rl_hc_current_page = 3 } } country_event = { id = rl.52 } }
            else_if = { limit = { check_variable = { rl_hc_current_page = 4 } } country_event = { id = rl.53 } }
            else_if = { limit = { check_variable = { rl_hc_current_page = 5 } } country_event = { id = rl.54 } }
            else_if = { limit = { check_variable = { rl_hc_current_page = 6 } } country_event = { id = rl.55 } }
            else_if = { limit = { check_variable = { rl_hc_current_page = 7 } } country_event = { id = rl.56 } }
        }
    }
    option = {
        name = rl.59.b
        trigger = { check_variable = { rl_hc_current_page < 7 } }
        hidden_effect = {
            if = { limit = { check_variable = { rl_hc_current_page = 1 } } country_event = { id = rl.52 } }
            else_if = { limit = { check_variable = { rl_hc_current_page = 2 } } country_event = { id = rl.53 } }
            else_if = { limit = { check_variable = { rl_hc_current_page = 3 } } country_event = { id = rl.54 } }
            else_if = { limit = { check_variable = { rl_hc_current_page = 4 } } country_event = { id = rl.55 } }
            else_if = { limit = { check_variable = { rl_hc_current_page = 5 } } country_event = { id = rl.56 } }
            else_if = { limit = { check_variable = { rl_hc_current_page = 6 } } country_event = { id = rl.57 } }
        }
    }
    option = {
        name = rl.59.c
        hidden_effect = {
            if = { limit = { check_variable = { rl_hc_current_page = 1 } } country_event = { id = rl.51 } }
            else_if = { limit = { check_variable = { rl_hc_current_page = 2 } } country_event = { id = rl.52 } }
            else_if = { limit = { check_variable = { rl_hc_current_page = 3 } } country_event = { id = rl.53 } }
            else_if = { limit = { check_variable = { rl_hc_current_page = 4 } } country_event = { id = rl.54 } }
            else_if = { limit = { check_variable = { rl_hc_current_page = 5 } } country_event = { id = rl.55 } }
            else_if = { limit = { check_variable = { rl_hc_current_page = 6 } } country_event = { id = rl.56 } }
            else = { country_event = { id = rl.57 } }
        }
    }
    option = {
        name = rl.59.d_opt
        hidden_effect = {
            clr_country_flag = rl_hc_management_mode
            if = {
                limit = { has_country_flag = rl_hc_replacement_mode }
                country_event = { id = rl.50 }
            }
            else = { clr_country_flag = rl_hc_replacement_mode }
        }
    }
}


country_event = {
    id = rl.70
    title = rl.70.t
    desc = rl.70.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    immediate = {
        hidden_effect = {
            if = {
                limit = { NOT = { has_country_flag = rl_relic_offers_ready } }
                rl_generate_relic_offers = yes
            }
        }
    }
    option = {
        name = rl.70.a
        custom_effect_tooltip = rl.70.a.tt
        ai_chance = { factor = 1 modifier = { factor = 4 check_variable = { rl_relic_offer_1_power = 3 } } modifier = { factor = 2 check_variable = { rl_relic_offer_1_power = 2 } } }
        hidden_effect = { rl_relic_select_offer_1 = yes }
    }
    option = {
        name = rl.70.b
        custom_effect_tooltip = rl.70.b.tt
        ai_chance = { factor = 1 modifier = { factor = 4 check_variable = { rl_relic_offer_2_power = 3 } } modifier = { factor = 2 check_variable = { rl_relic_offer_2_power = 2 } } }
        hidden_effect = { rl_relic_select_offer_2 = yes }
    }
    option = {
        name = rl.70.c
        custom_effect_tooltip = rl.70.c.tt
        ai_chance = { factor = 1 modifier = { factor = 4 check_variable = { rl_relic_offer_3_power = 3 } } modifier = { factor = 2 check_variable = { rl_relic_offer_3_power = 2 } } }
        hidden_effect = { rl_relic_select_offer_3 = yes }
    }
    option = {
        name = rl.70.d_opt
        trigger = { is_ai = no }
        ai_chance = { factor = 0 }
        hidden_effect = { rl_relic_shatter_discovery = yes }
    }
}

country_event = {
    id = rl.71
    title = rl.71.t
    desc = rl.71.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    option = {
        name = rl.71.a
        custom_effect_tooltip = rl.71.a.tt
        trigger = { check_variable = { rl_relic_slot_1_id > 0 } }
        hidden_effect = { rl_relic_replace_slot_1 = yes }
    }
    option = {
        name = rl.71.b
        custom_effect_tooltip = rl.71.b.tt
        trigger = { check_variable = { rl_relic_slot_2_id > 0 } }
        hidden_effect = { rl_relic_replace_slot_2 = yes }
    }
    option = {
        name = rl.71.c
        custom_effect_tooltip = rl.71.c.tt
        trigger = { check_variable = { rl_relic_slot_3_id > 0 } }
        hidden_effect = { rl_relic_replace_slot_3 = yes }
    }
    option = { name = rl.71.d_opt hidden_effect = { rl_relic_shatter_pending = yes } }
}

country_event = {
    id = rl.72
    title = rl.72.t
    desc = rl.72.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    option = { name = rl.72.a }
}

country_event = {
    id = rl.73
    title = rl.73.t
    desc = rl.73.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    option = { name = rl.73.a custom_effect_tooltip = rl.73.a.tt trigger = { check_variable = { rl_relic_slot_1_id > 0 } } hidden_effect = { rl_relic_prepare_remove_slot_1 = yes } }
    option = { name = rl.73.b custom_effect_tooltip = rl.73.b.tt trigger = { check_variable = { rl_relic_slot_2_id > 0 } } hidden_effect = { rl_relic_prepare_remove_slot_2 = yes } }
    option = { name = rl.73.c custom_effect_tooltip = rl.73.c.tt trigger = { check_variable = { rl_relic_slot_3_id > 0 } } hidden_effect = { rl_relic_prepare_remove_slot_3 = yes } }
    option = { name = rl.73.d_opt }
}

country_event = {
    id = rl.74
    title = rl.74.t
    desc = rl.74.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    option = { name = rl.74.a hidden_effect = { rl_relic_confirm_remove_target = yes } }
    option = { name = rl.74.b hidden_effect = { set_variable = { rl_relic_target_slot = 0 } set_variable = { rl_relic_target_id = 0 } } }
}


country_event = {
    id = rl.41
    title = rl.41.t
    desc = rl.41.d
    picture = GFX_report_event_generic_factory
    is_triggered_only = yes
    option = { name = rl.41.a }
}
