on_actions = {

	on_startup = {
		effect = {
			USA = {
				set_country_flag = prca_v0.9.0
				set_country_flag = prca_enabled
				set_country_flag = prca_leaflets_enabled
			}
            JAP = {
				set_country_flag = prca_v0.9.0
				set_country_flag = prca_enabled
				set_country_flag = prca_leaflets_enabled
			}
			ITA = {
				set_country_flag = prca_v0.9.0
				set_country_flag = prca_enabled
				set_country_flag = prca_leaflets_enabled
			}
			
			GER = {
				add_ideas = german_economic_miracle
			}
			SOV = {
				add_ideas = soviet_nationalization_full
			}
			if = {
				limit = {
					has_global_flag = wia_baby_mode
				}
				FRA = {
			    	add_research_slot = -1
			    }
			}

			# maintain list of guarantors
			if = {
				limit = {
					has_global_flag = KR_Economy_Logging
					is_debug = yes
				}

				#unit limits logging
				log = "KR_Unit_Limit_Metrics;[GetDateText];[Root.GetTag];[?num_actual_divisions];[?max_divisions]"
			}

			random_country = {
				limit = { is_ai = no }
				country_event = {
					id = prca.6
					days = 1
				}
			}
			
			set_province_name = {
                id = 4512
                name = "Diyarbakır"
            }
			set_province_name = {
                id = 876
                name = "Harput"
            }
			set_province_name = {
                id = 9868
                name = "Erzincan"
            }
			set_province_name = {
                id = 10497
                name = "Siirt"
            }
			set_province_name = {
                id = 7530
                name = "Cizre"
            }
			set_province_name = {
                id = 12476
                name = "Hakkari"
            }
			set_province_name = {
                id = 12376
                name = "Ağrı"
            }
			set_province_name = {
                id = 6813
                name = "Maraş"
            }
			set_province_name = {
                id = 904
                name = "Adapazarı"
            }
			set_province_name = {
                id = 804
                name = "Kırıkkale"
            }
			set_province_name = {
                id = 9799
                name = "Balıkesir"
            }
			random_country = {
				limit = {
					is_ai = no
				}
				random_other_country = {
					limit = {
						is_ai = no
					}
					set_global_flag = wia_mp
				}
			}
			set_global_flag = BM_ExtendedProjects
			every_country = {
				limit = {
					is_ai = no
				}
				set_country_flag = ip_enabled
				set_variable = { ROOT.st_marked_states = 0 }
				set_country_flag = ct_main_flag
				set_country_flag = info_open_flag
				set_country_flag = info_page1_flag
				set_country_flag = info_page3_subpage1_flag
			}

			if = {
				limit = { has_game_rule = { rule = wia_formable     option = wia_formables_enable_y } }

				set_global_flag = rt56rp_gr_formables_gflag
			}

			if = {
				limit = { has_game_rule = { rule = wia_money_rule     option = wia_money_rule_enable_y } }

				set_global_flag = wia_money_gflag
			}

			if = {
				limit = {
					has_game_rule = { rule = wia_turkish_mode_rule option = wia_turkish_mode_rule_enable_y }
				}

				set_global_flag = wia_baby_mode
		    }

			every_country = {
				add_ideas = {
					wia_balance_idea
				}
				country_event = kr.political.119
				set_variable  = {
                    var = wia_sos_variable
                    value = 0
                }
				set_country_flag = rank_game_started
				set_country_flag = rank_game_started2
			}

			#every_country = {
			#	limit = {
			#		is_ai = yes
			#		is_major = no
			#		NOT = {
			#			tag = SPR
			#			tag = POR
			#			tag = POL
			#			tag = TUR
			#			tag = SWI
			#			tag = CZE
			#			tag = AUS
			#			tag = ROM
			#			tag = YUG
			#			tag = BUL
			#			tag = GRE
			#			tag = SWE
			#			tag = NOR
			#			tag = FIN
			#			tag = PRC
			#			tag = CHI
			#			tag = RAJ
			#			tag = MAN
			#			tag = MEN
			#			tag = SHX
			#			tag = XSM
			#			tag = YUN
			#			tag = AUS
			#			tag = SAF
			#			tag = CAN
			#			tag = NZL
			#			tag = EGY
			#		}
			#	}

			#	country_lock_all_division_template = yes
			#	load_focus_tree = generic_focus
			#}

			every_country = {
				remove_ideas = free_press
			}

			if = {
				limit = {
					has_game_rule = { rule = noyan_ai_behavior option = NOYAN }
				}

				every_country = {
					set_cosmetic_tag = noyan_cos
				}
			}

			if = {
				limit = {
					has_game_rule = { rule = wia_faction_rule option = wia_faction_rule_enable_y }
				}

				set_global_flag = wia_faction_limiter_enabled_gflag
			}

			if = {
				limit = {
					has_game_rule = { rule = wia_war_rule option = wia_war_rule_enable_y }
				}

				set_global_flag = wia_war_limiter_enabled_gflag
			}

			if = {
				limit = {
					has_game_rule = { rule = WIA_SOUTH_AMERICA_ANNEX_RULE option = WIA_SOUTH_AMERICA_ANNEX }
				}

				ANA = {
					annex_country = {
                        target = BRA
                        transfer_troops = yes
                    }
					annex_country = {
                        target = URG
                        transfer_troops = yes
                    }
					annex_country = {
                        target = ARG
                        transfer_troops = yes
                    }
					annex_country = {
                        target = CHL
                        transfer_troops = yes
                    }
					annex_country = {
                        target = PAR
                        transfer_troops = yes
                    }
					annex_country = {
                        target = BOL
                        transfer_troops = yes
                    }
					annex_country = {
                        target = PRU
                        transfer_troops = yes
                    }
					annex_country = {
                        target = ECU
                        transfer_troops = yes
                    }
					annex_country = {
                        target = COL
                        transfer_troops = yes
                    }
					annex_country = {
                        target = VEN
                        transfer_troops = yes
                    }
				}

				else_if = {
					limit = {
						has_game_rule = { rule = WIA_SOUTH_AMERICA_ANNEX_RULE option = WIA_SOUTH_AMERICA_ANNEX_EXCEPT_BRASIL }
					}

					ANA = {
				    	annex_country = {
                            target = URG
                            transfer_troops = yes
                        }
				    	annex_country = {
                            target = ARG
                            transfer_troops = yes
                        }
				    	annex_country = {
                            target = CHL
                            transfer_troops = yes
                        }
				    	annex_country = {
                            target = PAR
                            transfer_troops = yes
                        }
				    	annex_country = {
                            target = BOL
                            transfer_troops = yes
                        }
				    	annex_country = {
                            target = PRU
                            transfer_troops = yes
                        }
				    	annex_country = {
                            target = ECU
                            transfer_troops = yes
                        }
				    	annex_country = {
                            target = COL
                            transfer_troops = yes
                        }
				    	annex_country = {
                            target = VEN
                            transfer_troops = yes
                        }
				    }
				}
			}

			if = {
				limit = {
					has_game_rule = { rule = WIA_CENTRAL_AMERICA_ANNEX_RULE option = WIA_CENTRAL_AMERICA_ANNEX }
				}

				ANA = {
					annex_country = {
                        target = VEN
                        transfer_troops = yes
                    }
				    annex_country = {
                        target = PAN
                        transfer_troops = yes
                    }
				    annex_country = {
                        target = COS
                        transfer_troops = yes
                    }
				    annex_country = {
                        target = NIC
                        transfer_troops = yes
                    }
				    annex_country = {
                        target = HON
                        transfer_troops = yes
                    }
				    annex_country = {
                        target = ELS
                        transfer_troops = yes
                    }
				    annex_country = {
                        target = GUA
                        transfer_troops = yes
                    }
				    annex_country = {
                        target = CUB
                        transfer_troops = yes
                    }
				    annex_country = {
                        target = HAI
                        transfer_troops = yes
                    }
				    annex_country = {
                        target = DOM
                        transfer_troops = yes
                    }
				}
			}	

			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_CAN }
				}
				CAN = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_USA }
				}
				USA = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_MEX }
				}
				MEX = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_GUA }
				}
				GUA = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_ELS }
				}
				ELS = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_HON }
				}
				HON = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_NIC }
				}
				NIC = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_COS }
				}
				COS = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_PAN }
				}
				PAN = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_COL }
				}
				COL = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_VEN }
				}
				VEN = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_ECU }
				}
				ECU = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_PRU }
				}
				PRU = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_BRA }
				}
				BRA = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_BOL }
				}
				BOL = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_PAR }
				}
				PAR = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_CHL }
				}
				CHL = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_ARG }
				}
				ARG = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_URG }
				}
				URG = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_CUB }
				}
				CUB = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_HAI }
				}
				HAI = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_LIB }
				}
				LIB = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_COG }
				}
				COG = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_SAF }
				}
				SAF = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_ETH }
				}
				ETH = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_AFA }
				}
				AFA = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_EGY }
				}
				EGY = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_ICE }
				}
				ICE = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_DEN }
				}
				DEN = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_IRE }
				}
				IRE = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_ENG }
				}
				ENG = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_POR }
				}
				POR = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_SPR }
				}
				SPR = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_ADR }
				}
				ADR = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_FRA }
				}
				FRA = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_MNC }
				}
				MNC = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_LUX }
				}
				LUX = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_BEL }
				}
				BEL = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_HOL }
				}
				HOL = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_GER }
				}
				GER = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_SWI }
				}
				SWI = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_ITA }
				}
				ITA = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_SAN }
				}
				SAN = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_NOR }
				}
				NOR = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_SWE }
				}
				SWE = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_FIN }
				}
				FIN = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_AUS }
				}
				AUS = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_CZE }
				}
				CZE = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_HUN }
				}
				HUN = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_POL }
				}
				POL = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_LIT }
				}
				LIT = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_LAT }
				}
				LAT = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_EST }
				}
				EST = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_SOV }
				}
				SOV = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_YUG }
				}
				YUG = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_ALB }
				}
				ALB = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_GRE }
				}
				GRE = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_ROM }
				}
				ROM = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_BUL }
				}
				BUL = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_TUR }
				}
				TUR = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_MPL }
				}
				MPL = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_IRQ }
				}
				IRQ = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_SAU }
				}
				SAU = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_YEM }
				}
				YEM = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_OMA }
				}
				OMA = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_PER }
				}
				PER = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_AFG }
				}
				AFG = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_RAJ }
				}
				RAJ = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_NEP }
				}
				NEP = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_BHU }
				}
				BHU = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_TIB }
				}
				TIB = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_TNG }
				}
				TNG = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_SIK }
				}
				SIK = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_MON }
				}
				MON = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_TAN }
				}
				TAN = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_XSM }
				}
				XSM = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_PRC }
				}
				PRC = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_SHX }
				}
				SHX = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_MEN }
				}
				MEN = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_MAN }
				}
				MAN = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_JAP }
				}
				JAP = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_CHI }
				}
				CHI = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_YUN }
				}
				YUN = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_GXC }
				}
				GXC = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_FRI }
				}
				FRI = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_SIA }
				}
				SIA = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_MAL }
				}
				MAL = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_INS }
				}
				INS = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_PHI }
				}
				PHI = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_AST }
				}
				AST = {set_country_flag = wia_host}
			}
			if = {
				limit = {
					has_game_rule = { rule = wia_host_tools option = WIA_NZL }
				}
				NZL = {set_country_flag = wia_host}
			}

			if = {
				limit = {
					has_game_rule = { rule = wienna_ai_behavior option = WIENNA_RULE }
				}
				AUS = {
					set_cosmetic_tag = WIENNA

					set_politics = {
						ruling_party = neutrality
						elections_allowed = no
					}
					set_popularities = {
						democratic = 10
						neutrality = 87
						fascism = 3
						communism = 0
					}
					set_party_name = {
						ideology = neutrality
						long_name = WIENNA_neutrality_party_long
						name = WIENNA_neutrality_party
					}
					set_party_name = {
						ideology = democratic
						long_name = WIENNA_democratic_party_long
						name = WIENNA_democratic_party
					}
					set_party_name = {
						ideology = fascism
						long_name = WIENNA_fascism_party_long
						name = WIENNA_fascism_party
					}
					set_party_name = {
						ideology = communism
						long_name = WIENNA_communism_party_long
						name = WIENNA_communism_party
					}
				}

				AUS = {
					every_character = {
						limit = {
							NOT = {
								is_character = WIENNA_warieant
								is_character = WIENNA_social
								is_character = WIENNA_noyan
								is_character = WIENNA_giray
							}
						}
						retire = yes
					}
				}
			}
		}
	}

	on_weekly = {
		effect = {
			if = {
				limit = {
					has_variable = last_insult_sent_this_amount_of_days_ago
				}
				clear_variable = last_insult_sent_this_amount_of_days_ago
			}

			if = {
				limit = { prca_enabled_trigger = yes }
				add_to_variable = {
					THIS.prca_tokens = THIS.prca_tokens_weekly
				}
				THIS_clamp_max_tokens = yes
			}

			# unit limit calculations
			country_event = kr.political.119
		}
	}

	on_peace = {
		effect = {
			log = "[GetDateText]: [Root.GetName]: on_peace"
			#Demobilization check for the AI
			if = {
				limit = {
					is_ai = yes
					NOT = { has_country_flag = has_demobilization_check }
				}
				set_country_flag = { flag = has_demobilization_check days = 6 value = 1 }
				country_event = { id = kr.political.120 days = 6 }
			}

			#Reduce units check for the AI
			if = {
				limit = {
					is_ai = yes
					NOT = { has_country_flag = has_reduce_units_check }
				}
				set_country_flag = has_reduce_units_check
				country_event = { id = kr.political.121 days = 7 random = 72 }
			}
		}
	}

}