####################################
# Guerreros De Honduras Decisions  #
# By Figly Bigly/SSW               #
####################################

GRH_the_day_of_reckoning_category = {
    grh_day_of_reckoning_mission = {
        icon = revolt
        allowed = {
            tag = GRH
        }

        visible = {
            has_completed_focus = grh_the_day_of_reckoning
        }

        activation = {
            always = no
        }

        available = {
            always = no
        }

        is_good = no
        selectable_mission = no
        days_mission_timeout = 250
        timeout_effect = {
            country_event = nf_grh.25
            hidden_effect = {
                clr_country_flag = grh_the_big_day
            }
        }
    }

    grh_reinforce_the_garrisons = {
        icon = generic_prepare_civil_war
        cost = 10

        visible = {
            has_country_flag = grh_the_big_day
        }

        available = {
            has_manpower > 500
            has_equipment = {
                infantry_equipment > 500
            }
        }

        ai_will_do = {
            base = 10
        }

        fire_only_once = yes

        complete_effect = {
            add_manpower = -500
            add_equipment_to_stockpile = { 
                type = infantry_equipment
                amount = -500
            }
            add_days_mission_timeout = {
                mission = grh_day_of_reckoning_mission
                days = 40
            }
        }
    }

    grh_train_the_garrisons = {
        icon = generic_army_support
        cost = 10

        visible = {
            has_country_flag = grh_the_big_day
        }

        available = {
            has_army_experience > 15
            has_equipment = {
                support_equipment_1 > 150
            }
        }

        ai_will_do = {
            base = 10
        }

        fire_only_once = yes

        complete_effect = {
            army_experience = -15
            add_equipment_to_stockpile = { 
                type = support_equipment_1
                amount = -150
            }
            hidden_effect = {
                subtract_from_variable = { grh_southern_strength = 3 }
            }
            custom_effect_tooltip = grh_weaken_the_invasion
        }
    }

    grh_scout_enemy_forces = {
        icon = generic_operation
        cost = 10

        visible = {
            has_country_flag = grh_the_big_day
        }

        available = {
            has_manpower > 150
            has_equipment = {
                spec_ops_equipment > 150
            }
        }

        ai_will_do = {
            base = 10
        }

        fire_only_once = yes

        days_remove = 15

        complete_effect = {
            add_equipment_to_stockpile = { 
                type = spec_ops_equipment
                amount = -150
            }
            add_manpower = -150
        }

        remove_effect = {
            add_equipment_to_stockpile = { 
                type = spec_ops_equipment
                amount = 120
            }
            add_manpower = 250
            army_experience = 15
            custom_effect_tooltip = grh_more_noche_decisions_tt
            hidden_effect = {
                set_country_flag = grh_enemies_scouted
            }
        }
    }

    grh_delay_enemy_forces = {
        icon = generic_ignite_civil_war
        cost = 10

        visible = {
            has_country_flag = grh_the_big_day
            has_country_flag = grh_enemies_scouted
        }

        available = {
            has_manpower > 500
            has_equipment = {
                infantry_equipment > 500
            }
        }

        ai_will_do = {
            base = 10
        }

        fire_only_once = yes

        complete_effect = {
            add_manpower = -500
            add_equipment_to_stockpile = { 
                type = infantry_equipment
                amount = -500
            }
            add_days_mission_timeout = {
                mission = grh_day_of_reckoning_mission
                days = 40
            }
        }
    }

    grh_assassinate_leaders = {
        icon = generic_intelligence_operation
        cost = 10

        visible = {
            has_country_flag = grh_the_big_day
            has_country_flag = grh_enemies_scouted
        }

        available = {
            has_manpower > 200
            has_equipment = {
                spec_ops_equipment > 200
            }
        }

        ai_will_do = {
            base = 10
        }

        fire_only_once = yes

        days_remove = 15

        complete_effect = {
            add_equipment_to_stockpile = { 
                type = spec_ops_equipment
                amount = -200
            }
            add_manpower = -200
        }

        remove_effect = {
            add_equipment_to_stockpile = { 
                type = spec_ops_equipment
                amount = 150
            }
            add_manpower = 180
            hidden_effect = {
                subtract_from_variable = { grh_southern_strength = 3 }
            }
            custom_effect_tooltip = grh_weaken_the_invasion
        }
    }
}

GRH_controlling_the_south_category = {
    grh_changes_in_the_south = {
        icon = SWI_consolidate_council_power
        allowed = {
            tag = GRH
        }

        visible = {
            has_completed_focus = grh_eyes_to_the_south
        }

        activation = {
            has_completed_focus = grh_eyes_to_the_south
        }

        available = {
            always = no
        }

        selectable_mission = no
        days_mission_timeout = 30

        fixed_random_seed = no
        timeout_effect = {

            hidden_effect = {
                if = {
                    limit = {
                        has_idea = grh_the_shining_canal
                    }
                    add_to_variable = {
                        var = grh_south_investment
                        value = 1
                    }
                    clamp_variable = {
                        var = grh_south_investment
                        min = 0
                        max = 100
                    }
                }
            }

            hidden_effect = {
                if = {
                    limit = {
                        has_idea = grh_lights_in_the_south
                    }
                    add_to_variable = {
                        var = grh_south_strength
                        value = -2
                    }
                    clamp_variable = {
                        var = grh_south_strength
                        min = 0
                        max = 100
                    }
                }
            }

            random_list = {
				40 = {
					custom_effect_tooltip = grh_peace_in_the_south_tt
                    hidden_effect = {
                        add_to_variable = {
                            var = grh_south_strength
                            value = 5
                        }
                        add_to_variable = {
                            var = grh_south_investment
                            value = 2
                        }
                        add_to_variable = {
                            var = grh_south_population
                            value = 2
                        }
                    }
				}
				20 = {
					custom_effect_tooltip = grh_economic_retreat_tt
                    hidden_effect = {
                        subtract_from_variable = {
                            var = grh_south_investment
                            value = 3
                        }
                        subtract_from_variable = {
                            var = grh_south_population
                            value = 3
                        }
                        add_to_variable = {
                            var = grh_south_strength
                            value = 2
                        }
                    }
				}
				20 = {
					custom_effect_tooltip = grh_economic_prosperity_tt
                    hidden_effect = {
                        add_to_variable = {
                            var = grh_south_investment
                            value = 3
                        }
                        add_to_variable = {
                            var = grh_south_population
                            value = 3
                        }
                        add_to_variable = {
                            var = grh_south_strength
                            value = 4
                        }
                    }
				}
                20 = {
                    custom_effect_tooltip = grh_defences_tested_tt
                    hidden_effect = {
                        set_variable = {
                            grh_temp_south_strength = grh_south_strength
                        }
                        subtract_from_variable = {
                            var = grh_temp_south_strength
                            value = grh_south_defences
                        }
                        divide_variable = {
                            var = grh_temp_south_strength
                        }
                        round_variable = grh_temp_south_strength
                        subtract_from_variable = {
                            var = grh_south_investment
                            value = grh_temp_south_strength
                        }
                        clamp_variable = {
                            var = grh_south_investment
                            min = 0
                        }
                        subtract_from_variable = {
                            var = grh_south_population
                            value = grh_temp_south_strength
                        }
                        clamp_variable = {
                            var = grh_south_investment
                            min = 0
                        }

                        set_variable = {
                            grh_temp_south_strength = grh_south_strength
                        }
                        divide_variable = {
                            var = grh_temp_south_strength
                            value = 3
                        }
                        round_variable = grh_temp_south_strength
                        subtract_from_variable = {
                            var = grh_south_defences
                            value = grh_temp_south_strength
                        }

                        set_variable = {
                            grh_temp_south_defences = grh_south_defences
                        }
                        divide_variable = {
                            var = grh_temp_south_defences
                            value = 10
                        }
                        round_variable = grh_temp_south_defences
                        subtract_from_variable = {
                            var = grh_south_strength
                            value = grh_temp_south_defences
                        }
                    }
                }
			}
            hidden_effect = {
                clamp_variable = {
                    var = grh_south_strength
                    min = 0
                    max = 100
                }
                clamp_variable = {
                    var = grh_temp_south_defences
                    min = 0
                    max = 100
                }
                clamp_variable = {
                    var = grh_south_investment
                    min = 0
                    max = 100
                }
                clamp_variable = {
                    var = grh_south_population
                    min = 0
                    max = 100
                }
            }

            activate_mission = grh_changes_in_the_south
        }
    }

    grh_shipping_guns_south = {
        icon = generic_industry
        cost = 20

        visible = {
            has_active_mission = grh_changes_in_the_south
        }

        available = {
            has_equipment = {
                infantry_equipment > 250
            }
        }

        ai_will_do = {
            base = 10
        }

        days_re_enable = 25

        complete_effect = {
            add_equipment_to_stockpile = { 
                type = infantry_equipment
                amount = -250
            }
            hidden_effect = {
                add_to_variable = {
                    grh_south_defences = 3
                }
            }
            custom_effect_tooltip = grh_defence_increase_tt
        }
    }

    grh_veteran_soldiers = {
        icon = eng_blackshirt_march
        cost = 20

        visible = {
            has_active_mission = grh_changes_in_the_south
        }

        available = {
            has_manpower > 200
            has_army_experience > 10
        }

        ai_will_do = {
            base = 10
        }

        days_re_enable = 25

        complete_effect = {
            add_manpower = -20
            army_experience = -10
            hidden_effect = {
                add_to_variable = {
                    grh_south_defences = 4
                }
            }
            custom_effect_tooltip = grh_defence_increase_tt
        }
    }

    grh_open_land_plots = {
        icon = generic_operation
        cost = 20

        visible = {
            has_active_mission = grh_changes_in_the_south
        }

        available = {
        }

        ai_will_do = {
            base = 10
        }

        days_re_enable = 25

        complete_effect = {
            random_owned_state = {
                add_manpower = -2000
            }
            hidden_effect = {
                add_to_variable = {
                    grh_south_population = 3
                }
            }
            custom_effect_tooltip = grh_population_increase_tt
        }
    }

    grh_stimulus_payments = {
        icon = gre_paying_ifc_debt
        cost = 20

        visible = {
        }

        available = {
            set_temp_variable = { caps_diff = 100 }
            caps_cost_trigger = yes 
        }

        ai_will_do = {
            base = 10
        }

        days_re_enable = 25

        complete_effect = {
            set_temp_variable = { caps_to_add = 100 }
            transaction_caps = yes
            hidden_effect = {
                add_to_variable = {
                    grh_south_investment = 3
                }
            }
            custom_effect_tooltip = grh_investment_increase_tt
        }
    }

    grh_emergency_reinforcements = {
        icon = generic_military
        cost = 25

        visible = {
            has_active_mission = grh_changes_in_the_south
        }

        ai_will_do = {
            base = 10
        }

        available = { 
            custom_trigger_tooltip = {
                check_variable = {
                    trigger = grh_need_eighteen_defence_tt
                    grh_south_defences > 18
                }
            }
        }

        days_re_enable = 50

        complete_effect = {
            add_manpower = 200
            add_equipment_to_stockpile = { 
                type = infantry_equipment
                amount = 200
            }
            hidden_effect = {
                add_to_variable = {
                    grh_south_defences = -13
                }
            }
            custom_effect_tooltip = grh_defence_decrease_tt
        }
    }

    grh_authorise_raids = {
        icon = generic_assassination
        cost = 35

        visible = {
            has_active_mission = grh_changes_in_the_south
        }

        available = {
            custom_trigger_tooltip = {
                tooltip = grh_need_thirty_defence_tt
                check_variable = {
                    grh_south_defences > 30
                }
            }
        }

        ai_will_do = {
            base = 10
        }

        days_re_enable = 30

        complete_effect = {
            hidden_effect = {
                randomize_temp_variable = {
                    var = grh_defender_casualties
                    distribution = uniform
                    min = 5
                    max = 10
                }
                subtract_from_variable = {
                    grh_south_defences = grh_defender_casualties
                }
            }
            custom_effect_tooltip = grh_defence_decrease_tt

            hidden_effect = {
                randomize_temp_variable = {
                    var = grh_raider_casualties
                    distribution = uniform
                    min = 8
                    max = 13
                }
                subtract_from_variable = {
                    grh_south_strength = grh_raider_casualties
                }
            }
            custom_effect_tooltip = grh_weaken_raiders_tt
        }
    }
}

GRH_the_great_expedition = {

    grh_equip_expedition_foot = {
        icon = pipegun_2
        cost = 25

        visible = {
            has_completed_focus = grh_la_gran_expedicion
            has_country_flag = grh_travelling_by_foot
        }

        available = {
            has_manpower > 150
            has_equipment = {
                infantry_equipment > 100
            }
        }

        ai_will_do = {
            base = 10
        }

        fire_only_once = yes

        complete_effect = {
            add_manpower = -100
            add_equipment_to_stockpile = { 
                type = infantry_equipment
                amount = -100
            }
            activate_mission = grh_the_expedition_continues_foot
        }
    }

    grh_equip_expedition_vehicle = {
        icon = jeep
        cost = 25

        visible = {
            has_completed_focus = grh_la_gran_expedicion
            has_country_flag = grh_travelling_by_vehicle
        }

        available = {
            has_manpower > 150
            has_equipment = {
                infantry_equipment > 100
            }
            has_equipment = {
                motorized_equipment > 50
            }
        }

        ai_will_do = {
            base = 10
        }

        fire_only_once = yes

        complete_effect = {
            add_manpower = -100
            add_equipment_to_stockpile = { 
                type = infantry_equipment
                amount = -100
            }
            add_equipment_to_stockpile = { 
                type = motorized_equipment
                amount = -50
            }
            activate_mission = grh_the_expedition_continues_vehicle
        }
    }

    grh_equip_expedition_boat = {
        icon = commandore
        cost = 25

        visible = {
            has_completed_focus = grh_la_gran_expedicion
            has_country_flag = grh_travelling_by_boat
        }

        available = {
            has_manpower > 150
            has_equipment = {
                infantry_equipment > 100
            }
            has_equipment = {
                convoy > 25
            }
        }

        ai_will_do = {
            base = 10
        }

        fire_only_once = yes

        complete_effect = {
            add_manpower = -100
            add_equipment_to_stockpile = { 
                type = infantry_equipment
                amount = -100
            }
            add_equipment_to_stockpile = { 
                type = convoy
                amount = -25
            }
            activate_mission = grh_the_expedition_continues_boat
        }
    }

    grh_the_expedition_continues_foot = {
        icon = pipegun_2
        allowed = {
            tag = GRH
        }

        visible = {
            has_completed_focus = grh_la_gran_expedicion
            has_country_flag = grh_travelling_by_foot
        }

        activation = {
            always = no
        }

        available = {
            always = no
        }

        selectable_mission = no
        days_mission_timeout = 20

        fixed_random_seed = no
        timeout_effect = {
            random_list = {
				40 = {
					custom_effect_tooltip = grh_expedition_progress_tt
                    hidden_effect = {
                        if = {
                             limit = {
                                check_variable = {
                                    grh_expedition_progress > 89
                                }
                             }
                            country_event = nf_grh.199
                        }

                        else = {
                            add_to_variable = {
                                var = grh_expedition_progress
                                value = 10
                            }
                            activate_mission = grh_the_expedition_continues_foot
                        }
                    }
				}
				20 = {
					grh_expedition_discovery = yes

                    hidden_effect = {
                        if = {
                            limit = {
                                NOT = {
                                    has_country_flag = grh_discovered_panama_canal
                                }
                            }
                            activate_mission = grh_the_expedition_continues_boat
                        }
                    }
				}
                20 = {
                    custom_effect_tooltip = grh_resupply_expedition_tt
                    hidden_effect = {
                        set_country_flag = grh_expedition_foot_resupply_flag
                        country_event = nf_grh.198
                    }
                }
			}
        }
    }

    grh_the_expedition_continues_vehicle = {
        icon = jeep
        allowed = {
            tag = GRH
        }

        visible = {
            has_completed_focus = grh_la_gran_expedicion
            has_country_flag = grh_travelling_by_vehicle
        }

        activation = {
            always = no
        }

        available = {
            always = no
        }

        selectable_mission = no
        days_mission_timeout = 10

        fixed_random_seed = no
        timeout_effect = {
            random_list = {
				40 = {
					custom_effect_tooltip = grh_expedition_progress_tt
                    hidden_effect = {
                        if = {
                            limit = {
                                check_variable = {
                                    grh_expedition_progress > 89
                                }
                            }
                            country_event = nf_grh.199
                        }

                        else = {
                            add_to_variable = {
                                var = grh_expedition_progress
                                value = 10
                            }
                            activate_mission = grh_the_expedition_continues_vehicle
                        }
                    }
				}
				20 = {
					grh_expedition_discovery = yes

                    hidden_effect = {
                        if = {
                            limit = {
                                NOT = {
                                    has_country_flag = grh_discovered_panama_canal
                                }
                            }
                            activate_mission = grh_the_expedition_continues_boat
                        }
                    }
				}
                15 = {
                    custom_effect_tooltip = grh_resupply_expedition_tt
                    hidden_effect = {
                        set_country_flag = grh_expedition_vehicle_resupply_flag
                        country_event = nf_grh.198
                    }
                }
			}
        }
    }

    grh_the_expedition_continues_boat = {
        icon = commandore
        allowed = {
            tag = GRH
        }

        visible = {
            has_completed_focus = grh_la_gran_expedicion
            has_country_flag = grh_travelling_by_boat
        }

        activation = {
            always = no
        }

        available = {
            always = no
        }

        selectable_mission = no
        days_mission_timeout = 15

        fixed_random_seed = no
        timeout_effect = {
            random_list = {
				40 = {
					custom_effect_tooltip = grh_expedition_progress_tt
                    hidden_effect = {
                        if = {
                            limit = {
                                check_variable = {
                                    grh_expedition_progress > 89
                                }
                            }
                            country_event = nf_grh.199
                        }

                        else = {
                            add_to_variable = {
                                var = grh_expedition_progress
                                value = 10
                            }
                            activate_mission = grh_the_expedition_continues_boat
                        }
                    }
				}
				5 = {
					grh_expedition_discovery = yes

                    hidden_effect = {
                        if = {
                            limit = {
                                NOT = {
                                    has_country_flag = grh_discovered_panama_canal
                                }
                            }
                            activate_mission = grh_the_expedition_continues_boat
                        }
                    }
				}
                5 = {
                    custom_effect_tooltip = grh_resupply_expedition_tt
                    hidden_effect = {
                        set_country_flag = grh_expedition_boat_resupply_flag
                        country_event = nf_grh.198
                    }
                }
			}
        }
    }

    grh_expedition_foot_resupply = {
        icon = pipegun_2
        cost = 10

        visible = {
            has_country_flag = grh_expedition_foot_resupply_flag
        }

        available = {
            has_manpower > 25
            has_equipment = {
                infantry_equipment > 25
            }
        }

        ai_will_do = {
            base = 10
        }

        days_remove = 10

        complete_effect = {
            add_manpower = -25
            add_equipment_to_stockpile = { 
                type = infantry_equipment
                amount = -25
            }
        }

        remove_effect = {
            activate_mission = grh_the_expedition_continues_foot
            hidden_effect = {
                clr_country_flag = grh_expedition_foot_resupply_flag
            }
        }
    }

    grh_expedition_vehicle_resupply = {
        icon = jeep
        cost = 10

        visible = {
            has_country_flag = grh_expedition_vehicle_resupply_flag
        }

        available = {
            has_manpower > 25
            has_equipment = {
                infantry_equipment > 25
            }
            has_equipment = {
                motorized_equipment > 10
            }
        }

        ai_will_do = {
            base = 10
        }

        days_remove = 10

        complete_effect = {
            add_manpower = -25
            add_equipment_to_stockpile = { 
                type = infantry_equipment
                amount = -25
            }
            add_equipment_to_stockpile = { 
                type = motorized_equipment
                amount = -10
            }
        }

        remove_effect = {
            activate_mission = grh_the_expedition_continues_vehicle
            hidden_effect = {
                clr_country_flag = grh_expedition_vehicle_resupply_flag
            }
        }
    }

    grh_expedition_boat_resupply = {
        icon = commandore
        cost = 10

        visible = {
            has_country_flag = grh_expedition_boat_resupply_flag
        }

        available = {
            has_manpower > 25
            has_equipment = {
                infantry_equipment > 25
            }
            has_equipment = {
                convoy > 5
            }
        }

        ai_will_do = {
            base = 10
        }

        days_remove = 10

        complete_effect = {
            add_manpower = -25
            add_equipment_to_stockpile = { 
                type = infantry_equipment
                amount = -25
            }
            add_equipment_to_stockpile = { 
                type = convoy
                amount = -5
            }
        }

        remove_effect = {
            activate_mission = grh_the_expedition_continues_boat
            hidden_effect = {
                clr_country_flag = grh_expedition_boat_resupply_flag
            }
        }
    }
}