# RT56 RP Edits:
# add_state_core	--->	add_state_claim
# add_core_of 		--->	add_claim_by
unite_the_levant_category = {
    form_greater_syria = {
        icon = generic_form_nation

        allowed = {
            OR = {
                original_tag = LEB
                original_tag = SYR
                original_tag = JOR
            }
        }
        fire_only_once = yes
        available = {
            is_subject = no
            custom_trigger_tooltip = {
                tooltip = form_country_gs_syria_required_states_tt
                controls_state = 680
                controls_state = 677
                controls_state = 554
            }
            controls_state = 553
            custom_trigger_tooltip = {
                tooltip = form_country_gs_israel_palestina_required_states_tt
                controls_state = 454
                controls_state = 1016
                controls_state = 1017
                controls_state = 949
                controls_state = 966
            }
            controls_state = 455
            controls_state = 1021
            controls_state = 1022
            NOT = { has_cosmetic_tag = ARA_UNIFIED }
            NOT = { has_completed_focus = PAL_islamists }
        }
        complete_effect = {
            set_cosmetic_tag = SYR_UNIFIED
            custom_effect_tooltip = form_country_gs_required_coring_states_tt
            hidden_effect = {
                every_state = {
                    limit = {
                        OR = {
                            is_core_of = JOR
                            is_core_of = LEB
                            is_core_of = PAL
                            is_core_of = SYR
                        }
                    }
                    add_claim_by = ROOT #ROOT
                    #Siria, Libano, Palestina, Jordan
                }
                news_event = { id = r56.news_event.34 hours = 6 }

                if = {
                    limit = {
                        has_dlc = "La Resistance"
                    }
                    every_country = {
                        every_operative = {
                            limit = {
                                OR = {
                                    has_nationality = JOR
                                    has_nationality = LEB
                                    has_nationality = PAL
                                    has_nationality = SYR
                                }
                                NOT = {
                                    has_nationality = ROOT
                                }
                            }
                            add_nationality = ROOT
                        }
                    }
                }
            }
            set_capital = {
                state = 554
            }
            set_province_name = { id = 1086 name = "Al-Quds" }
            custom_effect_tooltip = form_country_gs_iraq_kuwait_coring_states_tt
            hidden_effect = {
                add_state_claim = 453
                add_state_claim = 676
                add_state_claim = 675
                add_state_claim = 291
                add_state_claim = 1049
                add_state_claim = 1048
                add_state_claim = 1046
                add_state_claim = 1047
                add_state_claim = 1045

            }

            add_ideas = generic_recent_political_unification
            add_ideas = generic_recent_army_unification
            add_ideas = generic_recent_economic_unification
        }

        ai_will_do = {
            factor = 200
            modifier = {
                factor = 0.1
                is_historical_focus_on = yes
            }
        }
    }
}

unify_the_peninsula_category = {
    unite_korea = {
        icon = GFX_decision_korea_unification

        allowed = {
            OR = {
                original_tag = KOR
                original_tag = NKR
            }
        }
        fire_only_once = yes
        available = {
            is_subject = no
            custom_trigger_tooltip = {
                tooltip = form_country_joseon_south_korea_required_states_tt
                controls_state = 525
                controls_state = 919
                controls_state = 920
            }
            custom_trigger_tooltip = {
                tooltip = form_country_joseon_north_korea_required_states_tt
                controls_state = 527
                controls_state = 917
                controls_state = 918
            }
            NOT = { has_cosmetic_tag = KOR_unified }
        }
		visible = {
            original_tag = JAP
			NOT = { has_global_flag = unite_joseon_flag }
		}
        complete_effect = {
            set_cosmetic_tag = KOR_unified
            custom_effect_tooltip = form_country_joseon_korea_coring_states_tt
            hidden_effect = {
                every_state = {
                    limit = {
                        OR = {
                            is_core_of = KOR
                            is_core_of = NKR
                        }
                    }
                    add_claim_by = ROOT #ROOT
                    #North and South Korea
                }
				set_global_flag = unite_joseon_flag

                if = {
                    limit = {
                        has_dlc = "La Resistance"
                    }
                    every_country = {
                        every_operative = {
                            limit = {
                                OR = {
                                    has_nationality = KOR
                                    has_nationality = NKR
                                }
                                NOT = {
                                    has_nationality = ROOT
                                }
                            }
                            add_nationality = ROOT
                        }
                    }
                }

            }

            add_ideas = generic_recent_political_unification
            add_ideas = generic_recent_army_unification
            add_ideas = generic_recent_economic_unification
        }

        ai_will_do = {
            factor = 200
        }
    }
}

##form_peru_bolivia_category = {
##    form_peru_bolivia = {
##        fire_only_once = yes
##        icon = generic_form_nation
##
##        allowed = {
##            OR = {
##                original_tag = BOL
##                original_tag = PRU 
##                    
##            }
##        }
##        available = {
##               if = {
##               Limit = {
##                    original_tag = PRU 
##                       }
##                      NOT = { 
##                 OR = { 
##                   has_country_flag = formed_peru_bolivia
##                   has_country_flag = PRU_no_peru_bolivia
##                   has_country_flag = PRU_no_inca_peru_bolivia
##                      }
##                     }
##                        }
##           
##            all_state = {
##                OR = {
##                    NOT = { is_core_of = PRU }
##                    is_core_of = ECU
##                    is_controlled_by = ROOT
##                }
##            }
##            all_state = {
##                OR = {
##                    NOT = { is_core_of = BOL }
##                    is_core_of = PAR
##                    is_core_of = CHL
##                    is_core_of = BRA
##                    is_controlled_by = ROOT
##                }
##            }
##        }
##
##        complete_effect = {
##
##            hidden_effect = {
##                if = {
##                    limit = {
##                        has_dlc = "La Resistance"
##                    }
##                    every_country = {
##                        every_operative = {
##                            limit = {
##                                OR = {
##                                    has_nationality = PRU
##                                    has_nationality = BOL
##                                }
##                                NOT = {
##                                    has_nationality = ROOT
##                                }
##                            }
##                            add_nationality = ROOT
##                        }
##                    }
##                }                
##            }
##
##            set_country_flag = formed_peru_bolivia
##            set_cosmetic_tag = PRB
##            688 = { add_claim_by = ROOT }
##            506 = { add_claim_by = ROOT }
##            490 = { add_claim_by = ROOT }
##            1052 = { add_claim_by = ROOT }
##        }
##        remove_effect = {
##            hidden_effect = {
##                every_state = {
##                    limit = {
##                        OR = { is_core_of = BOL is_core_of = PRU }
##                    }
##                    add_claim_by = PREV
##                }
##            }
##        }
##        remove_effect = {
##            add_ideas = generic_recent_political_unification
##            add_ideas = generic_recent_army_unification
##            add_ideas = generic_recent_economic_unification
##        }
##        ai_will_do = {
##            factor = 1
##        }
##    }
##}
##

form_russia_category = {
    form_russia = {
        icon = generic_form_nation
        fire_only_once = yes
        allowed = { original_tag = LIE }

        available = {
            is_subject = no
            custom_trigger_tooltip = {
                tooltip = LIE_requires_all_these_states_to_form_russia
                controls_state = 195
                controls_state = 208
                controls_state = 209
                controls_state = 210
                controls_state = 263
                controls_state = 244
                controls_state = 246
                controls_state = 242
                controls_state = 243
                controls_state = 224
                controls_state = 219
                controls_state = 205
                controls_state = 247
                controls_state = 264
                controls_state = 220
                controls_state = 222
                controls_state = 223
                controls_state = 240
                controls_state = 258
                controls_state = 254
                controls_state = 260
                controls_state = 257
                controls_state = 255
                controls_state = 252
                controls_state = 253
                controls_state = 248
                controls_state = 351
                controls_state = 879
                controls_state = 214
                controls_state = 880
                controls_state = 239
            }
        }

        highlight_states = {
			highlight_state_targets = {
                state = 195
                state = 208
                state = 209
                state = 210
                state = 263
                state = 244
                state = 246
                state = 242
                state = 243
                state = 224
                state = 219
                state = 205
                state = 247
                state = 264
                state = 216
                state = 215
                state = 220
                state = 222
                state = 223
                state = 240
                state = 258
                state = 254
                state = 260
                state = 257
                state = 255
                state = 252
                state = 253
                state = 248
                state = 351
                state = 879
                state = 214
                state = 880
                state = 239
            }
		}

        ai_will_do = { factor = 150 }

        visible = {
            has_completed_focus = LIE_finish_the_fight
            if = {
                limit = { original_tag = LIE }
                has_country_leader = {
                    character = LIE_boris_smyslovsky
                    ruling_only = yes
                }
            }
        }

        complete_effect = {
            set_capital = { state = 219 }
            every_state = {
                limit = {
                    OR = {
                        state = 195
                        state = 208
                        state = 209
                        state = 210
                        state = 263
                        state = 244
                        state = 246
                        state = 242
                        state = 243
                        state = 224
                        state = 219
                        state = 205
                        state = 247
                        state = 264
                        state = 216
                        state = 215
                        state = 220
                        state = 222
                        state = 223
                        state = 240
                        state = 258
                        state = 254
                        state = 260
                        state = 257
                        state = 255
                        state = 252
                        state = 253
                        state = 248
                        state = 351
                        state = 879
                        state = 214
                        state = 880
                        state = 239
                    }
                }
                add_claim_by = ROOT
            }
            custom_effect_tooltip = generic_skip_one_line_tt
            set_cosmetic_tag = SOV
            custom_effect_tooltip = generic_skip_one_line_tt
            add_ideas = generic_recent_political_unification
            custom_effect_tooltip = generic_skip_one_line_tt
            add_ideas = generic_recent_army_unification
            custom_effect_tooltip = generic_skip_one_line_tt
            add_ideas = generic_recent_economic_unification
            if = {
                limit = { original_tag = LIE }
                set_country_flag = achievement_formed_russia
            }
            custom_effect_tooltip = generic_skip_one_line_tt
            unlock_decision_tooltip = reintegrate_the_don_republic
            unlock_decision_tooltip = bring_back_white_names
            unlock_decision_tooltip = question_of_the_capital_russia
        }
    }

    bring_back_white_names = {
        icon = GFX_decision_generic_break_treaty
        allowed = { original_tag = LIE }
        fire_only_once = yes
        cost = 50

        days_remove = 85

        available = { NOT = { has_government = communism } }

        modifier = { political_power_factor = -0.25 }
        ai_will_do = { factor = 150 }

        visible = {
            has_cosmetic_tag = SOV
            if = {
                limit = { original_tag = LIE }
                #has_country_leader = {
                #    character = LIE_boris_smyslovsky
                #    ruling_only = yes
                #}
            }
        }

        remove_effect = {
            add_political_power = 100
            add_stability = 0.1
            add_popularity = {
                ideology = communism
                popularity = -0.1
            }
            custom_effect_tooltip = generic_skip_one_line_tt
            country_event = liechtenstein.32
            custom_effect_tooltip = generic_skip_one_line_tt
            set_province_name = {
                id = 11375
                name = SOV_Nizhny_Novgorod
            }
            252 = { set_state_name = SOV_Nizhny_Novgorod }
            custom_effect_tooltip = generic_skip_one_line_tt
            set_province_name = {
                id = 6245
                name = SOV_Tver
            }
            247 = { set_state_name = SOV_Tver }
            custom_effect_tooltip = generic_skip_one_line_tt
            custom_effect_tooltip = LIE_if_has_integrated_don
            effect_tooltip = {
                217 = { set_state_name = SOV_Volgograd }
                set_province_name = {
                    id = 3529
                    name = SOV_Volgograd
                }
            }
            hidden_effect = {
                if = {
                    limit = { has_country_flag = LIE_can_expand_southwards }
                    217 = { set_state_name = SOV_Volgograd }
                    set_province_name = {
                        id = 3529
                        name = SOV_Volgograd
                    }
                }
            }
            set_country_flag = LIE_has_renamed_stuff
        }
    }

    question_of_the_capital_russia = {
        icon = GFX_decision_generic_colonial_administration
        allowed = { original_tag = LIE }
        fire_only_once = yes
        cost = 25

        available = {
            OR = {
                controls_state = 195
                controls_state = 219
                controls_state = 217
            }
        }

        highlight_states = {
			highlight_state_targets = {
                state = 195
                state = 219
                state = 217
            }
		}

        ai_will_do = { factor = 150 }

        visible = {
            has_cosmetic_tag = SOV
            if = {
                limit = { original_tag = LIE }
                #has_country_leader = {
                #    character = LIE_boris_smyslovsky
                #    ruling_only = yes
                #}
            }
        }

        complete_effect = { country_event = liechtenstein.33 }
    }

    reintegrate_the_don_republic = {
        icon = GFX_decision_generic_nationalism
        allowed = { original_tag = LIE }
        fire_only_once = yes
        cost = 100

        days_remove = 150

        available = {
            is_subject = no
            custom_trigger_tooltip = {
                tooltip = LIE_to_core_donrepublic
                238 = {
                    is_controlled_by = ROOT
                    compliance > 35
                    resistance < 5
                }
                218 = {
                    is_controlled_by = ROOT
                    compliance > 35
                    resistance < 5
                }
                245 = {
                    is_controlled_by = ROOT
                    compliance > 35
                    resistance < 5
                }
                217 = {
                    is_controlled_by = ROOT
                    compliance > 35
                    resistance < 5
                }
                265 = {
                    is_controlled_by = ROOT
                    compliance > 35
                    resistance < 5
                }
            }
        }

        modifier = {
            political_power_factor = -0.15
            consumer_goods_factor = 0.1
        }

        highlight_states = {
			highlight_state_targets = {
                state = 238
                state = 218
                state = 245
                state = 217
                state = 265
            }
		}

        ai_will_do = { factor = 150 }

        visible = {
            has_cosmetic_tag = SOV
            if = {
                limit = { original_tag = LIE }
                #has_country_leader = {
                #    character = LIE_boris_smyslovsky
                #    ruling_only = yes
                #}
            }
        }

        remove_effect = {
            add_political_power = 50
            add_stability = 0.05
            custom_effect_tooltip = generic_skip_one_line_tt
            every_state = {
                limit = {
                    OR = {
                        state = 238
                        state = 218
                        state = 245
                        state = 217
                        state = 265
                    }
                }
                add_claim_by = ROOT
            }
            custom_effect_tooltip = generic_skip_one_line_tt
            unlock_decision_tooltip = reclaim_the_kuban_region
            unlock_decision_tooltip = concessions_to_kalmyks
            set_country_flag = LIE_can_expand_southwards
            custom_effect_tooltip = generic_skip_one_line_tt
            custom_effect_tooltip = LIE_if_has_integrated_don_two
            effect_tooltip = {
                217 = { set_state_name = SOV_Volgograd }
                set_province_name = {
                    id = 3529
                    name = SOV_Volgograd
                }
            }
            hidden_effect = {
                if = {
                    limit = { has_country_flag = LIE_has_renamed_stuff }
                    217 = { set_state_name = SOV_Volgograd }
                    set_province_name = {
                        id = 3529
                        name = SOV_Volgograd
                    }
                }
            }
        }
    }

    reclaim_the_kuban_region = {
        icon = GFX_decision_generic_cavalry
        allowed = { original_tag = LIE }
        fire_only_once = yes
        cost = 50

        days_remove = 100

        available = {
            is_subject = no
            custom_trigger_tooltip = {
                tooltip = LIE_to_core_kuban
                234 = {
                    is_controlled_by = ROOT
                    compliance > 40
                    resistance < 5
                }
                233 = {
                    is_controlled_by = ROOT
                    compliance > 40
                    resistance < 5
                }
                235 = {
                    is_controlled_by = ROOT
                    compliance > 40
                    resistance < 5
                }
            }
        }

        modifier = {
            political_power_factor = -0.1
            consumer_goods_factor = 0.05
        }

        highlight_states = {
			highlight_state_targets = {
                state = 234
                state = 233
                state = 235
            }
		}

        ai_will_do = { factor = 150 }

        visible = {
            has_cosmetic_tag = SOV
            has_country_flag = LIE_can_expand_southwards
            if = {
                limit = { original_tag = LIE }
                #has_country_leader = {
                #    character = LIE_boris_smyslovsky
                #    ruling_only = yes
                #}
            }
        }

        remove_effect = {
            add_political_power = 35
            add_popularity = {
                ideology = ROOT
                popularity = 0.03
            }
            custom_effect_tooltip = generic_skip_one_line_tt
            every_state = {
                limit = {
                    OR = {
                        state = 234
                        state = 233
                        state = 235
                    }
                }
                add_claim_by = ROOT
            }
        }
    }

    concessions_to_kalmyks = {
        icon = GFX_decision_eng_trade_unions_support
        allowed = { original_tag = LIE }
        fire_only_once = yes
        cost = 25

        days_remove = 50

        available = {
            #is_subject = no
            237 = { is_controlled_by = ROOT }
            236 = { is_controlled_by = ROOT }
        }

        modifier = { political_power_factor = -0.05 }

        highlight_states = {
			highlight_state_targets = {
                state = 237
                state = 236
            }
		}

        ai_will_do = { factor = 150 }

        visible = {
            has_cosmetic_tag = SOV
            has_country_flag = LIE_can_expand_southwards
            if = {
                limit = { original_tag = LIE }
                #has_country_leader = {
                #    character = LIE_boris_smyslovsky
                #    ruling_only = yes
                #}
            }
        }

        remove_effect = {
            every_state = {
                limit = {
                    OR = {
                        state = 237
                        state = 236
                    }
                }
                add_compliance = 5
                add_resistance = -5
            }
            set_country_flag = can_integrate_kalmykia
            custom_effect_tooltip = generic_skip_one_line_tt
            unlock_decision_tooltip = integrate_kalmykia_into_russia
        }
    }

    integrate_kalmykia_into_russia = {
        icon = GFX_decision_generic_operation
        allowed = { original_tag = LIE }
        fire_only_once = yes
        cost = 35

        days_remove = 100

        available = {
            is_subject = no
            custom_trigger_tooltip = {
                tooltip = LIE_to_core_kalmykia
                237 = {
                    is_controlled_by = ROOT
                    compliance > 45
                    resistance < 5
                }
                236 = {
                    is_controlled_by = ROOT
                    compliance > 45
                    resistance < 5
                }
            }
        }

        modifier = { 
            political_power_factor = -0.1
            consumer_goods_factor = 0.05
        }

        highlight_states = {
			highlight_state_targets = {
                state = 237
                state = 236
            }
		}

        ai_will_do = { factor = 150 }

        visible = {
            has_cosmetic_tag = SOV
            has_country_flag = can_integrate_kalmykia
            if = {
                limit = { original_tag = LIE }
                #has_country_leader = {
                #    character = LIE_boris_smyslovsky
                #    ruling_only = yes
                #}
            }
        }

        remove_effect = {
            add_political_power = 20
            every_state = {
                limit = {
                    OR = {
                        state = 237
                        state = 236
                    }
                }
                add_claim_by = ROOT
            }
        }
    }
}

form_prussia_category = {

    form_prussia = {
        icon = generic_form_nation
        cost = 0
        fire_only_once = yes

        allowed = { original_tag = DNZ }

        available = {
            controls_state = 64
            controls_state = 68
            controls_state = 63
            controls_state = 66
            controls_state = 67
            controls_state = 807
            controls_state = 86
            controls_state = 762
            controls_state = 85
            controls_state = 62
            controls_state = 5
            controls_state = 763
        }

        ai_will_do = {
            factor = 150
        }

        #visible = {
        #    OR = { #weird conditions removed
        #        controls_state = 64
        #        controls_state = 5
        #        controls_state = 63
        #        controls_state = 807
        #        has_completed_focus = DNZ_prussia_legacy
        #    }
        #}

        complete_effect = {
            add_state_claim = 64
            add_state_claim = 68
            add_state_claim = 63
            add_state_claim = 66
            add_state_claim = 67
            add_state_claim = 807
            add_state_claim = 86
            add_state_claim = 762
            add_state_claim = 763
            add_state_claim = 188
            add_state_claim = 85
            add_state_claim = 62
            add_state_claim = 5
            #set_cosmetic_tag = PRS
            add_ideas = generic_recent_political_unification
            add_ideas = generic_recent_army_unification
            add_ideas = generic_recent_economic_unification
        }
    }
}

recreate_belgium_category = {

    recreate_belgium = {
        allowed = {
            OR = {
                original_tag = WLL
                original_tag = FLA
            }
        }
        fire_only_once = yes
        available = {
            if = {
                limit = { original_tag = FLA }
                NOT = { has_government = fascism }
            }
            is_subject = no
            6 = { is_controlled_by = ROOT }
            34 = { is_controlled_by = ROOT }
			1094 = { is_controlled_by = ROOT }
            1095  = { is_controlled_by = ROOT }
			965 = { is_controlled_by = ROOT }
        }
        icon = generic_form_nation
        complete_effect = {
#            set_cosmetic_tag = BEL_REUNIFIED
            set_country_flag = reunified_belgium_flag

            if = {
                limit  = {
                    ROOT = { has_government = democratic }
                }
                if = {
                    limit = { BEL = { democratic < 0.5 } }
                    BEL = {
                        add_popularity = { ideology = democratic popularity = 0.33 }
                        set_politics = {
                            ruling_party = democratic elections_allowed = yes
                        }
                    }
                }
                else = {
                    BEL = {
                        unlock_national_focus = BEL_form_coalition_government
                    }
                }
            }

            if = {
                limit  = {
                    ROOT = { has_government = neutrality }
                }
                if = {
                    limit = {
                        BEL = { neutrality < 0.5 }
                    }
                    BEL = {
                        add_popularity = { ideology = neutrality popularity = 0.33 }
                        set_politics = {
                            ruling_party = neutrality elections_allowed = yes
                        }
                    }
                }
                else = {
                    BEL = {
                        unlock_national_focus = BEL_king_reaction
                    }
                }
            }

            if = {
                limit  = {
                    ROOT = { has_government = communism }
                }
                if = {
                    limit  = {
                        BEL = { communism < 0.5 }
                    }
                    BEL = {
                        add_popularity = { ideology = communism popularity = 0.33 }
                        set_politics = {
                            ruling_party = communism elections_allowed = no
                        }
                    }
                }
                if = { #Check. If exclusive, then use else_if.
                    limit  = {
                        BEL = { has_idea = BEL_leopold3 }
                    }
                    BEL = {
                        swap_ideas = {
                            remove_idea = BEL_leopold3
                            add_idea = BEL_leopold3_exile
                        }
                    }
                }
                else = {
                    BEL = {
                        unlock_national_focus = BEL_go_left
                    }
                }
            }

            else = { #Fascist branch
#                limit = { ROOT = { has_government = fascism } }
                if = {
                    limit  = {
                        BEL = { fascism < 0.5 }
                    }
                    BEL = {
                        add_popularity = { ideology = fascism popularity = 0.33 }
                        set_politics = {
                             ruling_party = fascism elections_allowed = no
                        }
                    }
                }
                if = { #Check. If exclusive, then use else_if.
                    limit  = {
                        BEL = { has_idea = BEL_leopold3 }
                    }
                    BEL = {
                        swap_ideas = {
                            remove_idea = BEL_leopold3
                            add_idea = BEL_leopold3_exile
                        }
                    }
                }
                else = {
                    BEL = {
                        unlock_national_focus = BEL_go_right
                        unlock_national_focus = BEL_choose_Rex
                    }
                }
            }

            BEL = {
                set_capital = { state = 6 }
                add_ideas = generic_recent_political_unification
                add_ideas = generic_recent_army_unification
                add_ideas = generic_recent_economic_unification
                set_country_flag = BEL_1936_election
                annex_country = {
                    target = ROOT
                    transfer_troops = yes
                }
                change_tag_from = ROOT
            }
            FLA = {
                every_unit_leader = {
                    set_nationality = BEL
                }
                # exclude regional nationalists
            }
            WLL = {
                every_unit_leader = {
                    set_nationality = BEL
                }
            }
        }

        ai_will_do = {
            factor = 200
            modifier = {
                factor = 0
                is_historical_focus_on = yes
            }
        }
    }
}

form_united_netherlands_category2 = {
    form_united_netherlands2_BEL = {
        icon = generic_form_nation

        allowed = { original_tag = BEL }
        visible = {
            NOT = { has_global_flag = form_united_netherlands_flag }
        }
        available = {
            is_subject = no
            if = {
                limit = { has_global_flag = bel_dlc_focus_tree }
                OR = {
                    has_government = communism
                    has_completed_focus = BEL_support_the_vnv
                }
            }
            else = {
                OR = {
                    has_country_flag = Chose_Verdinaso
                    has_completed_focus = BEL_go_left
                }
            }

            # Netherlands
                custom_trigger_tooltip = {
                    tooltip = form_eu_netherlands_required_states_tt
                    controls_state = 7
                    controls_state = 35
                    controls_state = 36
                    owns_state = 7
                    owns_state = 35
                    owns_state = 36
                }
            # Belgium
                custom_trigger_tooltip = {
                    tooltip = form_eu_belgium_required_states_tt
                    controls_state = 6
                    controls_state = 34
					controls_state = 1094
                    controls_state = 1095
					controls_state = 965
                    owns_state = 6
                    owns_state = 34
					owns_state = 1094
                    owns_state = 1095
					owns_state = 965
                }
            }

        complete_effect = {
            custom_effect_tooltip = form_eu_netherlands_coring_states_tt
            hidden_effect = {
                set_cosmetic_tag = BEL5
                every_state = {
                    limit = { region = 5 NOT = { state = 8 } }
                    add_claim_by = ROOT
                }
            }
            hidden_effect = {
                news_event = { id = wtt_news.58 hours = 6 }
                set_global_flag = form_united_netherlands_flag
            }
            add_ideas = generic_recent_political_unification
            add_ideas = generic_recent_army_unification
            add_ideas = generic_recent_economic_unification
        }
        ai_will_do = {
            factor = 200
            modifier = {
                factor = 0
                is_historical_focus_on = yes
            }
        }
    }

    form_united_netherlands2_HOL = {
        icon = generic_form_nation

        allowed = { original_tag = HOL }

        visible = {
            NOT = { has_global_flag = form_united_netherlands_flag
				original_tag = HOL
			}
        }

        available = {
            is_subject = no
            OR = {
                has_government = fascism
                has_government = communism
            }
            # Netherlands
                custom_trigger_tooltip = {
                    tooltip = form_eu_netherlands_required_states_tt
                    controls_state = 7
                    controls_state = 35
                    controls_state = 36
                    owns_state = 7
                    owns_state = 35
                    owns_state = 36
                }
            # Belgium
                custom_trigger_tooltip = {
                    tooltip = form_eu_belgium_required_states_tt
                    controls_state = 6
                    controls_state = 34
					controls_state = 1094
                    controls_state = 1095
					controls_state = 965
                    owns_state = 6
                    owns_state = 34
					owns_state = 1094
                    owns_state = 1095
					owns_state = 965
                }
            }

        complete_effect = {
            custom_effect_tooltip = form_eu_belgium_coring_states_tt
            hidden_effect = {
                set_cosmetic_tag = BEL5
                every_state = {
                    limit = { region = 5 NOT = { state = 8 } }
                    add_claim_by = ROOT
                }
            }
            hidden_effect = {
                news_event = { id = wtt_news.58 hours = 6 }
                set_global_flag = form_united_netherlands_flag
            }
            add_ideas = generic_recent_political_unification
            add_ideas = generic_recent_army_unification
            add_ideas = generic_recent_economic_unification
        }
        ai_will_do = {
            factor = 200
            modifier = {
                factor = 0
                is_historical_focus_on = yes
            }
        }
    }
}

form_carribean_category = {
    form_caribbean = {
        icon = generic_form_nation
        days_re_enable = 0

        allowed = {
            OR = {
                original_tag = DOM
                original_tag = HAI
                original_tag = CUB
				original_tag = JAM
				original_tag = PUE
				original_tag = BAH
                original_tag = TRI
                original_tag = GDL
                original_tag = CRC
                original_tag = STK
				original_tag = DMN
				original_tag = BRB
				original_tag = STL
				original_tag = SVG
				original_tag = GRA
                original_tag = MAR
                original_tag = MAA
            }
        }
        fire_only_once = yes
        available = {
            994 = { is_controlled_by = ROOT }
            315 = { is_controlled_by = ROOT }
            318 = { is_controlled_by = ROOT }
            319 = { is_controlled_by = ROOT }
        }
        complete_effect = {
            set_cosmetic_tag = CAB
            hidden_effect = {
                every_state = { #This has a day of lag, for reasons
                    limit = {
                        OR = { is_core_of = CUB is_core_of = DOM is_core_of = HAI }
                    }
                    add_claim_by = ROOT
                }
                news_event = { id = r56.news_event.35 hours = 6 }


                if = {
                    limit = {
                        has_dlc = "La Resistance"
                    }
                    every_country = {
                        every_operative = {
                            limit = {
                                OR = {
                                    has_nationality = DOM
                                    has_nationality = HAI
                                    has_nationality = CUB
                                    has_nationality = JAM
                                    has_nationality = PUE
                                    has_nationality = BAH
                                    has_nationality = TRI
                                    has_nationality = GDL
                                    has_nationality = CRC                                    
                                }
                                NOT = {
                                    has_nationality = ROOT
                                }
                            }
                            add_nationality = ROOT
                        }
                    }
                }

            }
            every_state = { #This has a day of lag, for reasons
                limit = {
                    OR = { is_core_of = TRI is_core_of = PUE is_core_of = BAS is_core_of = GDL is_core_of = BAH is_core_of = CRC is_core_of = JAM is_core_of = STK is_core_of = DMN is_core_of = BRB is_core_of = STL is_core_of = SVG is_core_of = GRA is_core_of = MAR is_core_of = MAA }
                }
                add_claim_by = ROOT
            }
            972 = {
                add_claim_by = ROOT
            }
            1050 = {
                add_claim_by = ROOT
            }
        }
        ai_will_do = {
            factor = 50
        }
    }
}

ENG_restore_the_UK = {
    unite_britain = {
        days_re_enable = 0
        fire_only_once = yes

        visible = { original_tag = ENG }
        available = { #Scotland & Wales
            is_subject = no
            NOT = {
                any_state = {
                    OR = {
                        is_core_of = SCO
                        is_core_of = WLS
                        state = 119
                    }
                    NOT = {
                        OR = {
                            is_controlled_by = ROOT
                            OWNER = {
                                is_subject_of = ROOT
                            }
                        }
                    }
                }
            }
            #119 = { is_controlled_by = ROOT }
        }
        icon = eng_install_government

        complete_effect = {
            drop_cosmetic_tag = yes
            every_state = {
                limit = {
                    OR = {
                        is_core_of = SCO
                        is_core_of = WLS
                        state = 119
                    }
                }
                add_claim_by = ROOT
            }
            set_capital = { state = 126 }
            add_ideas = generic_recent_political_unification
            add_ideas = generic_recent_army_unification
            add_ideas = generic_recent_economic_unification
            hidden_effect = {
                news_event = { id = r56.news_event.38 hours = 6 }
            }
        }
        ai_will_do = {
            factor = 50
        }
    }
}

celtic_unification_category = {
    form_celtic_union = {
        icon = generic_form_nation
        fire_only_once = yes
        allowed = {
            OR = {
                original_tag = SCO
                original_tag = IRE
                original_tag = NIR
                original_tag = BRI
                original_tag = WLS
            }
        }
        available = {
            is_subject = no
            #IRE
            controls_state = 113
            controls_state = 119
            controls_state = 134
            controls_state = 135
            #WLS
            controls_state = 122
            #SCO
            controls_state = 133
            controls_state = 121
            controls_state = 136
            controls_state = 120
            controls_state = 123
            #BRI
            controls_state = 14

			# isle of man
			controls_state = 1042

        }
        complete_effect = {

            set_cosmetic_tag = CEL_UNIFIED
            hidden_effect = {
                113 = { add_claim_by = ROOT }
                119 = { add_claim_by = ROOT }
                #114 = { add_claim_by = ROOT }
                134 = { add_claim_by = ROOT }
                135 = { add_claim_by = ROOT }
                122 = { add_claim_by = ROOT }
                133 = { add_claim_by = ROOT }
                121 = { add_claim_by = ROOT }
                136 = { add_claim_by = ROOT }
                120 = { add_claim_by = ROOT }
                123 = { add_claim_by = ROOT }
                970 = { add_claim_by = ROOT }
                971 = { add_claim_by = ROOT }
                14 = { add_claim_by = ROOT }
				1042 = { add_claim_by = ROOT }
                news_event = { id = r56.news_event.33 hours = 6 }

                if = {
                    limit = {
                        has_dlc = "La Resistance"
                    }
                    every_country = {
                        every_operative = {
                            limit = {
                                OR = {
                                    has_nationality = SCO
                                    has_nationality = IRE
                                    has_nationality = NIR
                                    has_nationality = BRI
                                    has_nationality = WLS
                                }
                                NOT = {
                                    has_nationality = ROOT
                                }
                            }
                            add_nationality = ROOT
                        }
                    }
                }
            }
            123 = { 
                add_claim_by = ROOT 
                set_state_name = "Cornwall"
            }

            add_ideas = generic_recent_political_unification
            add_ideas = generic_recent_army_unification
            add_ideas = generic_recent_economic_unification
            hidden_effect = {
                set_party_name = {
                    ideology = neutrality
                    long_name = CEL_UNIFIED_neutrality_party_long
                    name = CEL_UNIFIED_neutrality_party
                }
                set_party_name = {
                    ideology = democratic
                    long_name = CEL_UNIFIED_democratic_party_long
                    name = CEL_UNIFIED_democratic_party
                }
                set_party_name = {
                    ideology = communism
                    long_name = CEL_UNIFIED_communism_party_long
                    name = CEL_UNIFIED_communism_party
                }
                set_party_name = {
                    ideology = fascism
                    long_name = CEL_UNIFIED_fascism_party_long
                    name = CEL_UNIFIED_fascism_party
                }                               

            }

        }

        ai_will_do = {
            factor = 200
        #   modifier = {
        #       factor = 0
        #       is_historical_focus_on = yes
        #   }
        }
    }

    CEL_UNIFIED_integrate_galicia = {
        icon = generic_form_nation

        allowed = {
            OR = {
                original_tag = SCO
                original_tag = IRE
                original_tag = NIR
                original_tag = BRI
                original_tag = WLS
            }
        }

        cost = 50

        available = {
            is_subject = no
            # Galicia
            controls_state = 171
            171 = { compliance > 40 }
        }

        visible = {
            has_cosmetic_tag = CEL_UNIFIED
        }

        days_remove = 90

        remove_effect = {
            171 = { add_claim_by = ROOT }
        }

        ai_will_do = {
            factor = 200
        #    modifier = {
        #        factor = 0
        #        is_historical_focus_on = yes
        #    }
        }
    }

    CEL_UNIFIED_wall_of_steel = {
        icon = generic_political_discourse
        fire_only_once = yes

        allowed = {
            OR = {
                original_tag = SCO
                original_tag = IRE
                original_tag = NIR
                original_tag = WLS
            }
        }

        cost = 25

        visible = {
            has_cosmetic_tag = CEL_UNIFIED
            NOT = { original_tag = BRI }
        }

        complete_effect = {
        #    BRI = { retire_character = BRI_francois_taldir_jaffrennou }
        #    ROOT = { recruit_character = BRI_francois_taldir_jaffrennou }
            #set_nationality is what the wiki recommends but it doesn't work.
           # BRI_francois_taldir_jaffrennou = {
           #     set_nationality = ROOT
           # }
            every_possible_country = {
                limit = { has_character = BRI_francois_taldir_jaffrennou }
                random_character = {
                    limit = {
                        is_character = BRI_francois_taldir_jaffrennou
                    }
                    set_nationality = ROOT
                }
            }
            set_country_flag = CEL_francois_recruited
        }

        ai_will_do = {
            factor = 200
        }
    }
}

#form_turkestan_category = {
#    form_turkestan = {
#        icon = generic_form_nation
#        fire_only_once = yes
#
#        allowed = {
#            OR = {
#                original_tag = KAZ
#                original_tag = UZB
#                original_tag = TMS
#                original_tag = TAJ
#                original_tag = KYR
#                original_tag = TAN
#                #AND = { #Can't add Sinkiang until a solution is found regarding the political struggle in China
#                #    original_tag = SIK
#                #    NOT = {
#                #        tag = event_target:WTT_current_china_leader
#                #    }
#                #}
#            }
#        }
#
#        available = {
#            is_subject = no
#            # Kazakhstan
#            custom_trigger_tooltip = {
#                tooltip = form_country_kazakhstan_required_states_tt
#                all_state = {
#                    OR = {
#                        NOT = { is_core_of = KAZ }
#                        is_controlled_by = ROOT
#                    }
#                }
#            }
#            # Uzbekistan
#            custom_trigger_tooltip = {
#                tooltip = form_country_uzbekistan_required_states_tt
#                controls_state = 405
#                controls_state = 585
#            }
#            # Turkmenistan
#            custom_trigger_tooltip = {
#                tooltip = form_country_turkmenistan_required_states_tt
#                controls_state = 584
#            }
#            # Tajikistan
#            custom_trigger_tooltip = {
#                tooltip = form_country_tajikistan_required_states_tt
#                controls_state = 742
#            }
#            # Kyrgyzstan
#            custom_trigger_tooltip = {
#                tooltip = form_country_kyrgyzstan_required_states_tt
#                controls_state = 732
#            }
#        }
#
#        complete_effect = {
#            set_cosmetic_tag = TRK_UNITED
#            hidden_effect = {
#                every_state = {
#                    limit = {
#                        OR = {
#                            region = 136 #The Great Steppe, contains most of the provinces.
#                            region = 145 #Sinkiang
#                            is_core_of = TAN #Tannu Tuva
#                            is_core_of = KAZ #Kazakhstan
#                        }
#                    }
#                    add_claim_by = ROOT
#                }
#            }
#            # Kazakhstan
#            custom_effect_tooltip = form_country_kazakhstan_coring_states_tt
#            # Uzbekistan
#            custom_effect_tooltip = form_country_uzbekistan_coring_states_tt
#            # Turkmenistan
#            custom_effect_tooltip = form_country_turkmenistan_coring_states_tt
#            # Tajikistan
#            custom_effect_tooltip = form_country_tajikistan_coring_states_tt
#            # Kyrgyzstan
#            custom_effect_tooltip = form_country_kyrgyzstan_coring_states_tt
#            #Uyguristan - Sinkiang
#            custom_effect_tooltip = form_country_sinkiang_coring_states_tt
#            654 = { add_claim_by = ROOT }
##            329 = { add_claim_by = ROOT }
#
#            ROOT = {
#                add_state_claim = 40
#                add_state_claim = 570
#
#                add_state_claim = 569
#                add_state_claim = 572
#                add_state_claim = 582
#                add_state_claim = 651
#
#                add_state_claim = 652
#                add_state_claim = 251
#                add_state_claim = 249
#
#                add_state_claim = 401
#                add_state_claim = 236
#            }
#            add_ideas = generic_recent_political_unification
#            add_ideas = generic_recent_army_unification
#            add_ideas = generic_recent_economic_unification
#            hidden_effect = {
#                #news_event = { id = wtt_news.1003 hours = 6 }
#                #country_event = { id = armenia.28 days = 2 }
#                set_global_flag = turkestan_formed
#            }
#        }
#
#        ai_will_do = {
#            factor = 200
#            modifier = {
#                factor = 0
#                is_historical_focus_on = yes
#            }
#        }
#    }
#}

form_malayan_confederation_category = {
	# Form Sumatra
	form_sumatra = {
		icon = generic_form_nation

		allowed = {
			OR = {
				original_tag = ATJ
				original_tag = SSI
			}
		}

		highlight_states = { 
			highlight_state_targets = {
				state = 1128
				state = 1135
				state = 974
				state = 672
			}
		}

		available = {
			is_subject = no
			controls_state = 1128
			controls_state = 1135
			controls_state = 974
			controls_state = 672
		}

		visible = { NOT = { has_global_flag = form_sumatra_flag } }
		ai_will_do = { base = 200 }

		complete_effect = {
			set_cosmetic_tag = SMT
			hidden_effect = { set_global_flag = form_sumatra_flag set_country_flag = hello_i_am_sumatra_now }
			custom_effect_tooltip = generic_skip_one_line_tt
			every_state = {
				limit = {
					NOT = { is_core_of = ROOT }
					OR = {
						state = 1128
						state = 1135
						state = 974
						state = 672
						state = 909
					}
				}
				add_claim_by = ROOT
			}
		}
	}

	# Form North Borneo
	form_north_kalimantan = {
		icon = generic_form_nation

		allowed = {
			OR = {
				original_tag = SAR
				original_tag = SAB
				original_tag = BRN
			}
		}

		highlight_states = { 
			highlight_state_targets = {
				state = 333
				state = 1131
				state = 1014
				state = 916
			}
		}

		available = {
			is_subject = no
			controls_state = 333
			controls_state = 1131
			controls_state = 1014
			controls_state = 916
		}

		visible = { NOT = { has_global_flag = form_north_kalimantan_flag } }
		ai_will_do = { base = 200 }

		complete_effect = {
			set_cosmetic_tag = NBR
			hidden_effect = { set_global_flag = form_north_kalimantan_flag set_country_flag = hello_i_am_now_north_borneo }
			custom_effect_tooltip = generic_skip_one_line_tt
			every_state = {
				limit = {
					NOT = { is_core_of = ROOT }
					OR = {
						state = 333
						state = 1131
						state = 1014
						state = 916
					}
				}
				add_claim_by = ROOT
			}
			custom_effect_tooltip = generic_skip_one_line_tt
			unlock_decision_tooltip = form_borneo
		}
	}

	# Form Borneo
	form_borneo = {
		icon = generic_form_nation

		allowed = {
			OR = {
				original_tag = KUT
				original_tag = POK
				original_tag = SAR
				original_tag = SAB
				original_tag = BRN
			}
		}

		highlight_states = { 
			highlight_state_targets = {
				state = 333
				state = 1131
				state = 1014
				state = 916
				state = 334
				state = 978
			}
		}

		available = {
			is_subject = no
			controls_state = 333
			controls_state = 1131
			controls_state = 1014
			controls_state = 916
			controls_state = 334
			controls_state = 978
		}

		visible = {
			OR = {
				original_tag = KUT
				original_tag = POK
				AND = {
					OR = {
						original_tag = SAR
						original_tag = SAB
						original_tag = BRN
					}
					has_country_flag = hello_i_am_now_north_borneo
				}
			}
			NOT = { has_global_flag = form_kalimantan_flag }
		}

		complete_effect = {
			set_cosmetic_tag = KLM
			hidden_effect = { set_global_flag = form_kalimantan_flag set_country_flag = hello_i_am_borneo_will_you_be_my_friend }
			custom_effect_tooltip = generic_skip_one_line_tt
			every_state = {
				limit = {
					NOT = { is_core_of = ROOT }
					OR = {
						state = 333
						state = 1131
						state = 1014
						state = 916
						state = 334
						state = 978
						state = 977
					}
				}
				add_claim_by = ROOT
			}
		}

		ai_will_do = { base = 200 }
	}

	# Form East Indonesia
	form_east_indonesia = {
		icon = generic_form_nation

		allowed = {
			OR = {
				original_tag = TML
				original_tag = WPG
				original_tag = MLK
				original_tag = TNE
				original_tag = GOW
				original_tag = MNH
				original_tag = EIS
				original_tag = BLI
			}
		}

		highlight_states = { 
			highlight_state_targets = {
				state = 1127
				state = 667
				state = 1142
				state = 673
				state = 975
				state = 668
				state = 738
			}
		}

		available = {
			is_subject = no
			controls_state = 1127
			controls_state = 667
			controls_state = 1142
			controls_state = 673
			controls_state = 975
			controls_state = 668
			controls_state = 738
		}

		visible = {
			OR = {
				original_tag = TML
				original_tag = MLK
				original_tag = TNE
				original_tag = GOW
				original_tag = MNH
				original_tag = EIS
				original_tag = BLI
				AND = {
					original_tag = WPG
					has_country_flag = hello_i_am_papua_but_big
				}
			}
			NOT = { has_global_flag = form_east_indonesia_flag }
		}

		complete_effect = {
			set_cosmetic_tag = EIS
			custom_effect_tooltip = generic_skip_one_line_tt
			hidden_effect = { set_global_flag = form_east_indonesia_flag set_country_flag = hello_i_am_indonesia_but_eastern }
			every_state = {
				limit = {
					NOT = { is_core_of = ROOT }
					OR = {
						state = 1127
						state = 667
						state = 1142
						state = 721
						state = 673
						state = 975
						state = 668
						state = 738
					}
				}
				add_claim_by = ROOT
			}

			if = {
				limit = {
					OR = {
						original_tag = MLK
						original_tag = TNE
						original_tag = EIS
						original_tag = BLI
						original_tag = TML
						original_tag = MNH
						original_tag = GOW
					}
				}
				custom_effect_tooltip = generic_skip_one_line_tt
				unlock_decision_tooltip = form_papua
			}
		}

		ai_will_do = { base = 200 }
	}

	# Form Papua
	form_papua = {
		icon = generic_form_nation

		allowed = {
			OR = {
				original_tag = WPG
				original_tag = PNG
				original_tag = MLK
				original_tag = TNE
				original_tag = EIS
				original_tag = BLI
				original_tag = TML
				original_tag = INS
				original_tag = JVA
				original_tag = MAL
				original_tag = SNG
				original_tag = POK
				original_tag = KUT
			}
		}

		highlight_states = { 
			highlight_state_targets = {
				state = 669
				state = 1137
				state = 1096
				state = 523
			}
		}

		available = {
			is_subject = no
			controls_state = 669
			controls_state = 1137
			controls_state = 1096
			controls_state = 523
		}

		visible = {
			if = {
				limit = {
					OR = {
						original_tag = MLK
						original_tag = TNE
						original_tag = EIS
						original_tag = BLI
						original_tag = TML
						original_tag = MNH
						original_tag = GOW
					}
				}
				has_country_flag = hello_i_am_indonesia_but_eastern
			}
			if = {
				limit = { original_tag = INS }
				669 = { is_core_of = INS }
				1137 = { is_core_of = INS }
				has_global_flag = form_majapahit_empire_flag
			}
			if = {
				limit = {
					OR = {
						original_tag = MAL
						original_tag = JVA
						original_tag = SNG
						original_tag = SAR
						original_tag = BRN
						original_tag = SAB
						original_tag = POK
						original_tag = KUT
					}
				}
				has_global_flag = form_majapahit_empire_flag
			}
			if = {
				limit = {
					OR = {
						original_tag = WPG
						original_tag = PNG
					}
				}
				NOT = { has_global_flag = form_papua_flag }
			}
		}

		complete_effect = {
			if = {
				limit = {
					NOT = {
						OR = {
							original_tag = WPG
							original_tag = PNG
						}
					}
				}
				add_stability = -0.075
				custom_effect_tooltip = generic_skip_one_line_tt
			}
			if = {
				limit = {
					OR = {
						original_tag = WPG
						original_tag = PNG
					}
					NOT = {
						has_global_flag = formed_melanesia_flag
					}
				}
				set_cosmetic_tag = PNG
				custom_effect_tooltip = generic_skip_one_line_tt
				hidden_effect = {
					set_country_flag = hello_i_am_papua_but_big
					set_global_flag = form_papua_flag
				}
			}
			every_state = {
				limit = {
					NOT = { is_core_of = ROOT }
					OR = {
						state = 669
						state = 1137
						state = 1096
						state = 523
						state = 737
					}
				}
				add_claim_by = ROOT
			}
			if = {
				limit = {
					OR = {
						original_tag = WPG
						original_tag = PNG
					}
				}
				custom_effect_tooltip = generic_skip_one_line_tt
				unlock_decision_tooltip = form_east_indonesia
			}
		}

		ai_will_do = { base = 200 }
	}
}

form_nation_mod_category = {
	assimilate_chiapas = {

		icon = generic_nationalism

		cost = 25

		fire_only_once = yes

		days_remove = 60

		allowed = {
			OR = {
				original_tag = GUA
				original_tag = ELS
				original_tag = HON
				original_tag = NIC
				original_tag = COS
			}
		}

		highlight_states = {
			highlight_state_targets = {
                state = 475
			}
		}

		available = {
			has_civil_war = no
            has_completed_focus = USC_UNIFIED_central_american_unification
			475 = {
                compliance > 25
				is_controlled_by = ROOT
			}
		}

		visible = {
            OR = {
                has_cosmetic_tag = CRCA
			    has_cosmetic_tag = USC_UNIFIED
            }
            475 = {
                NOT = {
					is_core_of = ROOT
				}
            }
		}

        modifier = {
            political_power_factor = -0.10
            resistance_damage_to_garrison = 0.05
            resistance_growth = 0.05
        }

		remove_effect = {
			475 = {
				add_claim_by = ROOT
			}
		}

		ai_will_do = {
			factor = 50
		}		
	}
    assimilate_yucatan = {

		icon = generic_nationalism

		cost = 25

		fire_only_once = yes

		days_remove = 60

		allowed = {
			OR = {
				original_tag = GUA
				original_tag = ELS
				original_tag = HON
				original_tag = NIC
				original_tag = COS
			}
		}

		highlight_states = {
			highlight_state_targets = {
                state = 474
			}
		}

		available = {
			has_civil_war = no
            has_completed_focus = USC_UNIFIED_central_american_unification
			474 = {
                compliance > 25
				is_controlled_by = ROOT
			}
		}

		visible = {
            OR = {
                has_cosmetic_tag = CRCA
                has_cosmetic_tag = USC_UNIFIED
            }
            474 = {
                NOT = {
					is_core_of = ROOT
				}
            }
		}

        modifier = {
            political_power_factor = -0.10
            resistance_damage_to_garrison = 0.05
            resistance_growth = 0.05
        }

		remove_effect = {
			474 = {
				add_claim_by = ROOT
			}
		}

		ai_will_do = {
			factor = 50
		}		
	}
	assimilate_panama = {

		icon = generic_nationalism

		cost = 35

		fire_only_once = yes

		days_remove = 60

		allowed = {
			OR = {
				original_tag = GUA
				original_tag = ELS
				original_tag = HON
				original_tag = NIC
				original_tag = COS
			}
		}

		highlight_states = {
			highlight_state_targets = {
                state = 937
                state = 304
			}
		}

		available = {
			has_civil_war = no
            has_completed_focus = USC_UNIFIED_central_american_unification
			937 = {
                compliance > 25
				is_controlled_by = ROOT
			}
            304 = {
                compliance > 25
				is_controlled_by = ROOT
            }
		}

		visible = {
            OR = {
                has_cosmetic_tag = CRCA
			    has_cosmetic_tag = USC_UNIFIED
            }
            937 = {
                NOT = {
					is_core_of = ROOT
				}
            }
            304 = {
                NOT = {
					is_core_of = ROOT
				}
            }
		}

        modifier = {
            political_power_factor = -0.10
            resistance_damage_to_garrison = 0.05
            resistance_growth = 0.05
        }

		remove_effect = {
			937 = {
				add_claim_by = ROOT
			}
            304 = {
				add_claim_by = ROOT
			}
            685 = {
				add_claim_by = ROOT
			}
		}

		ai_will_do = {
			factor = 50
		}		
	}

	integrate_greater_morocco = {

		icon = generic_form_nation

		allowed = {
			original_tag = MOR
		}

		available = {
			# West Sahara and mauritania
			controls_state = 699
			controls_state = 557
			controls_state = 786
		}

		visible = {
			original_tag = MOR
			NOT = { has_country_flag = country_formed_greater_morocco }

		}

		complete_effect = {

			# Greater morocco
			699 = { add_claim_by = ROOT }
			557 = { add_claim_by = ROOT }
			786 = { add_claim_by = ROOT }
               add_political_power = 50
               add_stability = -0.05
               add_ideas = generic_recent_political_unification
			add_ideas = generic_recent_army_unification
			add_ideas = generic_recent_economic_unification

			hidden_effect = {
				set_country_flag = country_formed_greater_morocco
			}
		}

		ai_will_do = {
			factor = 200
		}
	}

    form_la_plata = {
        fire_only_once = yes
        icon = generic_form_nation

        allowed = {
            OR = {
                original_tag = BOL
                original_tag = ARG
                original_tag = URG
                original_tag = PAR
                original_tag = CHL
            }

        }
        visible = {
            if = {
                limit = {
                    original_tag = CHL
                }
                NOT = { has_country_flag = r56_hide_formables }
            }
        }
        available = { #Argentina, Uruguay, Paraguay
            ARG = {
                all_core_state = {
                    is_controlled_by = ROOT
                }
            }
            URG = {
                all_core_state = {
                    is_controlled_by = ROOT
                }
            }
            PAR = {
                all_core_state = {
                    is_controlled_by = ROOT
                }
            }
        }
        complete_effect = {
            set_cosmetic_tag = PLA
            if = {
                limit = {
                    278 = { is_capital = no }
                }
                set_capital = { state = 278 }
            }
            hidden_effect = {
                if = {
                    limit = {
                        has_dlc = "La Resistance"
                    }
                    every_country = {
                        every_operative = {
                            limit = {
                                OR = {
                                    has_nationality = BOL
                                    has_nationality = ARG
                                    has_nationality = URG
                                    has_nationality = PAR
                                    has_nationality = CHL                                    
                                }
                                NOT = {
                                    has_nationality = ROOT
                                }
                            }
                            add_nationality = ROOT
                        }
                    }
                }
                every_state = { #This has a day of lag, for some reason.
                    limit = { OR = { is_core_of = ARG is_core_of = PAR is_core_of = URG } }
                    add_claim_by = PREV #ROOT
                }
                add_state_claim = 506
                news_event = { id = r56.news_event.36 hours = 6 }
            }
            add_state_claim = 299
            add_ideas = generic_recent_political_unification
            add_ideas = generic_recent_army_unification
            add_ideas = generic_recent_economic_unification
        }

        ai_will_do = {
            factor = 50
        }
    }

    form_west_african_union = {

        fire_only_once = yes

        icon = generic_form_nation

        allowed = {
            OR = {
				tag = MRT
				tag = GAM
				tag = MLI
				tag = GNB
				tag = GNA
				tag = SIE
				tag = LIB
				tag = IVO
				tag = VOL
				tag = GHA
				tag = TOG
				tag = DAH
				tag = NGR
				tag = NGA
				tag = BIA
				tag = SOK # ideally should be able to make a caliphate and core islamic africa
			}
        }

        visible = {
            NOT = {
                has_cosmetic_tag = ARA_UNIFIED
                has_cosmetic_tag = MALI_UNITED
            }
        }

        available = {
            is_subject = no
           	controls_state = 557
			controls_state = 272
			controls_state = 701
			controls_state = 296
			controls_state = 780
            controls_state = 899
            controls_state = 898
            controls_state = 556
            controls_state = 700
            controls_state = 298
            controls_state = 779
            controls_state = 778
            controls_state = 274
            controls_state = 777
            controls_state = 776
            controls_state = 781
            controls_state = 902
            controls_state = 558
            controls_state = 900
            controls_state = 901
        }

        highlight_states = {
            highlight_state_targets = {
                state = 557
                state = 272
                state = 701
                state = 296
                state = 780
                state = 899
                state = 898
                state = 556
                state = 700
                state = 298
                state = 779
                state = 778
                state = 274
                state = 777
                state = 776
                state = 781
                state = 902
                state = 558
                state = 900
                state = 901
            }
        }

        complete_effect = {
            set_cosmetic_tag = WAU_UNITED
            hidden_effect = {
                if = {
                    limit = {
                        has_dlc = "La Resistance"
                    }
                    every_country = {
                        every_operative = {
                            limit = {
                                OR = {
                                    has_nationality = MRT
                                    has_nationality = GAM
                                    has_nationality = MLI
                                    has_nationality = GNB
                                    has_nationality = GNA
                                    has_nationality = SIE
                                    has_nationality = LIB
                                    has_nationality = IVO
                                    has_nationality = VOL
                                    has_nationality = GHA
                                    has_nationality = TOG
                                    has_nationality = DAH
                                    has_nationality = NGR
                                    has_nationality = NGA                                
                                }
                                NOT = {
                                    has_nationality = ROOT
                                }
                            }
                            add_nationality = ROOT
                        }
                    }
                }
                every_state = { #This has a day of lag, for some reason.
                    limit = {
                        OR = {
                            state = 557
                            state = 272
                            state = 701
                            state = 296
                            state = 780
                            state = 899
                            state = 898
                            state = 556
                            state = 700
                            state = 298
                            state = 779
                            state = 799
                            state = 778
                            state = 274
                            state = 777
                            state = 776
                            state = 781
                            state = 902
                            state = 558
                            state = 900
                            state = 901
                            state = 786 # Sahara
                            state = 782 # Sahara
                            state = 515 # Sahara
                        }
                    }
                    add_claim_by = ROOT
                }
                news_event = { id = r56.news_event.37 hours = 6 }
            }
            add_state_claim = 699
            custom_effect_tooltip = form_country_gs_required_coring_states_tt
            add_ideas = generic_recent_political_unification
            add_ideas = generic_recent_army_unification
            add_ideas = generic_recent_economic_unification
        }

        ai_will_do = {
            factor = 500
        }
    }
    
    reform_the_empire_of_mali = {

        fire_only_once = yes

        icon = generic_form_nation

        allowed = {
           original_tag = MLI
        }

        visible = {
            NOT = {
                has_cosmetic_tag = WAU_UNITED
            }
        }

        available = { #
            is_subject = no
            has_completed_focus = WAF_continue_expansion
            controls_state = 898
            controls_state = 556
            controls_state = 899
            controls_state = 272
            controls_state = 701
            controls_state = 557
        }

        highlight_states = {
            highlight_state_targets = {
                state = 898
                state = 556
                state = 899
                state = 272
                state = 701
                state = 557
            }
        }

        complete_effect = {
            set_cosmetic_tag = MALI_UNITED
            hidden_effect = {
                if = {
                    limit = {
                        has_dlc = "La Resistance"
                    }
                    every_country = {
                        every_operative = {
                            limit = {
                                OR = {
                                    has_nationality = MLI
                                    has_nationality = SEN
                                    has_nationality = GAM
                                    has_nationality = MRT
                                }
                                NOT = {
                                    has_nationality = ROOT
                                }
                            }
                            add_nationality = ROOT
                        }
                    }
                }
                every_state = { #This has a day of lag, for some reason.
                    limit = {
                        OR = {
                            state = 898
                            state = 556
                            state = 899
                            state = 272
                            state = 701
                            state = 557
                        }
                    }
                    add_claim_by = ROOT
                }
                news_event = { id = r56.news_event.37 hours = 6 }
            }
            add_state_claim = 699
            custom_effect_tooltip = form_country_gs_required_coring_states_tt
            add_ideas = generic_recent_political_unification
            add_ideas = generic_recent_army_unification
            add_ideas = generic_recent_economic_unification
        }

        ai_will_do = {
            factor = 50
        }
    }

#    form_east_african_union = { # mmh be sure that BBA east african union works
#        fire_only_once = yes
#        icon = generic_form_nation
#
#        allowed = {
#            OR = {
#                original_tag = UGA
#                original_tag = TZN
#                original_tag = KEN
#                original_tag = BRD
#                original_tag = RWA
#                original_tag = SSU
#            }
#
#        }
#        visible = {
#
#        }
#        available = { #Argentina, Uruguay, Paraguay
#            all_state = {
#                OR = {
#                    NOT = { is_core_of = UGA }
#                    is_controlled_by = ROOT
#                }
#            }
#            all_state = {
#                OR = {
#                    NOT = { is_core_of = TZN }
#                    is_controlled_by = ROOT
#                }
#            }
#            all_state = {
#                OR = {
#                    NOT = { is_core_of = KEN }
#                    is_controlled_by = ROOT
#                }
#            }
#            all_state = {
#                OR = {
#                    NOT = { is_core_of = BRD }
#                    is_controlled_by = ROOT
#                }
#            }
#            all_state = {
#                OR = {
#                    NOT = { is_core_of = RWA }
#                    is_controlled_by = ROOT
#                }
#            }
#        }
#        complete_effect = {
#            set_cosmetic_tag = EAU_UNITED
#            #if = {
#            #    limit = {
#            #        278 = { is_capital = no }
#            #    }
#            #    set_capital = 278
#            #}
#            hidden_effect = {
#                every_state = { #This has a day of lag, for some reason.
#                    limit = {
#                        OR = {
#                            is_core_of = UGA
#                            is_core_of = TZN
#                            is_core_of = KEN
#                            is_core_of = BRD
#                            is_core_of = RWA
#                        }
#                    }
#                    add_claim_by = PREV #ROOT
#                }
#                news_event = { id = r56.news_event.37 hours = 6 }
#            }
#            add_ideas = generic_recent_political_unification
#            add_ideas = generic_recent_army_unification
#            add_ideas = generic_recent_economic_unification
#        }
#
#        ai_will_do = {
#            factor = 50
#        }
#    }

    reunite_germany = {
        days_re_enable = 0

        allowed = {
            OR = {
                original_tag = WGR
                original_tag = DDR
                original_tag = SAX
                original_tag = HAN
                original_tag = MEK
                original_tag = SHL
                original_tag = WUR
                original_tag = PRE
                original_tag = BAY
                original_tag = BAD
                original_tag = DNZ
                original_tag = SAA
                original_tag = VGE
				original_tag = RHI
				original_tag = THU
            }
        }
        visible = {
            NOT = {
                country_exists = GER
            }
        }
        fire_only_once = yes
        available = {
            is_subject = no
            42 = { is_controlled_by = ROOT }
            1053 = { is_controlled_by = ROOT }
            50 = { is_controlled_by = ROOT }
            51 = { is_controlled_by = ROOT }
            52 = { is_controlled_by = ROOT }
            53 = { is_controlled_by = ROOT }
            54 = { is_controlled_by = ROOT }
            55 = { is_controlled_by = ROOT }
            56 = { is_controlled_by = ROOT }
            57 = { is_controlled_by = ROOT }
            58 = { is_controlled_by = ROOT }
            998 = { is_controlled_by = ROOT }
            59 = { is_controlled_by = ROOT }
            989 = { is_controlled_by = ROOT }
            922 = { is_controlled_by = ROOT }
            923 = { is_controlled_by = ROOT }
            #DDR IRL
            60 = { is_controlled_by = ROOT }
            61 = { is_controlled_by = ROOT }
            62 = { is_controlled_by = ROOT }
            64 = { is_controlled_by = ROOT }
            65 = { is_controlled_by = ROOT }
            #119 = { is_controlled_by = ROOT }
        }
        icon = generic_form_nation
        complete_effect = { #Region 7: 42, 50, 51, 52, 53, 54, 55, 989, 922, 923
            every_state = {
                limit = { region = 7 }
                add_claim_by = ROOT
            }

            56 = { add_claim_by = ROOT }
            57 = { add_claim_by = ROOT }
            58 = { add_claim_by = ROOT }
            998 = { add_claim_by = ROOT }
            59 = { add_claim_by = ROOT }
            1053 = { add_claim_by = ROOT }

            60 = { add_claim_by = ROOT }
            61 = { add_claim_by = ROOT }
            62 = { add_claim_by = ROOT }
            64 = { add_claim_by = ROOT }
            65 = { add_claim_by = ROOT }
            add_ideas = generic_recent_political_unification
            add_ideas = generic_recent_army_unification
            add_ideas = generic_recent_economic_unification
            set_country_flag = reunited_germany
            set_global_flag = global_reunited_germany
            set_cosmetic_tag = GER_REUNITED
            set_capital = { state = 64 }
            hidden_effect = {
                news_event = { id = r56.news_event.39 hours = 6 }

                if = {
                    limit = {
                        has_dlc = "La Resistance"
                    }
                    every_country = {
                        every_operative = {
                            limit = {
                                OR = {

                                    has_nationality = WGR
                                    has_nationality = DDR
                                    has_nationality = SAX
                                    has_nationality = HAN
                                    has_nationality = MEK
                                    has_nationality = SHL
                                    has_nationality = WUR
                                    has_nationality = PRE
                                    has_nationality = BAY
                                    has_nationality = BAD
                                    has_nationality = DNZ
                                    has_nationality = VGE
									has_nationality = RHI
									has_nationality = THU
                                }
                                NOT = {
                                    has_nationality = ROOT
                                }
                            }
                            add_nationality = ROOT
                        }
                    }
                }

            }
        }
        ai_will_do = {
            factor = 50
        }
    }

    reintegrate_lands_beyond_the_oder_neisse_line = {
        days_re_enable = 0

        allowed = {
            OR = {
                original_tag = WGR
                original_tag = SAX
                original_tag = HAN
                original_tag = MEK
                original_tag = SHL
                original_tag = WUR
                original_tag = BAY
                original_tag = BAD
                original_tag = DNZ
				original_tag = RHI
				original_tag = THU		
            }
        }
        visible = { has_country_flag = reunited_germany }
        fire_only_once = yes
        available = {
            is_subject = no
            63 = { is_controlled_by = ROOT }
            66 = { is_controlled_by = ROOT }
            67 = { is_controlled_by = ROOT }
            68 = { is_controlled_by = ROOT }
            5 = { is_controlled_by = ROOT }
            763 = { is_controlled_by = ROOT }
        }
        icon = generic_form_nation
        complete_effect = {
            every_state = {
                limit = { region = 8 NOT = { is_core_of = ROOT } }
                add_claim_by = ROOT
            }
            5 = { add_claim_by = ROOT }
            763 = { add_claim_by = ROOT }
        }
        ai_will_do = {
            factor = 50
        }
    }

#	DNZ_join_germany = { #Should work but somehow when Germany gains Danzig they Gdynia automatically, check r56_on_action on state control change
#
#		icon = ger_reichskommissariats
#
#		allowed = {
#			tag = DNZ
#		}
#
#		available = {
#            AND = {
#                GER = {
#                    has_government = ROOT
#                    OR = {
#                        controls_state = 807
#                        controls_state = 763
#                    }
#                    is_puppet = no
#                }
#                OR = {
#                    is_puppet = no
#                    is_puppet_of = GER
#                    AND = {
#                        is_puppet = yes
#                        OVERLORD = {
#                            has_war_with = GER
#                        }
#                    }
#                }
#            }
#
#
#		}
#        cost = 20
#		visible = {
#			tag = DNZ
#		}
#		days_remove = 25
#		complete_effect = {
#
#		}
#
#		remove_effect = {
#
#            POL = { country_event = { id = danzig.6 hours = 1 } }
#
#            GER = {
#                if = {
#                    limit = {
#                        DNZ = {
#                            owns_state = 85
#                        }
#
#                    }
#                    transfer_state = 85
#                    85 = {	add_claim_by = GER }
#                }
#                if = {
#                    limit = {
#                        DNZ = {
#                            owns_state = 807
#                        }
#                    }
#                    transfer_state = 807
#                    807 = {	add_claim_by = GER }
#                }
#			}
#		}
#
#		ai_will_do = {
#			factor = 200
#		}
#	}
    form_idel_ural = {
        icon = generic_form_nation
        fire_only_once = yes
        allowed = { original_tag = TAT }

        available = {
            is_subject = no
            controls_state = 652
            controls_state = 251
            controls_state = 651
            controls_state = 582
            controls_state = 401
        }

        complete_effect = {
            652 = { add_claim_by = ROOT }
            251 = { add_claim_by = ROOT }
            651 = { add_claim_by = ROOT }
            582 = { add_claim_by = ROOT }
            401 = { add_claim_by = ROOT }
            add_ideas = generic_recent_political_unification
            add_ideas = generic_recent_army_unification
            add_ideas = generic_recent_economic_unification
            set_country_flag = reunited_idel_ural
            set_cosmetic_tag = IDEL_URAL

        }

        ai_will_do = {
            factor = 200
        }
    }


    form_sardinia_piedmont = {
        icon = generic_form_nation
        fire_only_once = yes
        allowed = { original_tag = SAD }

        available = {
            is_subject = no
            controls_state = 114
            controls_state = 158
        }

        visible = {
            NOT = {
                has_cosmetic_tag = ITA_REBORN_SAD
            }
        }

        complete_effect = {
            158 = { add_claim_by = ROOT }

            set_country_flag = formed_sardinia_piedmont
            set_cosmetic_tag = SAD_PIEDMONT
        }

        ai_will_do = {
            factor = 200
        }
    }

	reunite_italy = {

		icon = generic_form_nation

		allowed = {

			OR = {
                original_tag = SCI
                original_tag = SAD
                original_tag = VNZ
                original_tag = NAP
                original_tag = TTS
                original_tag = TOS
                original_tag = LBV
                original_tag = PAP
			}
		}

		available = {
			is_subject = no
			NOT = {
				has_idea = generic_recent_political_unification
				has_idea = generic_recent_army_unification
				has_idea = generic_recent_economic_unification
			}
			# Italy
			custom_trigger_tooltip = {
				tooltip = form_eu_italy_required_states_tt
				controls_state = 158
				controls_state = 159
				controls_state = 39
				controls_state = 160
				controls_state = 161
				controls_state = 162
				controls_state = 157
				controls_state = 2
				controls_state = 117
				controls_state = 114
				controls_state = 156
				controls_state = 115
				controls_state = 736
				controls_state = 163
            }
            NOT = {
                country_exists = ITA
            }
		}

        fire_only_once = yes

		visible = {


		}

		complete_effect = {
			# Italy
			custom_effect_tooltip = form_eu_italy_coring_states_tt
			hidden_effect = {
				158 = { add_claim_by = ROOT }
				159 = { add_claim_by = ROOT }
				39 = { add_claim_by = ROOT }
				160 = { add_claim_by = ROOT }
				161 = { add_claim_by = ROOT }
				162 = { add_claim_by = ROOT }
				157 = { add_claim_by = ROOT }
				2 = { add_claim_by = ROOT }
				117 = { add_claim_by = ROOT }
				156 = { add_claim_by = ROOT }
				115 = { add_claim_by = ROOT }
				736 = { add_claim_by = ROOT }
				163 = { add_claim_by = ROOT }
				114 = { add_claim_by = ROOT }
				912 = { add_claim_by = ROOT }
				911 = { add_claim_by = ROOT }
        850 = { add_claim_by = ROOT }				
				set_global_flag = italy_reborn
            }
            if = {
                limit = {
                    original_tag = NAP
                }
                set_cosmetic_tag = ITA_REBORN_NAP
            }
            if = {
                limit = {
                    original_tag = SAD
                }
                set_cosmetic_tag = ITA_REBORN_SAD
            }
            if = {
                limit = {
                    original_tag = SCI
                }
                set_cosmetic_tag = ITA_REBORN_SCI
            }
            if = {
                limit = {
                    original_tag = VNZ
                }
                set_cosmetic_tag = ITA_REBORN_VNZ
            }
            add_ideas = generic_recent_political_unification
            add_ideas = generic_recent_army_unification
            add_ideas = generic_recent_economic_unification
		}

		ai_will_do = {
			factor = 200
		}
	}

    unite_the_cossack_hosts = {
        icon = generic_form_nation
        fire_only_once = yes
        allowed = {
            OR = {
                original_tag = DON
                original_tag = KUB
            }
        }
        visible = {
            NOT = {
                has_cosmetic_tag = COSSACKS_UNITED
            }
        }
        available = {
        #   is_subject = no
            controls_state = 218
            controls_state = 245
            controls_state = 265
            controls_state = 217
            controls_state = 238

            controls_state = 234
            controls_state = 235
            controls_state = 233
        #    controls_state = 232
        }

        complete_effect = {
            218 = { add_claim_by = ROOT }
            245 = { add_claim_by = ROOT }
            265 = { add_claim_by = ROOT }
            217 = { add_claim_by = ROOT }
            238 = { add_claim_by = ROOT }

            234 = { add_claim_by = ROOT }
            233 = { add_claim_by = ROOT }
            235 = { add_claim_by = ROOT }
        #    232 = { add_claim_by = ROOT }

            set_cosmetic_tag = COSSACKS_UNITED

            add_ideas = generic_recent_political_unification
            add_ideas = generic_recent_army_unification
            add_ideas = generic_recent_economic_unification
            set_country_flag = cossacks_united
        }

        ai_will_do = {
            factor = 200
        }
    }

    form_a_dravidian_state = { # Revise those cores slightly in the future. Is Goa relevant? Should Andhra 424 be included?
        # Dravidar Kazhagam leader of the Dravidian unification movement as part of the Justice party in India - soc dem.
        # S. P. Adithanar was in Singapore before 1942 but was clearly militant later in life. Closest thing to a fascist?
        icon = generic_form_nation
        fire_only_once = yes
        allowed = { 
			OR = {
				original_tag = SRL 
				original_tag = RAS
				original_tag = MYS
			}
		}
		highlight_states = {
			highlight_state_targets = {
                state = 422
				state = 423
				state = 424
				state = 425
				state = 1098
			}
		}
        available = {
            is_subject = no
            422 = {
                is_fully_controlled_by = ROOT
            }
            423 = {
                is_fully_controlled_by = ROOT
            }
            424 = {
                is_fully_controlled_by = ROOT
            }
            425 = {
                is_fully_controlled_by = ROOT
            }
            1098 = {
                is_fully_controlled_by = ROOT
            }
        }

        complete_effect = {
            320 = { add_claim_by = ROOT }
            #321 = { add_claim_by = ROOT }
            422 = { add_claim_by = ROOT }
            423 = { add_claim_by = ROOT }
            424 = { add_claim_by = ROOT }
            425 = { add_claim_by = ROOT }
			1098 = { add_claim_by = ROOT }
			#1099 = { add_claim_by = ROOT }
            add_ideas = generic_recent_political_unification
            add_ideas = generic_recent_army_unification
            add_ideas = generic_recent_economic_unification
            set_country_flag = dravidian_united
            set_cosmetic_tag = DRAVIDIAN_UNITED
        }

        ai_will_do = {
            factor = 200
        }
    }

    #### FINALIZE UNIFICATION ####
    political_unification = {
        visible = {
            has_idea = generic_recent_political_unification
        }
        # fire_only_once = yes
        available = { 
            has_idea = generic_recent_political_unification
        }

        priority = 10 # so it appears at the top always for cleaner aesthetics

        icon = generic_political_discourse

        cost = 75

        days_remove = 90

        modifier = {
            drift_defence_factor = -0.25
            political_power_factor = -0.05
            stability_weekly = -0.001
        }

        remove_effect = {
            remove_ideas = generic_recent_political_unification
        }

        ai_will_do = {
            factor = 50
        }
    }

    army_unification = {
        visible = {
            has_idea = generic_recent_army_unification
        }
        # fire_only_once = yes
        available = {
            has_idea = generic_recent_army_unification
        }

        priority = 10 # so it appears at the top always for cleaner aesthetics

        icon = generic_army_support
        days_remove = 90

        modifier = {
            military_leader_cost_factor = 0.25
            command_power_gain = -0.15
            army_org_factor = -0.05
            army_morale_factor = -0.10
        }

        custom_cost_text = decision_cost_CP_25_pp_25_ArmXP_10

        custom_cost_trigger = {
            command_power > 24
            has_political_power > 24
            has_army_experience > 9
        }

        complete_effect = {
            hidden_effect = {
                add_command_power = -25
                add_political_power = -25
                army_experience = -10
            }
        }

        remove_effect = {
            remove_ideas = generic_recent_army_unification
        }

        ai_will_do = {
            factor = 50
        }
    }

    economic_unification = {
        visible = {
            has_idea = generic_recent_economic_unification
        }
        #fire_only_once = yes
        available = {
            has_idea = generic_recent_economic_unification
        }

        priority = 10 # so it appears at the top always for cleaner aesthetics

        icon = generic_factory
        
        cost = 75

        days_remove = 90

        modifier = {
            consumer_goods_factor = 0.05
            production_speed_buildings_factor = -0.05
            production_factory_efficiency_gain_factor = -0.10
        }

        remove_effect = {
            remove_ideas = generic_recent_economic_unification
        }

        ai_will_do = {
            factor = 50
        }
    }
}

form_arabia_category = {
    assert_control_over_the_holy_sites = {
        icon = generic_form_nation
        fire_only_once = yes
        cost = 25
        days_remove = 90

        allowed = {
            OR = {
                original_tag = ADU
                original_tag = MOR
                original_tag = ALG
                original_tag = TUN
                original_tag = EGY
                original_tag = PAL
                original_tag = SUD
                original_tag = SOM
                original_tag = SYR
                original_tag = TUR
                original_tag = PAL
                original_tag = JOR
                #original_tag = IMA #what is this tag?
                original_tag = IRQ
                original_tag = PER
                original_tag = PAK
                original_tag = AZR
                original_tag = XSM
                original_tag = SIK
                original_tag = KAZ
                original_tag = INS
                original_tag = LBA
                original_tag = KUW
                original_tag = BOS
                original_tag = MLD
                original_tag = MLI
                original_tag = LEB
                original_tag = KYR
                original_tag = MRT
                original_tag = TAJ
                original_tag = TMS
                original_tag = CRI
                original_tag = UZB
                original_tag = BAN
                original_tag = ALB
            }
        }

        visible = {
            NOT = { has_government = communism }
            controls_state = 679
        }

        available = {
            controls_state = 679
        }

        ai_will_do = {
            factor = 50
        }

        complete_effect = { }

        remove_effect = {
            add_stability = 0.05
        }
    }
}

form_hispanoamerica_category = {
    form_hispanoamerica = {
        icon = generic_form_nation

        allowed = {
            OR = {
                original_tag = ARG
                original_tag = ECU
                original_tag = PAR
                original_tag = CHL
                original_tag = COL
                original_tag = PAN
                original_tag = PRU
                original_tag = BOL
                original_tag = URG
                original_tag = VEN
            }
        }
        fire_only_once = yes
        available = {
        
            any_controlled_state = {
                is_core_of = ARG
            }
            any_controlled_state = {
                is_core_of = ECU
            }
            any_controlled_state = {
                is_core_of = CHL
            }
            any_controlled_state = {
                is_core_of = COL
            }
            any_controlled_state = {
                is_core_of = PAN
            }
            any_controlled_state = {
                is_core_of = PRU
            }
            any_controlled_state = {
                is_core_of = BOL
            }
            any_controlled_state = {
                is_core_of = URG
            }
            any_controlled_state = {
                is_core_of = VEN
            }
            any_controlled_state = {
                is_core_of = PAR
            }
        }

        complete_effect = {
            set_cosmetic_tag = HIS_UNIFIED
            every_state = {
                limit = {
                    OR = {
                        is_core_of = ARG is_core_of = ECU is_core_of = PAR is_core_of = CHL is_core_of = COL is_core_of = PAN is_core_of = PRU is_core_of = BOL is_core_of = URG is_core_of = VEN is_core_of = ELS is_core_of = COS is_core_of = GUA is_core_of = HON is_core_of = NIC is_core_of = MEX is_core_of = CUB is_core_of = DOM
                        state = 311 #Belize
                        state = 686 #Puerto Rico
                        state = 695 #Curação
                    }
                }
                add_claim_by = PREV
            }

            every_state = {
                limit = {
                    OR = {
                        region = 53 is_core_of = BAH #Caribbean + Bahamas
                        state = 366 state = 375 state = 376 state = 377 state = 378 state = 379 state = 380 state = 382 #Mexican old clay
                        state = 687 state = 299 state = 720 state = 502 state = 503 #Historical claims
                    }
                    NOT = { is_core_of = ROOT }
                }
                add_claim_by = ROOT
            }

            hidden_effect = {
                news_event = { id = r56.news_event.18 hours = 6 }
                set_global_flag = form_hispanomerica_flag

                if = {
                    limit = {
                        has_dlc = "La Resistance"
                    }
                    every_country = {
                        every_operative = {
                            limit = {
                                OR = {
                                    has_nationality = ARG
                                    has_nationality = ECU
                                    has_nationality = PAR
                                    has_nationality = CHL
                                    has_nationality = COL
                                    has_nationality = PAN
                                    has_nationality = BOL
                                    has_nationality = URG
                                    has_nationality = VEN
                                }
                                NOT = {
                                    has_nationality = ROOT
                                }
                            }
                            add_nationality = ROOT
                        }
                    }
                }
            }

            add_ideas = generic_recent_political_unification
            add_ideas = generic_recent_army_unification
            add_ideas = generic_recent_economic_unification
        }

        ai_will_do = {
            factor = 200
            modifier = {
                factor = 0
                is_historical_focus_on = yes
            }
        }
    }

    core_mexican_america = {
        fire_only_once = yes
        available = {
			378 = {
				is_fully_controlled_by = ROOT
				compliance > 50
			}
			379 = {
				is_fully_controlled_by = ROOT
				compliance > 50
			}
			377 = {
				is_fully_controlled_by = ROOT
				compliance > 50
			}
			376 = {
				is_fully_controlled_by = ROOT
				compliance > 50
			}
            382 = {
				is_fully_controlled_by = ROOT
				compliance > 50
			}
			380 = {
				is_fully_controlled_by = ROOT
				compliance > 50
			}
			375 = {
				is_fully_controlled_by = ROOT
				compliance > 50
			}
        }
        cost = 100
        days_remove = 120
        visible = {
            has_cosmetic_tag = HIS_UNIFIED
        }
		highlight_states = {
			highlight_state_targets = {
				state = 378
                state = 379
                state = 377
                state = 376
                state = 382
                state = 380
                state = 375
			}
		}
        complete_effect = {
            every_state = {
                limit = {
                    OR = {
                        state = 366 state = 375 state = 376 state = 377 state = 378 state = 379 state = 380 state = 382 #Mexican old clay
                    }
                }
                add_resistance = 15
            }
        }
		remove_effect = {
            366 = { add_claim_by = ROOT }
            375 = { add_claim_by = ROOT }
            376 = { add_claim_by = ROOT }
            377 = { add_claim_by = ROOT }
            378 = { add_claim_by = ROOT }
            379 = { add_claim_by = ROOT }
            380 = { add_claim_by = ROOT }
            382 = { add_claim_by = ROOT }
            hidden_effect = {
                remove_state_claim = 366
                remove_state_claim = 375
                remove_state_claim = 376
                remove_state_claim = 377
                remove_state_claim = 378
                remove_state_claim = 379
                remove_state_claim = 380
                remove_state_claim = 382
            }
		}
        ai_will_do = {
            factor = 200
        }
    }
}

reform_the_mamluks_category = {
    reform_the_mamluks = {
        icon = generic_form_nation
        fire_only_once = yes

        allowed = {
            OR = {
                original_tag = EGY
                original_tag = PAL
                original_tag = LBA
                original_tag = LEB
                original_tag = SYR
            }
        }

        visible = {
            NOT = { has_government = communism }
        }

        available = {
            is_subject = no
            custom_trigger_tooltip = {
                tooltip = form_country_mamluks_no_arabia_tt
                NOT = { has_cosmetic_tag = ARA_UNIFIED }
            }
            custom_trigger_tooltip = {
                tooltip = form_country_mamluks_required_states_egyptian_tt
                controls_state = 907
                controls_state = 911
                controls_state = 995
                controls_state = 447
                controls_state = 452
                controls_state = 456
                controls_state = 457
                controls_state = 453
            }
            custom_trigger_tooltip = {
                tooltip = form_country_mamluks_required_states_palestinian_tt
                controls_state = 454
                controls_state = 1016
                controls_state = 1017
                controls_state = 966
                controls_state = 949
            }
            custom_trigger_tooltip = {
                tooltip = form_country_mamluks_required_states_jordanian_tt
                controls_state = 455
                controls_state = 1021
                controls_state = 1022
            }
            custom_trigger_tooltip = {
                tooltip = form_country_mamluks_required_states_lebanese_tt
                controls_state = 553
            }
            custom_trigger_tooltip = {
                tooltip = form_country_mamluks_required_states_syrian_tt
                controls_state = 554
                controls_state = 677
                controls_state = 680
#                controls_state = 799   #Hatay - 56 - Requiring this state is pretty annoying since it (almost) always goes to Turkey.
            }
            controls_state = 855
            controls_state = 679
            controls_state = 344
            controls_state = 451
            controls_state = 663
            controls_state = 450
        }

        ai_will_do = {
            factor = 50
        }

        complete_effect = {
            custom_effect_tooltip = form_country_gs_required_coring_states_tt
            set_cosmetic_tag = MAM
            add_ideas = generic_recent_political_unification
            add_ideas = generic_recent_army_unification
            add_ideas = generic_recent_economic_unification
            hidden_effect = {

                if = {
                    limit = {
                        has_dlc = "La Resistance"
                    }
                    every_country = {
                        every_operative = {
                            limit = {
                                OR = {
                                    has_nationality = EGY
                                    has_nationality = PAL
                                    has_nationality = LBA
                                    has_nationality = LEB
                                    has_nationality = SYR
                                }
                                NOT = {
                                    has_nationality = ROOT
                                }
                            }
                            add_nationality = ROOT
                        }
                    }
                }


                add_state_claim = 907
                add_state_claim = 911
                add_state_claim = 995
                add_state_claim = 447
                add_state_claim = 452
                add_state_claim = 456
                add_state_claim = 457
                add_state_claim = 453
                add_state_claim = 454
                add_state_claim = 1016
                add_state_claim = 1017
                add_state_claim = 966
                add_state_claim = 949
                add_state_claim = 455
                add_state_claim = 1021
                add_state_claim = 1022
                add_state_claim = 855
                add_state_claim = 679
                add_state_claim = 553
                add_state_claim = 554
                add_state_claim = 677
                add_state_claim = 680
                add_state_claim = 799
                add_state_claim = 344
                add_state_claim = 451
                add_state_claim = 663
                add_state_claim = 450
            }
        }
    }
}

#Alammania
EYE_form_alamannia_category = {
	SWI_form_alamannia = {

		icon = generic_form_nation

		allowed = {
			original_tag = SWI
		}

		highlight_states = {
			highlight_state_targets = {
                state = 153
                state = 28
                state = 42
                state = 1053
                state = 50
                state = 52
                state = 53
                state = 54
			}
		}

		available = {
			is_subject = no
			controls_state = 153
			controls_state = 28
			controls_state = 42
            controls_state = 1053
			controls_state = 50
			controls_state = 52
			controls_state = 53
            controls_state = 1053
			controls_state = 54
			controls_state = 923
		}

		visible = {
			OR = {
				has_completed_focus = SWI_irredentism
				controls_state = 153
				controls_state = 28
				controls_state = 42
                controls_state = 1053
				controls_state = 50
				controls_state = 52
				controls_state = 53
				controls_state = 54
			}
			NOT = { has_global_flag = SWI_formed_alamannia }
		}

		complete_effect = {
			set_cosmetic_tag = SWI_alamannia
			add_state_claim = 153
			add_state_claim = 28
			add_state_claim = 42
            add_state_claim = 1053
			add_state_claim = 50
			add_state_claim = 52
			add_state_claim = 53
			add_state_claim = 54
			add_state_claim = 923
			hidden_effect = {
				set_global_flag = SWI_formed_alamannia
			}
		}

		ai_will_do = {
			factor = 200
			modifier = {
				factor = 0
				is_historical_focus_on = yes
			}
		}
	}
}

form_nation_mod_category = {
    unite_tanganyika_zanzibar = {

		icon = generic_form_nation

		allowed = {
			OR = {
                original_tag = TZN
                original_tag = ZAN
            }
		}

		highlight_states = {
			highlight_state_targets = {
                state = 546
                state = 1055
			}
		}

		available = {
			is_subject = no
			controls_state = 546
			controls_state = 1055
		}

		visible = {
            OR = {
                has_government = democratic
                has_government = communism
                if = {
                    limit = {
                        original_tag = TZN
                    }
                    has_government = neutrality
                }
            }
			NOT = { has_global_flag = TZA_formed_tanzania }
            NOT = { has_cosmetic_tag = east_africa }
		}

		complete_effect = {
            add_stability = 0.05
			set_cosmetic_tag = TZA
			add_state_claim = 546
			add_state_claim = 1055
			hidden_effect = {
				set_global_flag = TZA_formed_tanzania
			}
		}

		ai_will_do = {
			factor = 75
			modifier = {
				factor = 250
				is_historical_focus_on = yes
			}
		}
	}

    form_greater_texas = {

		icon = generic_form_nation

		allowed = {
			original_tag = TXS
		}

		highlight_states = {
			highlight_state_targets = {
                state = 375
                state = 479
                state = 480
                state = 482
			}
		}

		available = {
			is_subject = no
			controls_state = 375
			controls_state = 479
            controls_state = 480
            controls_state = 482
		}

		visible = {
			NOT = { has_global_flag = TXS_formed_greater_texas }
		}

		complete_effect = {
			set_cosmetic_tag = TXS_greater
			add_state_claim = 375
			add_state_claim = 479
            add_state_claim = 480
            add_state_claim = 482
			hidden_effect = {
				set_global_flag = TXS_formed_greater_texas
			}
		}

		ai_will_do = {
			factor = 100
		}
	}
    form_inuit_union = {
        icon = generic_form_nation

        allowed = {

            original_tag = GRN
            
        }
		highlight_states = {
			highlight_state_targets = {
				state = 463
				state = 864
				state = 472
				state = 683
				state = 466
				state = 332
				state = 101
				state = 861
			}
		}        
        fire_only_once = yes
        available = {
            is_subject = no
            INU = {
				exists = no
			}
            count_triggers = {
                amount > 3
                controls_state = 101
                controls_state = 463 
                controls_state = 466
                controls_state = 864 
                controls_state = 472 
                controls_state = 683
                controls_state = 332
                controls_state = 861
            }

        }
        complete_effect = {
            set_cosmetic_tag = INU
            custom_effect_tooltip = form_country_inuit_required_coring_states_tt
            hidden_effect = {
                every_state = {
                    limit = {
                        OR = {
                            state = 463
                            state = 864
                            state = 472
                            state = 683
                            state = 466
                            state = 332
                            state = 101
                            state = 861
                        }
                    }
                    add_claim_by = ROOT #ROOT
                }
                news_event = { id = r56.news_event.52 hours = 6 }

 
            }
            add_war_support = 0.05

            add_ideas = generic_recent_political_unification
            add_ideas = generic_recent_army_unification
            add_ideas = generic_recent_economic_unification
        }

        ai_will_do = {
            factor = 200
            modifier = {
                factor = 0.1
                is_historical_focus_on = yes
            }
        }
    } 
}
#Circassia
form_circassia_category = {
	KBK_form_circassia = {

		icon = generic_form_nation

		allowed = {
			original_tag = KBK
		}

		highlight_states = {
			highlight_state_targets = {
                state = 827
                state = 233
                state = 234
			}
		}

		available = {
			is_subject = no
			OR = {
				has_government = fascism
				has_government = neutrality
			}
			controls_state = 827
			controls_state = 233
			controls_state = 234
		}

		visible = {
			NOT = { has_global_flag = KBK_formed_circassia }
		}

		complete_effect = {
			set_cosmetic_tag = CIR_UNIFIED
			add_state_claim = 233
			add_state_claim = 234
			news_event = {
				id = r56_circassia.1
				days = 6
			}
			hidden_effect = {
				set_global_flag = KBK_formed_circassia
			}
			add_ideas = generic_recent_political_unification
			add_ideas = generic_recent_army_unification
			add_ideas = generic_recent_economic_unification
		}

		ai_will_do = {
			factor = 200
			modifier = {
				factor = 0
				is_historical_focus_on = yes
			}
		}
	}
}

form_baltic_federation_category = {
	baltic_integrate_estonia_r56 = {
		icon = generic_form_nation
        ai_will_do = { base = 200 }
		allowed = {
			OR = {
				original_tag = LAT
				original_tag = LIT
			}
		}
		available = {
			is_subject = no
			custom_trigger_tooltip = {
				tooltip = form_country_estonia_required_states_tt
				all_state = {
					OR = {
						NOT = { 
							state = 813
							state = 191
							state = 13
							state = 812
							state = 811
						}
						is_controlled_by = ROOT 
					}
				}
			}
		}
		visible = {
            has_cosmetic_tag = BAL_UNIFIED
            NOT = {
                AND = {
                    813 = { is_core_of = ROOT }
                    191 = { is_core_of = ROOT }
                    13 = { is_core_of = ROOT }
                    812 = { is_core_of = ROOT }
                    811 = { is_core_of = ROOT }
                }
            }
        }
		complete_effect = {
            every_controlled_state = {
                limit = {
					OR = {
                        state = 813
                        state = 191
                        state = 13
                        state = 812
                        state = 811
					}
                }
                add_resistance = 5
				add_dynamic_modifier = {
					modifier = TUR_lingering_unrest
					days = 140
				}
            }
		}
        days_remove = 70
        remove_effect = {
			custom_effect_tooltip = form_country_estonia_coring_states_tt
			hidden_effect = {
                add_state_claim = 813
                add_state_claim = 191
                add_state_claim = 13
                add_state_claim = 812
                add_state_claim = 811
                if = {
                    limit = { has_dlc = "La Resistance" }
                    every_country = {
                        every_operative = {
                            limit = {
								has_nationality = EST
                                NOT = { has_nationality = ROOT }
                            }
                            add_nationality = ROOT
                        }
                    }
                }
			}
        }
	}
}

form_melanesia_category = {

	form_melanesia = {
		icon = generic_form_nation

		allowed = {
			OR = {
				original_tag = WPG
				original_tag = PNG
				original_tag = BOU
				original_tag = SOL
				original_tag = VAN
				original_tag = FIJ
				original_tag = MLK
			}
			has_dlc = "Thunder at Our Gates"
		}

		fire_only_once = yes

		on_map_mode = decision_view_only

		highlight_states = {
		
			highlight_state_targets = {

				# Melanesia - West Papua New Guinea
				state = 669
				state = 1137

				# Melanesia - East Papua New Guinea
				state = 1096
				state = 523
				state = 737
				state = 1138

				# Melanesia - Solomons
				state = 634

				# Melanesia - New Hebrides & New Caledonia
				state = 1141
				state = 635

				# Melanesia - Fiji
				state = 636
			}
		}

		available = {
			is_subject = no
			custom_trigger_tooltip = {
				tooltip = form_country_melanesia_coring_states_tt

				# Melanesia - West Papua New Guinea
				controls_state = 669
				controls_state = 1137

				# Melanesia - East Papua New Guinea
				controls_state = 1096
				controls_state = 523 
				controls_state = 737
				controls_state = 1138

				# Melanesia - Solomons
				controls_state = 634

				# Melanesia - New Hebrides & New Caledonia
				controls_state = 1141
				controls_state = 635

				# Melanesia - Fiji
				controls_state = 636
			}
		}

        visible = {
            OR = {
                original_tag = WPG
                original_tag = PNG
                original_tag = BOU
                original_tag = SOL
                original_tag = VAN
                original_tag = FIJ
                original_tag = MLK
            }
            NOT = { has_global_flag = formed_melanesia_flag }
        }

		complete_effect = {
			set_cosmetic_tag = MLN
			set_global_flag = formed_melanesia_flag
			custom_effect_tooltip = AST_form_australasia_malenesia_core_states_tt
			hidden_effect = {

				#West Papua New Guinea
				669 = { add_claim_by = ROOT }
				1137 = { add_claim_by = ROOT }

				#East Papua New Guinea
				1096 = { add_claim_by = ROOT }
				523 = { add_claim_by = ROOT }
				737 = { add_claim_by = ROOT }
                1138 = { add_claim_by = ROOT }

				#Solomons
				634 = { add_claim_by = ROOT }

				#New Hebrides & New Caledonia
				1141 = { add_claim_by = ROOT }
				635 = { add_claim_by = ROOT }

				#Fiji
				636 = { add_claim_by = ROOT }

                #Maluku
                add_state_claim = 668
                add_state_claim = 738

                #Timor
                add_state_claim = 721
                add_state_claim = 1142
			}
		}

		ai_will_do = {
			base = 3
			modifier = {
				is_historical_focus_on = yes
				factor = 0
			}
		}
	}
}

form_micronesia_category = {

	form_micronesia = {
		icon = generic_form_nation

		allowed = {
			OR = {
				original_tag = PLU
				original_tag = FSM
				original_tag = GUM
				original_tag = MRS
				original_tag = KIR
				original_tag = NRU
			}
			has_dlc = "Thunder at Our Gates"
		}

		fire_only_once = yes

		on_map_mode = decision_view_only

		highlight_states = {
		
			highlight_state_targets = {

				# Carolines
				state = 647 #Palau
				state = 684 #Caroline Islands

				# Marianas
				state = 638 #Guam
				state = 646 #Saipan

				# Marshalls 
				state = 633 #Marshall Islands
				state = 632 #Wake Island
                state = 648 #Marcus Island

				# Gilberts
				state = 639 #Gilbert Islands
				state = 725 #Nauru
			}
		}

		available = {
			is_subject = no
			custom_trigger_tooltip = {
				tooltip = form_country_micronesia_required_states_tt

                # Carolines
                controls_state = 647 #Palau
                controls_state = 684 #Caroline Islands

                # Marianas
                controls_state = 638 #Guam
                controls_state = 646 #Saipan

                # Marshalls 
                controls_state = 633 #Marshall Islands
                controls_state = 632 #Wake Island
                controls_state = 648 #Marcus Island

                # Gilberts
                controls_state = 639 #Gilbert Islands
                controls_state = 725 #Nauru
			}
		}

		visible = {
			OR = {
                original_tag = PLU
                original_tag = FSM
                original_tag = GUM
                original_tag = MRS
                original_tag = KIR
                original_tag = NRU
            }
			NOT = { has_global_flag = formed_micronesia_flag }
		}

		complete_effect = {
			set_cosmetic_tag = MCR
			set_global_flag = formed_micronesia_flag
			custom_effect_tooltip = form_country_micronesia_coring_states_tt
			hidden_effect = {

				#Carolines
				647 = { add_claim_by = ROOT }
				684 = { add_claim_by = ROOT }

				#Marianas
				638 = { add_claim_by = ROOT }
				646 = { add_claim_by = ROOT }

				#Marshalls
				633 = { add_claim_by = ROOT }
                632 = { add_claim_by = ROOT }
                648 = { add_claim_by = ROOT }

				#Gilberts
				639 = { add_claim_by = ROOT }
				725 = { add_claim_by = ROOT }
			}
		}

		ai_will_do = {
			base = 3
			modifier = {
				is_historical_focus_on = yes
				factor = 0
			}
		}
	}
}