
#这里用不了继承自上个事件的event_target

###planetmega_setting_ui

plnmg_ai2rpm_btn = {
    potential = { always = yes }
    allow = { always = yes }
    effect = {
        if = {
            limit = { has_global_flag = planetmega_ai_recover_mega_disabled }
            custom_tooltip = planetmega_now_disabled
        }
        else = { custom_tooltip = planetmega_now_enabled }
        hidden_effect = {
            if = {
                limit = { has_global_flag = planetmega_ai_recover_mega_disabled }
                remove_global_flag = planetmega_ai_recover_mega_disabled
            }
            else = { set_global_flag = planetmega_ai_recover_mega_disabled }
        }
    }
}
plnmg_ai2bpm_btn = {
    potential = { always = yes }
    allow = { always = yes }
    effect = {
        if = {
            limit = { has_global_flag = planetmega_ai_disabled_megabuild }
            custom_tooltip = planetmega_now_disabled
        }
        else = { custom_tooltip = planetmega_now_enabled }
        hidden_effect = {
            if = {
                limit = { has_global_flag = planetmega_ai_disabled_megabuild }
                remove_global_flag = planetmega_ai_disabled_megabuild
            }
            else = { set_global_flag = planetmega_ai_disabled_megabuild }
        }
    }
}

plnmg_imba_start_btn = {
    potential = { always = yes }
    allow = { always = yes }
    effect = {
        if = {
            limit = { from = { has_country_flag = planetmega_imba_start } }
            custom_tooltip = planetmega_now_enabled
        }
        else = { custom_tooltip = edict_planetmega_imba_start_desc }
        hidden_effect = {
            from = {
                if = {
                    limit = { has_country_flag = planetmega_imba_start }
                    remove_country_flag = planetmega_imba_start
                }
                else = { set_country_flag = planetmega_imba_start }
            }
        }
    }
}

plnmg_imba_check_btn = {
    potential = { from = { has_country_flag = planetmega_imba_start } }
    allow = { always = yes }
}

plnmg_dyn_prod_type_btn = {
    potential = { from = { has_country_flag = planetmega_imba_start } }
    allow = { always = yes }
    effect = {
        hidden_effect = {
            from = {
                if = {
                    limit = { has_country_flag = planetmega_ultimate_adjusting }
                    remove_country_flag = planetmega_ultimate_adjusting
                    set_country_flag = plnmg_dynamic_produces_all
                }
                else_if = {
                    limit = { has_country_flag = plnmg_dynamic_produces_all }
                    remove_country_flag = plnmg_dynamic_produces_all
                    set_country_flag = plnmg_dynamic_produces_player
                }
                else_if = {
                    limit = { has_country_flag = plnmg_dynamic_produces_player }
                    remove_country_flag = plnmg_dynamic_produces_player
                    set_country_flag = plnmg_dynamic_produces_ai
                }
                else_if = {
                    limit = { has_country_flag = plnmg_dynamic_produces_ai }
                    remove_country_flag = plnmg_dynamic_produces_ai
                }
                else = {
                    if = {
                        limit = { can_do_planetmega_ultimate_adjusting = yes }
                        set_country_flag = planetmega_ultimate_adjusting
                    }
                    else = { set_country_flag = plnmg_dynamic_produces_all }
                }
            }
        }
    }
}

plnmg_dyn_upkp_type_btn = {
    potential = { from = { has_country_flag = planetmega_imba_start } }
    allow = { always = yes }
    effect = {
        hidden_effect = {
            from = {
                if = {
                    limit = { has_country_flag = planetmega_ultimate_adjusting }
                    remove_country_flag = planetmega_ultimate_adjusting
                    set_country_flag = plnmg_dynamic_upkeep_all
                }
                else_if = {
                    limit = { has_country_flag = plnmg_dynamic_upkeep_all }
                    remove_country_flag = plnmg_dynamic_upkeep_all
                    set_country_flag = plnmg_dynamic_upkeep_player
                }
                else_if = {
                    limit = { has_country_flag = plnmg_dynamic_upkeep_player }
                    remove_country_flag = plnmg_dynamic_upkeep_player
                    set_country_flag = plnmg_dynamic_upkeep_ai
                }
                else_if = {
                    limit = { has_country_flag = plnmg_dynamic_upkeep_ai }
                    remove_country_flag = plnmg_dynamic_upkeep_ai
                }
                else = {
                    if = {
                        limit = { can_do_planetmega_ultimate_adjusting = yes }
                        set_country_flag = planetmega_ultimate_adjusting
                    }
                    else = { set_country_flag = plnmg_dynamic_upkeep_all }
                }
            }
        }
    }
}

plnmg_dyn_prod_one_minus = {
    potential = { from = { can_do_any_plnmg_dyn_prod_custom = yes } }
    allow = { always = yes }
    effect = {
        custom_tooltip = planetmega_mod.11.oneminus
        custom_tooltip = "[from.GetDynProdCustomMult_plnmg]"
        hidden_effect = { from = { plnmg_dynamic_produces_var_subtract_effect = { value = 1 } } }
    }
}
plnmg_dyn_prod_dot_five_minus = {
    potential = { from = { can_do_any_plnmg_dyn_prod_custom = yes } }
    allow = { always = yes }
    effect = {
        custom_tooltip = planetmega_mod.11.pointfiveminus
        custom_tooltip = "[from.GetDynProdCustomMult_plnmg]"
        hidden_effect = { from = { plnmg_dynamic_produces_var_subtract_effect = { value = 0.5 } } }
    }
}
plnmg_dyn_prod_dot_one_minus = {
    potential = { from = { can_do_any_plnmg_dyn_prod_custom = yes } }
    allow = { always = yes }
    effect = {
        custom_tooltip = planetmega_mod.11.pointoneminus
        custom_tooltip = "[from.GetDynProdCustomMult_plnmg]"
        hidden_effect = { from = { plnmg_dynamic_produces_var_subtract_effect = { value = 0.1 } } }
    }
}

plnmg_dyn_prod_guiling_button = {
    potential = { from = { can_do_any_plnmg_dyn_prod_custom = yes } }
    allow = { always = yes }
    effect = {
        custom_tooltip = planetmega_mod.11.guiling
        custom_tooltip = "[from.GetDynProdCustomMult_plnmg]"
        hidden_effect = { from = { plnmg_dynamic_produces_var_guiling_effect = yes } }
    }
}

plnmg_dyn_prod_dot_one_add = {
    potential = { from = { can_do_any_plnmg_dyn_prod_custom = yes } }
    allow = { always = yes }
    effect = {
        custom_tooltip = planetmega_mod.11.pointoneadd
        custom_tooltip = "[from.GetDynProdCustomMult_plnmg]"
        hidden_effect = { from = { plnmg_dynamic_produces_var_change_effect = { value = 0.1 } }  }
    }
}
plnmg_dyn_prod_dot_five_add = {
    potential = { from = { can_do_any_plnmg_dyn_prod_custom = yes } }
    allow = { always = yes }
    effect = {
        custom_tooltip = planetmega_mod.11.pointfiveadd
        custom_tooltip = "[from.GetDynProdCustomMult_plnmg]"
        hidden_effect = { from = { plnmg_dynamic_produces_var_change_effect = { value = 0.5 } } }
    }
}
plnmg_dyn_prod_one_add = {
    potential = { from = { can_do_any_plnmg_dyn_prod_custom = yes } }
    allow = { always = yes }
    effect = {
        custom_tooltip = planetmega_mod.11.oneadd
        custom_tooltip = "[from.GetDynProdCustomMult_plnmg]"
        hidden_effect = { from = { plnmg_dynamic_produces_var_change_effect = { value = 1 } } }
    }
}

plnmg_dyn_upkp_one_minus = {
    potential = { from = { can_do_any_plnmg_dyn_upkp_custom = yes } }
    allow = { always = yes }
    effect = {
        custom_tooltip_with_params = {
            description = planetmega_custom_upkeep_mult_value_tt
            description_parameters = { VALUE = "-100%" }
        }
        custom_tooltip = "[from.GetDynUpkpCustomMult_plnmg]"
        hidden_effect = { from = { plnmg_dynamic_upkeep_var_subtract_effect = { value = 1 } } }
    }
}
plnmg_dyn_upkp_dot_five_minus = {
    potential = { from = { can_do_any_plnmg_dyn_upkp_custom = yes } }
    allow = { always = yes }
    effect = {
        custom_tooltip_with_params = {
            description = planetmega_custom_upkeep_mult_value_tt
            description_parameters = { VALUE = "-50%" }
        }
        custom_tooltip = "[from.GetDynUpkpCustomMult_plnmg]"
        hidden_effect = { from = { plnmg_dynamic_upkeep_var_subtract_effect = { value = 0.5 } } }
    }
}
plnmg_dyn_upkp_dot_one_minus = {
    potential = { from = { can_do_any_plnmg_dyn_upkp_custom = yes } }
    allow = { always = yes }
    effect = {
        custom_tooltip_with_params = {
            description = planetmega_custom_upkeep_mult_value_tt
            description_parameters = { VALUE = "-10%" }
        }
        custom_tooltip = "[from.GetDynUpkpCustomMult_plnmg]"
        hidden_effect = { from = { plnmg_dynamic_upkeep_var_subtract_effect = { value = 0.1 } } }
    }
}

plnmg_dyn_upkp_guiling_button = {
    potential = { from = { can_do_any_plnmg_dyn_upkp_custom = yes } }
    allow = { always = yes }
    effect = {
        custom_tooltip = planetmega_mod.11.guiling
        custom_tooltip = "[from.GetDynUpkpCustomMult_plnmg]"
        hidden_effect = { from = { plnmg_dynamic_upkeep_var_guiling_effect = yes } }
    }
}

plnmg_dyn_upkp_dot_one_add = {
    potential = { from = { can_do_any_plnmg_dyn_upkp_custom = yes } }
    allow = { always = yes }
    effect = {
        custom_tooltip_with_params = {
            description = planetmega_custom_upkeep_mult_value_tt
            description_parameters = { VALUE = "+10%" }
        }
        custom_tooltip = "[from.GetDynUpkpCustomMult_plnmg]"
        hidden_effect = { from = { plnmg_dynamic_upkeep_var_change_effect = { value = 0.1 } }  }
    }
}
plnmg_dyn_upkp_dot_five_add = {
    potential = { from = { can_do_any_plnmg_dyn_upkp_custom = yes } }
    allow = { always = yes }
    effect = {
        custom_tooltip_with_params = {
            description = planetmega_custom_upkeep_mult_value_tt
            description_parameters = { VALUE = "+50%" }
        }
        custom_tooltip = "[from.GetDynUpkpCustomMult_plnmg]"
        hidden_effect = { from = { plnmg_dynamic_upkeep_var_change_effect = { value = 0.5 } } }
    }
}
plnmg_dyn_upkp_one_add = {
    potential = { from = { can_do_any_plnmg_dyn_upkp_custom = yes } }
    allow = { always = yes }
    effect = {
        custom_tooltip_with_params = {
            description = planetmega_custom_upkeep_mult_value_tt
            description_parameters = { VALUE = "+100%" }
        }
        custom_tooltip = "[from.GetDynUpkpCustomMult_plnmg]"
        hidden_effect = { from = { plnmg_dynamic_upkeep_var_change_effect = { value = 1 } } }
    }
}

plnmg_space_need_btn = {
    potential = { from = { has_country_flag = planetmega_imba_start } }
    allow = { always = yes }
    effect = {
        if = {
            limit = { has_global_flag = planetmega_no_space_need }
            custom_tooltip = planetmega_now_disabled
        }
        else = { custom_tooltip = planetmega_now_enabled }
        hidden_effect = {
            if = {
                limit = { has_global_flag = planetmega_no_space_need }
                remove_global_flag = planetmega_no_space_need
            }
            else = { set_global_flag = planetmega_no_space_need }
        }
    }
}

planetmega_mod_16_event = {
    potential = { from = { has_country_flag = planetmega_imba_start } }
    allow = { from = { has_tradition = tr_pm_granchor_adopt } }
    effect = { from = { country_event = { id = planetmega_mod.16 } } }
}

### planetmega speed adjustment ###
#event planetmega_mod.35
plnmg_sit_speed_plus_mult_one_minus = {
    potential = { always = yes }
    allow = { check_if_plnmg_sit_speed_plus_valid = yes }
    effect = {
        custom_tooltip_with_params = {
            description = plnmg_sit_speed_plus_mult_change_loc
            description_parameters = { VALUE = "-100%" }
        }
        hidden_effect = { plnmg_situation_speed_plus_subtract_effect = { value = 1 } }
    }
}
plnmg_sit_speed_plus_mult_dot_five_minus = {
    potential = { always = yes }
    allow = { check_if_plnmg_sit_speed_plus_valid = yes }
    effect = {
        custom_tooltip_with_params = {
            description = plnmg_sit_speed_plus_mult_change_loc
            description_parameters = { VALUE = "-50%" }
        }
        hidden_effect = { plnmg_situation_speed_plus_subtract_effect = { value = 0.5 }  }
    }
}
plnmg_sit_speed_plus_mult_dot_one_minus = {
    potential = { always = yes }
    allow = { check_if_plnmg_sit_speed_plus_valid = yes }
    effect = {
        custom_tooltip_with_params = {
            description = plnmg_sit_speed_plus_mult_change_loc
            description_parameters = { VALUE = "-10%" }
        }
        hidden_effect = { plnmg_situation_speed_plus_subtract_effect = { value = 0.1 }  }
    }
}

plnmg_sit_speed_plus_mult_guiling = {
    potential = { always = yes }
    allow = { always = yes }
    effect = {
        custom_tooltip = plnmg_sit_speed_plus_mult_guiling_loc
        hidden_effect = { plnmg_situation_speed_plus_guiling_effect = yes }
    }
}

plnmg_sit_speed_plus_mult_dot_one_add = {
    potential = { always = yes }
    allow = { always = yes }
    effect = {
        custom_tooltip_with_params = {
            description = plnmg_sit_speed_plus_mult_change_loc
            description_parameters = { VALUE = "+10%" }
        }
        hidden_effect = { plnmg_situation_speed_plus_change_effect = { value = 0.1 } }
    }
}
plnmg_sit_speed_plus_mult_dot_five_add = {
    potential = { always = yes }
    allow = { always = yes }
    effect = {
        custom_tooltip_with_params = {
            description = plnmg_sit_speed_plus_mult_change_loc
            description_parameters = { VALUE = "+50%" }
        }
        hidden_effect = { plnmg_situation_speed_plus_change_effect = { value = 0.5 } }
    }
}
plnmg_sit_speed_plus_mult_one_add = {
    potential = { always = yes }
    allow = { always = yes }
    effect = {
        custom_tooltip_with_params = {
            description = plnmg_sit_speed_plus_mult_change_loc
            description_parameters = { VALUE = "+100%" }
        }
        hidden_effect = { plnmg_situation_speed_plus_change_effect = { value = 1 } }
    }
}

plnmg_sit_speed_plus_mult_display = {
    potential = { always = yes }
    allow = { always = yes }
    effect = {
        if = {
            limit = { hidden_trigger = { exists = event_target:plnmg_speed_adjusting_by_@from } }
            event_target:plnmg_speed_adjusting_by_@from = {
                custom_tooltip = plnmg_sit_speed_plus_mult_display_loc
            }
        }
        else = {
            from = {
                custom_tooltip = plnmg_sit_speed_plus_mult_display_loc
            }
        }
    }
}

plnmg_sit_upkp_plus_mult_display = {
    potential = { always = yes }
    allow = { always = yes }
    effect = {
        if = {
            limit = { hidden_trigger = { exists = event_target:plnmg_speed_adjusting_by_@from } }
            event_target:plnmg_speed_adjusting_by_@from = {
                custom_tooltip = plnmg_sit_upkp_plus_mult_display_loc
            }
        }
        else = {
            from = {
                custom_tooltip = plnmg_sit_upkp_plus_mult_display_loc
            }
        }
    }
}


###占位符作用
planetmega_log_button = {
    potential = { always = yes }
    allow = { always = yes }
    effect = { print_scope_effect = yes }
}
planetmega_greyout_button = {
    potential = { always = yes }
    allow = { always = no }
}
planetmega_WIP_button = {
    potential = { always = yes }
    allow = {
        custom_tooltip = {
            fail_text = planetmega_work_in_progress
            always = no
        }
    }
}
planetmega_null_button = {
    potential = { always = no }
    allow = { always = no }
}
