
# this file is used for debug purpose, not existing in any script

# planet scope

debug_plnmg_ub_1 = {
    initialize_mys_variable = { VAR = num_plnmg_usable_bodies }
    change_variable = { which = num_plnmg_usable_bodies value = 1 }
}
debug_plnmg_ub_10 = {
    initialize_mys_variable = { VAR = num_plnmg_usable_bodies }
    change_variable = { which = num_plnmg_usable_bodies value = 10 }
}
debug_plnmg_ub_100 = {
    initialize_mys_variable = { VAR = num_plnmg_usable_bodies }
    change_variable = { which = num_plnmg_usable_bodies value = 100 }
}
debug_plnmg_ub_1000 = {
    initialize_mys_variable = { VAR = num_plnmg_usable_bodies }
    change_variable = { which = num_plnmg_usable_bodies value = 1000 }
}

debug_plnmg_ss_1 = {
    initialize_mys_variable = { VAR = num_plnmg_supercom_sacrifice }
    change_variable = { which = num_plnmg_supercom_sacrifice value = 1 }
}
debug_plnmg_ss_10 = {
    initialize_mys_variable = { VAR = num_plnmg_supercom_sacrifice }
    change_variable = { which = num_plnmg_supercom_sacrifice value = 10 }
}
debug_plnmg_ss_100 = {
    initialize_mys_variable = { VAR = num_plnmg_supercom_sacrifice }
    change_variable = { which = num_plnmg_supercom_sacrifice value = 100 }
}
debug_plnmg_ss_1000 = {
    initialize_mys_variable = { VAR = num_plnmg_supercom_sacrifice }
    change_variable = { which = num_plnmg_supercom_sacrifice value = 1000 }
}
debug_plnmg_ss_10000 = {
    initialize_mys_variable = { VAR = num_plnmg_supercom_sacrifice }
    change_variable = { which = num_plnmg_supercom_sacrifice value = 10000 }
}

debug_plnmg_bs_1 = {
    initialize_mys_variable = { VAR = num_plnmg_brain_sacrifice }
    change_variable = { which = num_plnmg_brain_sacrifice value = 1 }
}
debug_plnmg_bs_10 = {
    initialize_mys_variable = { VAR = num_plnmg_brain_sacrifice }
    change_variable = { which = num_plnmg_brain_sacrifice value = 10 }
}
debug_plnmg_bs_100 = {
    initialize_mys_variable = { VAR = num_plnmg_brain_sacrifice }
    change_variable = { which = num_plnmg_brain_sacrifice value = 100 }
}
debug_plnmg_bs_1000 = {
    initialize_mys_variable = { VAR = num_plnmg_brain_sacrifice }
    change_variable = { which = num_plnmg_brain_sacrifice value = 1000 }
}
debug_plnmg_bs_10000 = {
    initialize_mys_variable = { VAR = num_plnmg_brain_sacrifice }
    change_variable = { which = num_plnmg_brain_sacrifice value = 10000 }
}

debug_plnmg_pmhs_set_design = {
    #this = fleet, gen refers to generation
    every_owned_ship = {
        set_ship_design = { design = NAME_plnmg_pmhs_$gen$ }
        set_variable = { which = plnmg_pmhs_gen value = $gen$ }
    }
}

###others

test_plnmg_repair_ship_all = {
    repair_percentage = 1
    repair_armor_percentage = 1
    repair_shield_percentage = 1
    set_disabled = no
}

add_plnmg_extragalatic_buildings = {
    # scope is planet/ship(ark-ship)
    add_plnmg_mega = { TYPE = plnmg_extra_galaxy on_actions = yes }
    if = {
        limit = { carrier_is_type = planet }
        save_event_target_as = location_body
    }
    else = {
        solar_system = {
            random_system_planet = {
                limit = { is_plnmg_common_planet = yes }
                save_event_target_as = location_body
            }
        }
    }
    solar_system = {
        spawn_megastructure = {
            type = planetmega_eg_gateway_final
            planet = event_target:location_body
            owner = prev.owner_or_space_owner
        }
    }
}
spawn_plnmg_dyson_gun = {
    # this = planet
    # this = ship if you are nomad
    solar_system = {
        spawn_megastructure = {
            type = dyson_gun_3
            planet = star
            owner = prev.owner_or_space_owner
        }
    }
}

test_plnmg_force_arkship_settle = {
    # this = planet, should be a colonizable one!!!
    solar_system = { random_system_ship_colony = { fleet = { save_event_target_as = settler } } }
    fire_on_action = { on_action = on_arkship_settle scopes = { from = event_target:settler } }
}
test_plnmg_force_nomad_embark = {
    # this = planet (colony)
    owner = {
        if = {
            limit = { has_country_flag = already_embarking }
            remove_country_flag = already_embarking
        }
        if = {
            limit = { has_ascension_perk = ap_eternal_vigilance }
            remove_ascension_perk = ap_eternal_vigilance
            add_ascension_perk = ap_eternal_vigilance_nomads
        }
        save_event_target_as = player_country
        country_event = { id = nomads.4710 }
    }
}

add_plnmg_4dot2_compensation_mod = {
    add_modifier = { modifier = planetmega_4dot2_compensation_modifier }
}

# export_neighbor_system_euclidean_count = {
#     solar_system = {
#         export_trigger_value_to_variable = {
#             trigger = count_neighbor_system_euclidean
#             parameters = { limit = { always = yes } }
#             variable = neighbor_system_euclidean_count
#         }
#         custom_tooltip = "[this.neighbor_system_euclidean_count]"
#     }
# }
# export_neighbor_system_count = {
#     solar_system = {
#         export_trigger_value_to_variable = {
#             trigger = count_neighbor_system
#             parameters = { limit = { always = yes } }
#             variable = neighbor_system_count
#         }
#         custom_tooltip = "[this.neighbor_system_count]"
#     }
# }

test_plnmg_no_retreat_effect = {
    add_modifier = { modifier = plnmg_no_retreat_ship_modifier }
}

test_plnmg_fleet_get_hostile = {
    create_country = {
        name = { key = NAME_Raging_Behemoth }
        contact_rule = on_action_only
        type = behemoth_hatchling
        flag = {
            icon = {
                category="domination"
                file="domination_16.dds"
            }
            background = {
                category="backgrounds"
                file="circle.dds"
            }
            colors = {
                "dark_red"
                "intense_purple"
                "black"
                "null"
            }
        }
        effect = {
            every_country = { establish_communications_no_message = prev }
            prev = {
                set_owner = prev
                clear_orders = yes
                find_raging_behemoth_target = yes

                # notification
                root = {
                    create_message = {
                        type = MESSAGE_BEHEMOTH_RAGE
                        localization = MESSAGE_BEHEMOTH_RAGE_DESC
                        days = 30
                        target = root
                    }
                }
            }
        }
    }
}

test_plnmg_situation_as_event_target = {
    owner_or_space_owner = {
        start_situation = {
            type = situation_alloys_deficit
            effect = { save_global_event_target_as = target_situation }
        }
    }
    if = {
        limit = {
            exists = event_target:target_situation
            event_target:target_situation = { is_situation_type = situation_alloys_deficit }
        }
        log = "situation_as_event_target checked, it could be"
    }
    else = { log = "situation_as_event_target checked, it cannot be" }
}

