on_actions = {
    on_startup = {
        effect = {
            CZD = {
                set_cosmetic_tag = GGK # 娴ｇ姳绠ｉ崜宥囨畱娴狅絿鐖?
                
                # --- 閺傛澘顤冩潻娆掝攽 ---
                activate_mission = CZD_tribute_mission
                set_country_flag = CZD_tribute_mission_active # 閺傛澘顤冩潻娆掝攽

                # 濞撶鍤梼鐔烘祲閸忓啿褰夐柌?
                set_variable = { var = CZD_guerrilla_power value = 2 }
                set_variable = { var = CZD_yanan_influence value = 2 }
                set_variable = { var = CZD_domestic_influence value = 2 }
                set_variable = { var = CZD_soviet_influence value = 2 }
                
                # ========== 閺€鎸庝笉缂佸繑绁圭€涳妇閮寸紒鐔峰綁闁插繐鍨垫慨瀣 ==========
                # 缂佸繑绁归崺铏诡攨 - 閺€璺ㄧ摜閸欐﹢鍣?(0-100, 50娑撹桨鑵戦梻?
                set_variable = { CZD_agriculture_policy = 50 }
                set_variable = { CZD_heavy_industry_policy = 50 }
                set_variable = { CZD_light_industry_policy = 50 }
                set_variable = { CZD_commerce_policy = 50 }
                set_variable = { CZD_military_policy = 50 }
                set_variable = { CZD_economic_tendency = 0 }
                
                # 娑撳﹤鐪板铏圭摎 - 濞插墽閮磋ぐ鍗炴惙閸?(0-100)
                set_variable = { CZD_yanan_influence = 25 }
                set_variable = { CZD_soviet_influence = 25 }
                set_variable = { CZD_kapsan_influence = 25 }
                set_variable = { CZD_domestic_influence = 25 }
                
# 鐎规ê鍎﹂梼璺虹湴閸欐﹢鍣?(鐢?_power 閸氬海绱戦悽銊ょ艾GUI閺勫墽銇?
				set_variable = { CZD_petty_officials = 55 }
				set_variable = { CZD_technocrats = 20 }
				set_variable = { CZD_bureaucratic_bourgeoisie = 20 }
				set_variable = { CZD_grassroots_cadres = 5 }
				
				# GUI閺勫墽銇氶悽銊ф畱 _power 閸氬海绱戦崣姗€鍣?
				set_variable = { CZD_petty_officials_power = 55 }
				set_variable = { CZD_technocrats_power = 20 }
				set_variable = { CZD_bureaucratic_bourgeoisie_power = 20 }
				set_variable = { CZD_power_core_power = 5 }
				
                # 閹板繗鐦戣ぐ銏♀偓浣规灍娴?
                set_variable = { CZD_revisionism_level = 50 }
                
                # 閸掓繂顫愰崠鏍уЗ閹椒鎱ㄥ锝呭綁闁?
                set_variable = { CZD_econ_agriculture_pop_var = 0 }
                set_variable = { CZD_econ_agriculture_consumer_var = 0 }
                set_variable = { CZD_econ_heavy_military_var = 0 }
                set_variable = { CZD_econ_heavy_civilian_var = 0 }
                set_variable = { CZD_econ_light_build_var = 0 }
                set_variable = { CZD_econ_light_output_var = 0 }
                set_variable = { CZD_econ_commerce_resource_var = 0 }
                set_variable = { CZD_econ_commerce_trade_var = 0 }
                set_variable = { CZD_econ_military_army_var = 0 }
                set_variable = { CZD_econ_military_stability_var = 0 }
                
                set_variable = { CZD_pol_yanan_pp_var = 0 }
                set_variable = { CZD_pol_yanan_drift_var = 0 }
                set_variable = { CZD_pol_soviet_research_var = 0 }
                set_variable = { CZD_pol_kapsan_resistance_var = 0 }
                set_variable = { CZD_pol_kapsan_morale_var = 0 }
                set_variable = { CZD_pol_domestic_stability_var = 0 }
                set_variable = { CZD_pol_domestic_build_var = 0 }
                set_variable = { CZD_pol_petty_conscript_var = 0 }
                set_variable = { CZD_pol_technocrat_efficiency_var = 0 }
                set_variable = { CZD_pol_bourgeois_pp_var = 0 }
                
                # 鐠佸墽鐤嗘妯款吇閺€鎸庝笉鐠侯垳鍤?(娴滅儤鐨鎴滃瘜娑撴挻鏂?
                set_country_flag = CZD_current_line_democracy
                set_variable = { CZD_current_line_id = 2 }
                
                # 閺€鎸庝笉缂佸繑绁圭€涳妇閮寸紒?- 鐎瑰本鍨氶崚璺侯唩娴兼俺顔呴崶鐣岀摜閸氬氦袙闁?
                # set_country_flag = CZD_political_economy_unlocked
                
                # 閸掓繂顫愰崠鏍у綁闁插骏绱欐担鍡曠瑝濞ｈ濮炴穱顔筋劀閸ｎ煉绱濈粵澶婂煑鐎诡亙绱扮拋顔肩暚閹存劕鎮楅崘宥嗗潑閸旂媴绱?

                # --- 閺傛澘顤冮敍姘承曢崣鎴濈磻鐏炩偓娴犲绮涙禍瀣╂ ---
				country_event = { id = czd_intro.1 days = 2 } # 瀵ゆ儼绻?婢垛晞袝閸欐埊绱濋柆鍨帳瀵偓鐏炩偓閸楋繝銆?
            }
        }
    }
    
    # 鐎佃妫╅幋妯圭挨閻栧棗褰傞弮鎯靶曢崣鎴濆彙娴溠冩禇闂勫懏褰洪崘?
    on_war = {
        effect = {
            # 婵″倹鐏塁ZD鐎瑰本鍨氭禍鍡楀彙娴溠冩禇闂勫懏褰洪崝鈺佹禇缁涙牭绱濇稉鏂剧瑢閺冦儲婀板鈧幋?
            if = {
                limit = {
                    tag = CZD
                    has_country_flag = CZD_comintern_aid_completed
                    has_war_with = JAP
                    NOT = { has_country_flag = CZD_comintern_volunteers_sent }
                }
                # 鐟欙箑褰傞幓鏉戝晽娴滃娆?
                country_event = { id = czd_comintern.1 days = 3 }
                set_country_flag = CZD_comintern_volunteers_sent
            }
        }
    }
    
    # 濮ｅ繑婀€閺囧瓨鏌婇弨鎸庝笉缂佸繑绁圭€涳妇閮寸紒?
    on_monthly = {
        effect = {
            if = {
                limit = {
                    tag = CZD
                    has_country_flag = CZD_political_economy_unlocked
                }
                # 娑撳﹤鐪板铏圭摎閸欏秳缍旈悽銊ょ艾缂佸繑绁归崺铏诡攨
                CZD_superstructure_affects_base = yes
                # 閺囧瓨鏌婇幍鈧張澶嬫櫏閺?
                CZD_update_economic_effects = yes
                
                # ========== 鐎规ê鍎﹂梼璺虹湴閸欏秳缍旈悽銊︽簚閸?==========
                # 鐎规ê鍎︾挧鍕獓闂冨墎楠囬獮鍙夌Ч - 瑜板崬鎼烽崝娑滅Ш妤傛袝閸欐垼绉烘０鎴犵畳
                # 閸╄櫣顢呯憴锕€褰傞悳?5%閿涘苯濂栭崫宥呭濮ｅ繗绉存潻鍥閸婄厧顤冮崝鐘盒曢崣鎴犲芳
                random_list = {
                    75 = { }  # 娑撳秷袝閸?
                    25 = {
                        # 閸╄櫣顢呯憴锕€褰傚鍌滃芳閿涘本鐗撮幑顔煎閸濆秴濮忛幓鎰扮彯
                        modifier = {
                            factor = 1.3
                            check_variable = { CZD_bureaucratic_bourgeoisie_power > 30 }
                        }
                        modifier = {
                            factor = 1.5
                            check_variable = { CZD_bureaucratic_bourgeoisie_power > 40 }
                        }
                        modifier = {
                            factor = 1.8
                            check_variable = { CZD_bureaucratic_bourgeoisie_power > 50 }
                        }
                        modifier = {
                            factor = 2.0
                            check_variable = { CZD_bureaucratic_bourgeoisie_power > 60 }
                        }
                        modifier = {
                            factor = 2.5
                            check_variable = { CZD_bureaucratic_bourgeoisie_power > 70 }
                        }
                        modifier = {
                            factor = 0
                            NOT = { check_variable = { CZD_bureaucratic_bourgeoisie_power > 25 } }
                        }
                        modifier = {
                            factor = 0
                            has_country_flag = CZD_bureaucracy_event_cooldown
                        }
                        # 閸愬嘲宓堥弮鍫曟？娑旂喖娈㈣ぐ鍗炴惙閸旀盯妾锋担?
                        if = {
                            limit = { check_variable = { CZD_bureaucratic_bourgeoisie_power > 60 } }
                            set_country_flag = { flag = CZD_bureaucracy_event_cooldown days = 25 value = 1 }
                        }
                        else_if = {
                            limit = { check_variable = { CZD_bureaucratic_bourgeoisie_power > 45 } }
                            set_country_flag = { flag = CZD_bureaucracy_event_cooldown days = 35 value = 1 }
                        }
                        else = {
                            set_country_flag = { flag = CZD_bureaucracy_event_cooldown days = 45 value = 1 }
                        }
                        random_list = {
                            8 = { country_event = { id = czd_bureaucracy.1 } }
                            8 = { country_event = { id = czd_bureaucracy.2 } }
                            8 = { country_event = { id = czd_bureaucracy.3 } }
                            8 = { country_event = { id = czd_bureaucracy.4 } }
                            8 = { country_event = { id = czd_bureaucracy.5 } }
                            8 = { country_event = { id = czd_bureaucracy.6 } }
                            8 = { country_event = { id = czd_bureaucracy.7 } }
                            8 = { country_event = { id = czd_bureaucracy.8 } }
                            8 = { country_event = { id = czd_bureaucracy.9 } }
                            7 = { country_event = { id = czd_bureaucracy.40 } }
                            7 = { country_event = { id = czd_bureaucracy.41 } }
                            7 = { country_event = { id = czd_bureaucracy.42 } }
                            7 = { country_event = { id = czd_bureaucracy.43 } }
                            7 = { country_event = { id = czd_bureaucracy.44 } }
                            7 = { country_event = { id = czd_bureaucracy.45 } }
                            7 = { country_event = { id = czd_bureaucracy.46 } }
                            7 = { country_event = { id = czd_bureaucracy.47 } }
                        }
                    }
                }
                
                # 閹垛偓閺堫垰鐣奸崓姘叡濞?(閸楃姵鐦?35%閺冭埖婀佸鍌滃芳鐟欙箑褰?
                random_list = {
                    70 = { }
                    30 = {
                        modifier = {
                            factor = 0
                            NOT = { check_variable = { CZD_technocrats_power > 35 } }
                        }
                        modifier = {
                            factor = 0
                            has_country_flag = CZD_bureaucracy_event_cooldown
                        }
                        set_country_flag = { flag = CZD_bureaucracy_event_cooldown days = 45 value = 1 }
                        random_list = {
                            15 = { country_event = { id = czd_bureaucracy.10 } }
                            15 = { country_event = { id = czd_bureaucracy.11 } }
                            15 = { country_event = { id = czd_bureaucracy.12 } }
                            14 = { country_event = { id = czd_bureaucracy.13 } }
                            14 = { country_event = { id = czd_bureaucracy.14 } }
                            14 = { country_event = { id = czd_bureaucracy.15 } }
                            13 = { country_event = { id = czd_bureaucracy.16 } }
                        }
                    }
                }
                
                # 閸╁搫鐪伴獮鏌ュ劥楠炲弶绉?(閸楃姵鐦?45%閺冭埖婀佸鍌滃芳鐟欙箑褰?
                random_list = {
                    70 = { }
                    30 = {
                        modifier = {
                            factor = 0
                            NOT = { check_variable = { CZD_petty_officials_power > 45 } }
                        }
                        modifier = {
                            factor = 0
                            has_country_flag = CZD_bureaucracy_event_cooldown
                        }
                        set_country_flag = { flag = CZD_bureaucracy_event_cooldown days = 45 value = 1 }
                        random_list = {
                            15 = { country_event = { id = czd_bureaucracy.20 } }
                            15 = { country_event = { id = czd_bureaucracy.21 } }
                            15 = { country_event = { id = czd_bureaucracy.22 } }
                            14 = { country_event = { id = czd_bureaucracy.23 } }
                            14 = { country_event = { id = czd_bureaucracy.24 } }
                            14 = { country_event = { id = czd_bureaucracy.25 } }
                            13 = { country_event = { id = czd_bureaucracy.26 } }
                        }
                    }
                }
                
                # 閺夊啫濮忛弽绋跨妇楠炲弶绉?(閸楃姵鐦?40%閺冭埖婀佸鍌滃芳鐟欙箑褰?
                random_list = {
                    75 = { }
                    25 = {
                        modifier = {
                            factor = 0
                            NOT = { check_variable = { CZD_power_core_power > 40 } }
                        }
                        modifier = {
                            factor = 0
                            has_country_flag = CZD_bureaucracy_event_cooldown
                        }
                        set_country_flag = { flag = CZD_bureaucracy_event_cooldown days = 45 value = 1 }
                        random_list = {
                            20 = { country_event = { id = czd_bureaucracy.30 } }
                            20 = { country_event = { id = czd_bureaucracy.31 } }
                            20 = { country_event = { id = czd_bureaucracy.32 } }
                            20 = { country_event = { id = czd_bureaucracy.33 } }
                            20 = { country_event = { id = czd_bureaucracy.34 } }
                        }
                    }
                }
                
                # ========== 难以入眠的夜晚：激进路线事件 ==========
                # 当激进路线激活时，触发革命斗争相关事件
                if = {
                    limit = {
                        has_country_flag = CZD_radical_line_active
                        NOT = { has_country_flag = CZD_sleepless_event_cooldown }
                    }
                    
                    # 基础触发概率
                    random_list = {
                        60 = { }  # 无事发生
                        40 = {
                            # 根据革命势头调整概率
                            modifier = {
                                factor = 1.5
                                check_variable = { CZD_revolutionary_momentum > 30 }
                            }
                            modifier = {
                                factor = 2.0
                                check_variable = { CZD_revolutionary_momentum > 50 }
                            }
                            modifier = {
                                factor = 2.5
                                check_variable = { CZD_revolutionary_momentum > 70 }
                            }
                            # 反革命力量过高时增加危机事件
                            modifier = {
                                factor = 1.3
                                check_variable = { CZD_counterrevolution_level > 40 }
                            }
                            modifier = {
                                factor = 1.5
                                check_variable = { CZD_counterrevolution_level > 60 }
                            }
                            
                            # 设置冷却期
                            set_country_flag = { flag = CZD_sleepless_event_cooldown days = 20 value = 1 }
                            
                            # 根据当前阶段选择事件
                            if = {
                                limit = {
                                    NOT = { has_country_flag = CZD_sleepless_chapter_1_done }
                                }
                                # 第一章：觉醒 (1-5)
                                random_list = {
                                    20 = { country_event = { id = czd_sleepless.1 } }
                                    20 = { country_event = { id = czd_sleepless.2 } }
                                    20 = { country_event = { id = czd_sleepless.3 } }
                                    20 = { country_event = { id = czd_sleepless.4 } }
                                    20 = { country_event = { id = czd_sleepless.5 } }
                                }
                            }
                            else_if = {
                                limit = {
                                    has_country_flag = CZD_sleepless_chapter_1_done
                                    NOT = { has_country_flag = CZD_sleepless_chapter_2_done }
                                }
                                # 第二章：斗争 (10-14)
                                random_list = {
                                    20 = { country_event = { id = czd_sleepless.10 } }
                                    20 = { country_event = { id = czd_sleepless.11 } }
                                    20 = { country_event = { id = czd_sleepless.12 } }
                                    20 = { country_event = { id = czd_sleepless.13 } }
                                    20 = { country_event = { id = czd_sleepless.14 } }
                                }
                            }
                            else_if = {
                                limit = {
                                    has_country_flag = CZD_sleepless_chapter_2_done
                                    NOT = { has_country_flag = CZD_sleepless_chapter_3_done }
                                }
                                # 第三章：牺牲 (20-24)
                                random_list = {
                                    20 = { country_event = { id = czd_sleepless.20 } }
                                    20 = { country_event = { id = czd_sleepless.21 } }
                                    20 = { country_event = { id = czd_sleepless.22 } }
                                    20 = { country_event = { id = czd_sleepless.23 } }
                                    20 = { country_event = { id = czd_sleepless.24 } }
                                }
                            }
                            else_if = {
                                limit = {
                                    has_country_flag = CZD_sleepless_chapter_3_done
                                    NOT = { has_country_flag = CZD_sleepless_chapter_4_done }
                                }
                                # 第四章：希望与绝望 (30-34)
                                random_list = {
                                    20 = { country_event = { id = czd_sleepless.30 } }
                                    20 = { country_event = { id = czd_sleepless.31 } }
                                    20 = { country_event = { id = czd_sleepless.32 } }
                                    20 = { country_event = { id = czd_sleepless.33 } }
                                    20 = { country_event = { id = czd_sleepless.34 } }
                                }
                            }
                            else_if = {
                                limit = {
                                    has_country_flag = CZD_sleepless_chapter_4_done
                                    NOT = { has_country_flag = CZD_sleepless_chapter_5_done }
                                }
                                # 第五章：官僚的反扑 (40-44)
                                random_list = {
                                    20 = { country_event = { id = czd_sleepless.40 } }
                                    20 = { country_event = { id = czd_sleepless.41 } }
                                    20 = { country_event = { id = czd_sleepless.42 } }
                                    20 = { country_event = { id = czd_sleepless.43 } }
                                    20 = { country_event = { id = czd_sleepless.44 } }
                                }
                            }
                            else_if = {
                                limit = {
                                    has_country_flag = CZD_sleepless_chapter_5_done
                                    NOT = { has_country_flag = CZD_sleepless_chapter_6_done }
                                }
                                # 第六章：最后的战斗 (50-54)
                                random_list = {
                                    20 = { country_event = { id = czd_sleepless.50 } }
                                    20 = { country_event = { id = czd_sleepless.51 } }
                                    20 = { country_event = { id = czd_sleepless.52 } }
                                    20 = { country_event = { id = czd_sleepless.53 } }
                                    20 = { country_event = { id = czd_sleepless.54 } }
                                }
                            }
                            else = {
                                # 第七章：殉道或胜利 (60-64)
                                if = {
                                    limit = { check_variable = { CZD_revolutionary_momentum > 70 } }
                                    # 革命势头足够高 - 走向胜利
                                    random_list = {
                                        50 = { country_event = { id = czd_sleepless.63 } }
                                        50 = { country_event = { id = czd_sleepless.64 } }
                                    }
                                }
                                else_if = {
                                    limit = { check_variable = { CZD_counterrevolution_level > 60 } }
                                    # 反革命力量过强 - 走向殉道
                                    random_list = {
                                        50 = { country_event = { id = czd_sleepless.60 } }
                                        50 = { country_event = { id = czd_sleepless.61 } }
                                    }
                                }
                                else = {
                                    # 均衡状态 - 随机结局
                                    random_list = {
                                        20 = { country_event = { id = czd_sleepless.60 } }
                                        20 = { country_event = { id = czd_sleepless.61 } }
                                        20 = { country_event = { id = czd_sleepless.62 } }
                                        20 = { country_event = { id = czd_sleepless.63 } }
                                        20 = { country_event = { id = czd_sleepless.64 } }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    
    # =============================================
    # 官僚资产阶级危机：每月恶化检测
    # =============================================
    on_monthly = {
        effect = {
            # 只要有任意一个官僚危机buff，每月触发恶化事件
            if = {
                limit = {
                    tag = CZD
                    OR = {
                        has_idea = CZD_bureaucracy_crisis_mild
                        has_idea = CZD_bureaucracy_crisis_severe
                        has_idea = CZD_bureaucracy_crisis_critical
                    }
                }
                country_event = { id = czd_bureaucracy_crisis.10 }
            }
            
            # 革命胜利：每月官僚资产阶级影响力-100（彻底压制）
            if = {
                limit = {
                    tag = CZD
                    has_idea = CZD_revolution_victorious
                }
                # 直接将官僚资产阶级压到最低
                subtract_from_variable = { CZD_bureaucratic_bourgeoisie = 100 }
                subtract_from_variable = { CZD_bureaucratic_bourgeoisie_power = 100 }
                clamp_variable = { var = CZD_bureaucratic_bourgeoisie min = 5 max = 100 }
                clamp_variable = { var = CZD_bureaucratic_bourgeoisie_power min = 5 max = 100 }
                CZD_normalize_bureaucracy = yes
            }
        }
    }
}