on_actions = {

	on_daily_USA = {
		# war escalation effects
		effect = {
			if = {
				limit = { has_global_flag = usa_intervened_in_russian_cw }
				# 1 profit level
				if = {
					limit = { check_variable = { RCO.RCO_involvement_level > 9 }
					}
					if = {
						limit = {NOT = {has_idea = USA_RCO_cw_cost_9}}
						remove_all_usa_cw_ideas = yes
						add_ideas = USA_RCO_cw_cost_9
					}
				}
				else_if = {
					limit = { check_variable = { RCO.RCO_involvement_level > 8 }
					}
					if = {
						limit = {NOT = {has_idea = USA_RCO_cw_cost_8}}
						remove_all_usa_cw_ideas = yes
						add_ideas = USA_RCO_cw_cost_8
					}
				}
				else_if = {
					limit = { check_variable = { RCO.RCO_involvement_level > 7 }
					}
					if = {
						limit = {NOT = {has_idea = USA_RCO_cw_cost_7}}
						remove_all_usa_cw_ideas = yes
						add_ideas = USA_RCO_cw_cost_7
					}
				}
				else_if = {
					limit = { check_variable = { RCO.RCO_involvement_level > 6 }
					}
					if = {
						limit = {NOT = {has_idea = USA_RCO_cw_cost_6}}
						remove_all_usa_cw_ideas = yes
						add_ideas = USA_RCO_cw_cost_6
					}
				}
				else_if = {
					limit = { check_variable = { RCO.RCO_involvement_level > 5 }
					}
					if = {
						limit = {NOT = {has_idea = USA_RCO_cw_cost_5}}
						remove_all_usa_cw_ideas = yes
						add_ideas = USA_RCO_cw_cost_5
					}
				}
				else_if = {
					limit = { check_variable = { RCO.RCO_involvement_level > 4 }
					}
					if = {
						limit = {NOT = {has_idea = USA_RCO_cw_cost_4}}
						remove_all_usa_cw_ideas = yes
						add_ideas = USA_RCO_cw_cost_4
					}
				}
				else_if = {
					limit = { check_variable = { RCO.RCO_involvement_level > 3 }
					}
					if = {
						limit = {NOT = {has_idea = USA_RCO_cw_cost_3}}
						remove_all_usa_cw_ideas = yes
						add_ideas = USA_RCO_cw_cost_3
					}
				}
				else_if = {
					limit = { check_variable = { RCO.RCO_involvement_level > 2 }
					}
					if = {
						limit = {NOT = {has_idea = USA_RCO_cw_cost_2}}
						remove_all_usa_cw_ideas = yes
						add_ideas = USA_RCO_cw_cost_2
					}
				}
				else_if = {
					limit = { check_variable = { RCO.RCO_involvement_level > 1 }
					}
					if = {
						limit = {NOT = {has_idea = USA_RCO_cw_cost_1}}
						remove_all_usa_cw_ideas = yes
						add_ideas = USA_RCO_cw_cost_1
					}
				}
				else_if = {
					limit = { check_variable = { RCO.RCO_involvement_level > 0 }
					}
					if = {
						limit = {NOT = {has_idea = USA_RCO_cw_cost}}
						remove_all_usa_cw_ideas = yes
						add_ideas = USA_RCO_cw_cost
					}
				}
				if = {
					limit = { check_variable = { RCO.RCO_public_opinion_level > 90 }
					}
					if = {
						limit = {NOT = {has_idea = USA_RCO_cw_pb_cost_9}}
						remove_all_usa_cw_pb_ideas = yes
						add_ideas = USA_RCO_cw_pb_cost_9
					}
				}
				else_if = {
					limit = { check_variable = { RCO.RCO_public_opinion_level > 80 }
					}
					if = {
						limit = {NOT = {has_idea = USA_RCO_cw_pb_cost_8}}
						remove_all_usa_cw_pb_ideas = yes
						add_ideas = USA_RCO_cw_pb_cost_8
					}
				}
				else_if = {
					limit = { check_variable = { RCO.RCO_public_opinion_level > 70 }
					}
					if = {
						limit = {NOT = {has_idea = USA_RCO_cw_pb_cost_7}}
						remove_all_usa_cw_pb_ideas = yes
						add_ideas = USA_RCO_cw_pb_cost_7
					}
				}
				else_if = {
					limit = { check_variable = { RCO.RCO_public_opinion_level > 60 }
					}
					if = {
						limit = {NOT = {has_idea = USA_RCO_cw_pb_cost_6}}
						remove_all_usa_cw_pb_ideas = yes
						add_ideas = USA_RCO_cw_pb_cost_6
					}
				}
				else_if = {
					limit = { check_variable = { RCO.RCO_public_opinion_level > 50 }
					}
					if = {
						limit = {NOT = {has_idea = USA_RCO_cw_pb_cost_5}}
						remove_all_usa_cw_pb_ideas = yes
						add_ideas = USA_RCO_cw_pb_cost_5
					}
				}
				else_if = {
					limit = { check_variable = { RCO.RCO_public_opinion_level > 40 }
					}
					if = {
						limit = {NOT = {has_idea = USA_RCO_cw_pb_cost_4}}
						remove_all_usa_cw_pb_ideas = yes
						add_ideas = USA_RCO_cw_pb_cost_4
					}
				}
				else_if = {
					limit = { check_variable = { RCO.RCO_public_opinion_level > 30 }
					}
					if = {
						limit = {NOT = {has_idea = USA_RCO_cw_pb_cost_3}}
						remove_all_usa_cw_pb_ideas = yes
						add_ideas = USA_RCO_cw_pb_cost_3
					}
				}
				else_if = {
					limit = { check_variable = { RCO.RCO_public_opinion_level > 20 }
					}
					if = {
						limit = {NOT = {has_idea = USA_RCO_cw_pb_cost_2}}
						remove_all_usa_cw_pb_ideas = yes
						add_ideas = USA_RCO_cw_pb_cost_2
					}
				}
				else_if = {
					limit = { check_variable = { RCO.RCO_public_opinion_level > 10 }
					}
					if = {
						limit = {NOT = {has_idea = USA_RCO_cw_pb_cost_1}}
						remove_all_usa_cw_pb_ideas = yes
						add_ideas = USA_RCO_cw_pb_cost_1
					}
				}
				else_if = {
					limit = { check_variable = { RCO.RCO_public_opinion_level > 0 }
					}
					if = {
						limit = {NOT = {has_idea = USA_RCO_cw_pb_cost}}
						remove_all_usa_cw_pb_ideas = yes
						add_ideas = USA_RCO_cw_pb_cost
					}
				}
			}
		}
	}
			# weekly public op
	on_weekly_USA = {
    	effect = {
       		if = {
            	limit = { has_country_flag = USA_supported_sov }
            	add_to_variable = {
    				var = RCO.RCO_public_opinion_level
    				value = 2
				}
        	}
   		}
	}		
	on_daily_POL = {
    	effect = {
       		if = {
            	limit = { 
					has_war_with = RCO 
					has_global_flag = POL_attacked_rco_in_cw
					}
            	if = {
					limit = {
						controls_state = 242
						controls_state = 241
						controls_state = 1144
					}
					country_event = cw.26
				}
        	}
			if = {
            	limit = { 
					has_war_with = RCO 
					has_global_flag = POL_attacked_rco_in_cw
					}
            	if = {
					limit = {
						RCO = { controls_state = 97 }
					}
					RCO = { country_event = cw.57 }
				}
        	}
   		}
	}	

	on_daily_RCO = {
    	effect = {
       		if = {
            	limit = { has_war_with = SOV}
            	if = {
					limit = {
						is_ai = yes
						war_length_with = {
							tag = SOV
							months > 30
						}
					}
					country_event = cw.27
				}
				if = {
					limit = {
						is_ai = yes
						surrender_progress > 0.3
					}
					country_event = cw.28
				}
				if = {
					limit = { 
						tag = RCO
						is_ai = yes
						controls_state = 217
						controls_state = 249
					}
					SOV = { add_war_support = -0.5 }
					}
				}
        	}
   		}
			
	on_daily_CHE = {
    	effect = {
       		if = {
					limit = {
						tag = CHE		
						OR = {
							has_war_with = RCO
							has_war_with = SOV
						}
						controls_state = 217
						controls_state = 218
					}
					country_event = cw.37
				}
        	}
   		}
	on_daily_USA = {
    	effect = {
       		if = {
            	limit = { 
					has_global_flag = usa_intervened_in_russian_cw
					has_country_flag = USA_helped_chechens
					has_country_flag = usa_9_11
				}
					country_event = {
						id = cw.53
						days = 20
						random_hours = 12
						random_days = 3
					}
				}
        	}
   		}
	on_daily_UKR = {
    	effect = {
       		if = {
            	limit = { 
					any_country = {
						has_cosmetic_tag = UCO
						controls_state = 227
					}
				}
            	if = {
					limit = {
						is_ai = no
					}
					country_event = cw.55
				}
        	}
   		}
	}
}



