ins_indonesia_wars_category = {
	
	INS_ACE_indonesia_colonial_expansion_war = {
		ai_will_do = { factor = 1 }
		available = {
			if = {
				limit = {
					TAG = INS
					INS = { has_country_flag = INS_respect_dutch_british_treaty_flag }
				}
				#controls_state = 1184
				controls_state = 1185
				controls_state = 918
			}
			if = {
				limit = {
					TAG = INS
					INS = { has_country_flag = INS_ignore_dutch_british_treaty_flag }
				}
				controls_state = 925
				controls_state = 926
				#controls_state = 1184
				controls_state = 1185
				controls_state = 918
			}
			if = {
				limit = {
					has_country_flag = INS_ACE_indonesia_colonial_expansion_war_flag
					NOT = { TAG = INS }
				}
				hidden_trigger = {
					always = no
				}
			}
			
		}
		
		allowed = {
			always = yes
		}
		activation = { 
			has_country_flag = INS_ACE_indonesia_colonial_expansion_war_flag
		}
		selectable_mission = no
		is_good = no
		cancel_trigger = {
			custom_trigger_tooltip = { 
				tooltip = afr_indonesia_war_phase_one_cancel_trigger 
				INS = { exists = no }
			}
		}

		visible = {
			has_country_flag = INS_ACE_indonesia_colonial_expansion_war_flag
		}
		
		fire_only_once = yes

		#cost = 0
		
		days_mission_timeout = 360
		
		days_remove = 30
		
		modifier = {
			war_support_weekly = -0.02
			industry_free_repair_factor = 0.25
			consumer_goods_expected_value = 0.025
		}
		
		complete_effect = {
			if = {
				limit = {
					TAG = INS
				}
				custom_effect_tooltip = afr_indonesia_war_phase_one_complete_ins_tooltip
				if = {
					limit = {
						INS = { controls_state = 1185 }
					}
					INS = { transfer_state = 1185 }
					1185 = {
						
					}
				}
				if = {
					limit = {
						INS = { controls_state = 918 }
					}
					INS = { transfer_state = 918 }
					918 = {
						
					}
				}
				if = {
					limit = {
						INS = { controls_state = 925 }
						INS = { has_country_flag = INS_ignore_dutch_british_treaty_flag }
					}
					INS = { transfer_state = 925 }
					925 = {
						
					}
				}
				if = {
					limit = {
						INS = { controls_state = 926 }
						INS = { has_country_flag = INS_ignore_dutch_british_treaty_flag }
					}
					INS = { transfer_state = 926 }
					926 = {
						
					}
				}
				if = {
					limit = {
						TAG = INS
						OR = {
							#INS = { controls_state = 1184 }
							INS = { controls_state = 1185 }
							INS = { controls_state = 918 }
						}
						INS = { is_subject_of = HOL }
					}
					#hidden_effect = { HOL = { country_event = { id = INS_ACE_indonesia_colonial_expansion_war_won.1 } } }
				}
				hidden_effect = { INS = { add_timed_idea = { idea = INS_indonesia_colonial_expansion_war_exhaustion_idea days = 180 } } }
				#hidden_effect = { 
				#	every_other_country = {
				#		limit = { has_country_flag = INS_ACE_indonesia_colonial_expansion_war_flag }
				#		activate_mission = INS_ACE_indonesia_colonial_expansion_war
				#	}
				#}
				hidden_effect = {
					every_country = {
						limit = {
							has_country_flag = INS_ACE_indonesia_colonial_expansion_war_flag
							NOT = { TAG = INS }
						}
						set_temp_variable = { INS_ACE_temp_country_id = THIS.id }
					}
					every_country = {
						limit = {
							has_war_with = var:INS_ACE_temp_country_id
						}
						white_peace = var:INS_ACE_temp_country_id 
					}
				}
			}
			#else = {
			#	hidden_effect = { 
			#		every_country = {
			#			limit = { 
			#				has_offensive_war_with = ROOT 
			#				OR = {
			#					has_war_together_with = INS
			#					TAG = INS
			#				}
			#			}
			#			white_peace = ROOT
			#		}
			#	}
			#}
			clr_country_flag = INS_ACE_indonesia_colonial_expansion_war_flag
		}
		remove_effect = {
				hidden_effect = {
					if = {
						limit = {  
							ACE = { exists = yes }
							JOH = { exists = yes }
						}
						ACE = { become_exiled_in = { target = JOH legitimacy = 10 } }
					}
				}
		}
		timeout_effect = {
			hidden_effect = { INS = { add_timed_idea = { idea = INS_indonesia_colonial_expansion_war_exhaustion_idea days = 180 } } }
			if = {
				limit = {
					INS = { controls_state = 1185 }
				}
				INS = { transfer_state = 1185 }
				1185 = {
					
				}
			}
			if = {
				limit = {
					INS = { controls_state = 918 }
				}
				INS = { transfer_state = 918 }
				918 = {
					
				}
			}
			if = {
				limit = {
					INS = { controls_state = 925 }
					INS = { has_country_flag = INS_ignore_dutch_british_treaty_flag }
				}
				INS = { transfer_state = 925 }
				925 = {
					
				}
			}
			if = {
				limit = {
					INS = { controls_state = 926 }
					INS = { has_country_flag = INS_ignore_dutch_british_treaty_flag }
				}
				INS = { transfer_state = 926 }
				926 = {
					
				}
			}
			hidden_effect = {
				every_country = {
					limit = {
						has_country_flag = INS_ACE_indonesia_colonial_expansion_war_flag
						NOT = { TAG = INS }
					}
					set_temp_variable = { INS_ACE_temp_country_id = THIS.id }
				}
			
				every_country = {
					limit = {
						has_war_with = var:INS_ACE_temp_country_id
					}
					white_peace = var:INS_ACE_temp_country_id 
				}
			}
			if = {
				limit = {
					TAG = INS
					OR = {
						#INS = { controls_state = 1184 }
						INS = { controls_state = 1185 }
						INS = { controls_state = 918 }
					}
					INS = { is_subject_of = HOL }
				}
				#hidden_effect = { HOL = { country_event = { id = INS_ACE_indonesia_colonial_expansion_war_won.1 } } }
			}
			clr_country_flag = INS_ACE_indonesia_colonial_expansion_war_flag
		}
	}
}
JOH_Prosperity_Mechanic = {
	
	JOH_build_dockyard = {

		available = {
			custom_trigger_tooltip = {
				tooltip = JOH_dockyard_forign_help_tooltip
				has_country_flag = Oceania_dockyard_forign_help
			}
			custom_trigger_tooltip = {
				tooltip = RYU_prosperity_mechanic_greater_than_15
				check_variable = {
					ryu_prosperity_mechanic > 14
				}
			}
			custom_trigger_tooltip = {
				tooltip = afr_prosperity_mechanic_construction
				check_variable = { afr_reforming_regional_power_construction_in_progress < 1 }
			}
		}

		visible = {
		}


		complete_effect = {
			add_political_power = -50
			custom_effect_tooltip = RYU_prosperity_mechanic_minus_15
			add_to_variable = {
				var = ryu_prosperity_mechanic
				value = -15
			}
			add_to_variable = { var = afr_reforming_regional_power_construction_in_progress value = 1 }
			set_country_flag = Oceania_has_dockyard_investment
		}
		days_remove = 360
		
		cost = 50
		
		modifier = {
			political_power_cost = 0.5
        }
		
		fire_only_once = yes
		
		remove_effect = {
            random_owned_controlled_state = {
				limit = { 
					is_core_of = ROOT 
					is_coastal = yes
				}
				add_extra_state_shared_building_slots = 1
				add_building_construction = {
					type = dockyard
					level = 1
					instant_build = yes
				}
		   }
		   custom_effect_tooltip = EDC_afr.6.t
		   hidden_effect = {
				country_event = { id = EDC_afr.6 hours = 1 } 
		   }
		   add_to_variable = { var = afr_reforming_regional_power_construction_in_progress value = -1 }
        }
		
		ai_will_do = {
			factor = 1000
			modifier = {
				factor = 0
				has_political_power < 50
			}
		}
	}

	JOH_build_farm = {

		available = {
			if = {
				limit = {
					any_owned_state = {
						is_core_of = ROOT
						farm > 6 
					}
					NOT = { has_tech = threshing_machine }
				}
				custom_trigger_tooltip = {
					tooltip = RYU_prosperity_mechanic_greater_than_5
						check_variable = {
						ryu_prosperity_mechanic > 4
					}
				}
				custom_trigger_tooltip = {
					tooltip = Ocenaia_farm_less_than_7
					any_owned_state = { 
						farm < 7 
						is_core_of = ROOT
					}
				}
				custom_trigger_tooltip = {
					tooltip = Ocenaia_farm_research_threshing_machine
					has_tech = threshing_machine
				}
			}
			if = {
				limit = {
					has_tech = threshing_machine
				}
				custom_trigger_tooltip = {
					tooltip = RYU_prosperity_mechanic_greater_than_5
						check_variable = {
						ryu_prosperity_mechanic > 4
					}
				}
				custom_trigger_tooltip = {
					tooltip = Ocenaia_farm_less_than_10
					any_owned_state = { 
						farm < 10 
						is_core_of = ROOT
					}
				}
			}
			if = {
				limit = {
					any_owned_state = {
						is_core_of = ROOT
						farm < 7 
					}
					NOT = { has_tech = threshing_machine }
				}
				custom_trigger_tooltip = {
					tooltip = RYU_prosperity_mechanic_greater_than_5
						check_variable = {
						ryu_prosperity_mechanic > 4
					}
				}
				custom_trigger_tooltip = {
					tooltip = Ocenaia_farm_less_than_7
					any_owned_state = { 
						farm < 7 
						is_core_of = ROOT
					}
				}
			}
			custom_trigger_tooltip = {
				tooltip = Ocenaia_has_infrastructure_to_support_new_buildings
				any_owned_state = { 
					 
					is_core_of = ROOT
				}
			}
			custom_trigger_tooltip = {
				tooltip = afr_prosperity_mechanic_construction
				check_variable = { afr_reforming_regional_power_construction_in_progress < 1 }
			}
		}

		visible = {
		}


		complete_effect = {
			add_political_power = -25
			custom_effect_tooltip = RYU_prosperity_mechanic_minus_5
			add_to_variable = {
				var = ryu_prosperity_mechanic
				value = -5
			}
			add_to_variable = { var = afr_reforming_regional_power_construction_in_progress value = 1 }
		}
		days_remove = 550
		
		cost = 25
		
		modifier = {
			political_power_cost = 0.5
        }
		
		
		remove_effect = {
           random_owned_controlled_state ={
				limit = { 
					is_core_of = ROOT 
					OR = {
						AND = {
							ROOT = { NOT = { has_tech = threshing_machine } }
							farm < 7
						}
						AND = {
							ROOT = { has_tech = threshing_machine }
							farm < 10
						}
					}
					
				}
				hidden_effect = {
					add_to_variable = { Oceania_extra_state_shared_building_slots = 1 }
				}
				add_extra_state_shared_building_slots = 1
				add_building_construction = {
					type = farm
					level = 1
					instant_build = yes
				}
				add_manpower = 5000
		   }
		   add_to_variable = { var = afr_reforming_regional_power_construction_in_progress value = -1 }
        }
		
		ai_will_do = {
			factor = 10
			modifier = {
				factor = 0
				has_political_power < 50
			}
		}
	}
	
	JOH_build_cotton_farm = {

		available = {
			if = {
				limit = {
					any_owned_state = {
						is_core_of = ROOT
						cotton_farm > 6 
					}
					NOT = { has_tech = threshing_machine }
				}
				custom_trigger_tooltip = {
					tooltip = RYU_prosperity_mechanic_greater_than_5
						check_variable = {
						ryu_prosperity_mechanic > 4
					}
				}
				custom_trigger_tooltip = {
					tooltip = Ocenaia_cotton_farm_less_than_7
					any_state = { 
						cotton_farm < 7 
						is_core_of = ROOT
					}
				}
				custom_trigger_tooltip = {
					tooltip = Ocenaia_cotton_farm_research_threshing_machine
					has_tech = threshing_machine
				}
			}
			if = {
				limit = {
					has_tech = threshing_machine
				}
				custom_trigger_tooltip = {
					tooltip = RYU_prosperity_mechanic_greater_than_5
						check_variable = {
						ryu_prosperity_mechanic > 4
					}
				}
				custom_trigger_tooltip = {
					tooltip = Ocenaia_cotton_farm_less_than_10
					any_state = { 
						cotton_farm < 10 
						is_core_of = ROOT
					}
				}
			}
			if = {
				limit = {
					any_owned_state = {
						is_core_of = ROOT
						cotton_farm < 7 
					}
					NOT = { has_tech = threshing_machine }
				}
				custom_trigger_tooltip = {
					tooltip = RYU_prosperity_mechanic_greater_than_5
						check_variable = {
						ryu_prosperity_mechanic > 4
					}
				}
				custom_trigger_tooltip = {
					tooltip = Ocenaia_cotton_farm_less_than_7
					any_state = { 
						cotton_farm < 7 
						is_core_of = ROOT
					}
				}
			}
			custom_trigger_tooltip = {
				tooltip = Ocenaia_has_infrastructure_to_support_new_buildings
				any_owned_state = { 
					 
					is_core_of = ROOT
				}
			}
			custom_trigger_tooltip = {
				tooltip = afr_prosperity_mechanic_construction
				check_variable = { afr_reforming_regional_power_construction_in_progress < 1 }
			}
		}

		visible = {
		}

		complete_effect = {
			add_political_power = -50
			custom_effect_tooltip = RYU_prosperity_mechanic_minus_5
			add_to_variable = {
				var = ryu_prosperity_mechanic
				value = -5
			}
			add_to_variable = { var = afr_reforming_regional_power_construction_in_progress value = 1 }
		}
		days_remove = 720
		
		cost = 50
		
		modifier = {
			political_power_cost = 0.5
        }
		
		remove_effect = {
           random_owned_controlled_state ={
				limit = { 
					is_core_of = ROOT 
					OR = {
						AND = {
							ROOT = { NOT = { has_tech = threshing_machine } }
							cotton_farm < 7
						}
						AND = {
							ROOT = { has_tech = threshing_machine }
							cotton_farm < 10
						}
					}
					
				}
				hidden_effect = {
					add_to_variable = { Oceania_extra_state_shared_building_slots = 1 }
				}
				add_extra_state_shared_building_slots = 1
				add_building_construction = {
					type = cotton_farm
					level = 1
					instant_build = yes
				}
		   }
		   add_to_variable = { var = afr_reforming_regional_power_construction_in_progress value = -1 }
        }
		
		ai_will_do = {
			factor = 10
			modifier = {
				factor = 0
				has_political_power < 50
			}
		}
	}
	
	JOH_prosperity_mechanic_clear_development = {

		available = {
			#custom_trigger_tooltip = {
			#	tooltip = afr_prosperity_mechanic_greater_than_10
			#		check_variable = {
			#		afr_prosperity_mechanic_value > 9
			#	}
			#}
			custom_trigger_tooltip = {
				tooltip = Ocenaia_has_insufficient_infrastructure_to_support_new_buildings
				all_owned_state = {
					if = {
						limit = {
							is_core_of = ROOT
						}
						is_core_of = ROOT
						 
					}
				}
			}
			custom_trigger_tooltip = {
				tooltip = Ocenaia_has_infrastructure_to_support_clearing_land
				any_owned_state = { 
					 
					is_core_of = ROOT
				}
			}
			custom_trigger_tooltip = {
				tooltip = afr_prosperity_mechanic_construction
				check_variable = { afr_reforming_regional_power_construction_in_progress < 1 }
			}
		}

		visible = {
			all_owned_state = {
				if = {
					limit = {
						is_core_of = ROOT
					}
					is_core_of = ROOT
					 
				}
			}
		}

		complete_effect = {
			add_political_power = -15
			#custom_effect_tooltip = afr_prosperity_mechanic_minus_10
			#add_to_variable = {
			#	var = afr_prosperity_mechanic_value
			#	value = -10
			#}
			add_to_variable = { var = afr_reforming_regional_power_construction_in_progress value = 1 }
		}
		
		days_remove = 30
		
		modifier = {
			political_power_cost = 0.1
        }
		
		
		remove_effect = {
			hidden_effect = {
				random_owned_controlled_state = {
					limit = {
						is_core_of = ROOT 
						
					}
					add_to_variable = { Oceania_extra_state_shared_building_slots = -1 }
					add_extra_state_shared_building_slots = -1
				}
			}
			custom_effect_tooltip = Oceania_infrastructure_for_clearing_building_slots_tooltip
			add_to_variable = { var = afr_reforming_regional_power_construction_in_progress value = -1 }
        }
		
		ai_will_do = {
			factor = 10
		}
	}
	
}

ACE_Prosperity_Mechanic = {
	
	ACE_build_dockyard = {

		available = {
			custom_trigger_tooltip = {
				tooltip = ACE_dockyard_forign_help_tooltip
				has_country_flag = Oceania_dockyard_forign_help
			}
			custom_trigger_tooltip = {
				tooltip = RYU_prosperity_mechanic_greater_than_15
				check_variable = {
					ryu_prosperity_mechanic > 14
				}
			}
			custom_trigger_tooltip = {
				tooltip = afr_prosperity_mechanic_construction
				check_variable = { afr_reforming_regional_power_construction_in_progress < 1 }
			}
		}

		visible = {
		}


		complete_effect = {
			add_political_power = -50
			custom_effect_tooltip = RYU_prosperity_mechanic_minus_15
			add_to_variable = {
				var = ryu_prosperity_mechanic
				value = -15
			}
			add_to_variable = { var = afr_reforming_regional_power_construction_in_progress value = 1 }
			set_country_flag = Oceania_has_dockyard_investment
		}
		days_remove = 360
		
		cost = 50
		
		modifier = {
			political_power_cost = 0.5
        }
		
		fire_only_once = yes
		
		remove_effect = {
		    random_owned_controlled_state = {
				limit = { 
					is_core_of = ROOT 
					is_coastal = yes
				}
				add_extra_state_shared_building_slots = 1
				add_building_construction = {
					type = dockyard
					level = 1
					instant_build = yes
				}
			}
		   custom_effect_tooltip = EDC_afr.6.t
		   hidden_effect = {
				country_event = { id = EDC_afr.6 hours = 1 } 
		   }
		   add_to_variable = { var = afr_reforming_regional_power_construction_in_progress value = -1 }
        }
		
		ai_will_do = {
			factor = 1000
			modifier = {
				factor = 0
				has_political_power < 50
			}
		}
	}

	ACE_build_farm = {

		available = {
			if = {
				limit = {
					any_owned_state = {
						is_core_of = ROOT
						farm > 6 
					}
					NOT = { has_tech = threshing_machine }
				}
				custom_trigger_tooltip = {
					tooltip = RYU_prosperity_mechanic_greater_than_5
						check_variable = {
						ryu_prosperity_mechanic > 4
					}
				}
				custom_trigger_tooltip = {
					tooltip = Ocenaia_farm_less_than_7
					any_owned_state = { 
						farm < 7 
						is_core_of = ROOT
					}
				}
				custom_trigger_tooltip = {
					tooltip = Ocenaia_farm_research_threshing_machine
					has_tech = threshing_machine
				}
			}
			if = {
				limit = {
					has_tech = threshing_machine
				}
				custom_trigger_tooltip = {
					tooltip = RYU_prosperity_mechanic_greater_than_5
						check_variable = {
						ryu_prosperity_mechanic > 4
					}
				}
				custom_trigger_tooltip = {
					tooltip = Ocenaia_farm_less_than_10
					any_owned_state = { 
						farm < 10 
						is_core_of = ROOT
					}
				}
			}
			if = {
				limit = {
					any_owned_state = {
						is_core_of = ROOT
						farm < 7 
					}
					NOT = { has_tech = threshing_machine }
				}
				custom_trigger_tooltip = {
					tooltip = RYU_prosperity_mechanic_greater_than_5
						check_variable = {
						ryu_prosperity_mechanic > 4
					}
				}
				custom_trigger_tooltip = {
					tooltip = Ocenaia_farm_less_than_7
					any_owned_state = { 
						farm < 7 
						is_core_of = ROOT
					}
				}
			}
			custom_trigger_tooltip = {
				tooltip = Ocenaia_has_infrastructure_to_support_new_buildings
				any_owned_state = { 
					 
					is_core_of = ROOT
				}
			}
			custom_trigger_tooltip = {
				tooltip = afr_prosperity_mechanic_construction
				check_variable = { afr_reforming_regional_power_construction_in_progress < 1 }
			}
		}

		visible = {
		}


		complete_effect = {
			add_political_power = -25
			custom_effect_tooltip = RYU_prosperity_mechanic_minus_5
			add_to_variable = {
				var = ryu_prosperity_mechanic
				value = -5
			}
			add_to_variable = { var = afr_reforming_regional_power_construction_in_progress value = 1 }
		}
		days_remove = 550
		
		cost = 25
		
		modifier = {
			political_power_cost = 0.5
        }
		
		
		remove_effect = {
           random_owned_controlled_state ={
				limit = { 
					is_core_of = ROOT 
					OR = {
						AND = {
							ROOT = { NOT = { has_tech = threshing_machine } }
							farm < 7
						}
						AND = {
							ROOT = { has_tech = threshing_machine }
							farm < 10
						}
					}
					
				}
				hidden_effect = {
					add_to_variable = { Oceania_extra_state_shared_building_slots = 1 }
				}
				add_extra_state_shared_building_slots = 1
				add_building_construction = {
					type = farm
					level = 1
					instant_build = yes
				}
				add_manpower = 5000
		   }
		   add_to_variable = { var = afr_reforming_regional_power_construction_in_progress value = -1 }
        }
		
		ai_will_do = {
			factor = 10
			modifier = {
				factor = 0
				has_political_power < 50
			}
		}
	}
	
	ACE_build_cotton_farm = {

		available = {
			if = {
				limit = {
					any_owned_state = {
						is_core_of = ROOT
						cotton_farm > 6 
					}
					NOT = { has_tech = threshing_machine }
				}
				custom_trigger_tooltip = {
					tooltip = RYU_prosperity_mechanic_greater_than_5
						check_variable = {
						ryu_prosperity_mechanic > 4
					}
				}
				custom_trigger_tooltip = {
					tooltip = Ocenaia_cotton_farm_less_than_7
					any_state = { 
						cotton_farm < 7 
						is_core_of = ROOT
					}
				}
				custom_trigger_tooltip = {
					tooltip = Ocenaia_cotton_farm_research_threshing_machine
					has_tech = threshing_machine
				}
			}
			if = {
				limit = {
					has_tech = threshing_machine
				}
				custom_trigger_tooltip = {
					tooltip = RYU_prosperity_mechanic_greater_than_5
						check_variable = {
						ryu_prosperity_mechanic > 4
					}
				}
				custom_trigger_tooltip = {
					tooltip = Ocenaia_cotton_farm_less_than_10
					any_state = { 
						cotton_farm < 10 
						is_core_of = ROOT
					}
				}
			}
			if = {
				limit = {
					any_owned_state = {
						is_core_of = ROOT
						cotton_farm < 7 
					}
					NOT = { has_tech = threshing_machine }
				}
				custom_trigger_tooltip = {
					tooltip = RYU_prosperity_mechanic_greater_than_5
						check_variable = {
						ryu_prosperity_mechanic > 4
					}
				}
				custom_trigger_tooltip = {
					tooltip = Ocenaia_cotton_farm_less_than_7
					any_state = { 
						cotton_farm < 7 
						is_core_of = ROOT
					}
				}
			}
			custom_trigger_tooltip = {
				tooltip = Ocenaia_has_infrastructure_to_support_new_buildings
				any_owned_state = { 
					 
					is_core_of = ROOT
				}
			}
			custom_trigger_tooltip = {
				tooltip = afr_prosperity_mechanic_construction
				check_variable = { afr_reforming_regional_power_construction_in_progress < 1 }
			}
		}

		visible = {
		}

		complete_effect = {
			add_political_power = -50
			custom_effect_tooltip = RYU_prosperity_mechanic_minus_5
			add_to_variable = {
				var = ryu_prosperity_mechanic
				value = -5
			}
			add_to_variable = { var = afr_reforming_regional_power_construction_in_progress value = 1 }
		}
		days_remove = 720
		
		cost = 50
		
		modifier = {
			political_power_cost = 0.5
        }
		
		remove_effect = {
           random_owned_controlled_state ={
				limit = { 
					is_core_of = ROOT 
					OR = {
						AND = {
							ROOT = { NOT = { has_tech = threshing_machine } }
							cotton_farm < 7
						}
						AND = {
							ROOT = { has_tech = threshing_machine }
							cotton_farm < 10
						}
					}
					
				}
				hidden_effect = {
					add_to_variable = { Oceania_extra_state_shared_building_slots = 1 }
				}
				add_extra_state_shared_building_slots = 1
				add_building_construction = {
					type = cotton_farm
					level = 1
					instant_build = yes
				}
		   }
		   add_to_variable = { var = afr_reforming_regional_power_construction_in_progress value = -1 }
        }
		
		ai_will_do = {
			factor = 10
			modifier = {
				factor = 0
				has_political_power < 50
			}
		}
	}
	
	ACE_prosperity_mechanic_clear_development = {

		available = {
			#custom_trigger_tooltip = {
			#	tooltip = afr_prosperity_mechanic_greater_than_10
			#		check_variable = {
			#		afr_prosperity_mechanic_value > 9
			#	}
			#}
			custom_trigger_tooltip = {
				tooltip = Ocenaia_has_insufficient_infrastructure_to_support_new_buildings
				all_owned_state = {
					if = {
						limit = {
							is_core_of = ROOT
						}
						is_core_of = ROOT
						 
					}
				}
			}
			custom_trigger_tooltip = {
				tooltip = Ocenaia_has_infrastructure_to_support_clearing_land
				any_owned_state = { 
					 
					is_core_of = ROOT
				}
			}
			custom_trigger_tooltip = {
				tooltip = afr_prosperity_mechanic_construction
				check_variable = { afr_reforming_regional_power_construction_in_progress < 1 }
			}
		}

		visible = {
			all_owned_state = {
				if = {
					limit = {
						is_core_of = ROOT
					}
					is_core_of = ROOT
					 
				}
			}
		}

		complete_effect = {
			add_political_power = -15
			#custom_effect_tooltip = afr_prosperity_mechanic_minus_10
			#add_to_variable = {
			#	var = afr_prosperity_mechanic_value
			#	value = -10
			#}
			add_to_variable = { var = afr_reforming_regional_power_construction_in_progress value = 1 }
		}
		
		days_remove = 30
		
		modifier = {
			political_power_cost = 0.1
        }
		
		
		remove_effect = {
			hidden_effect = {
				random_owned_controlled_state = {
					limit = {
						is_core_of = ROOT 
						
					}
					add_to_variable = { Oceania_extra_state_shared_building_slots = -1 }
					add_extra_state_shared_building_slots = -1
				}
			}
			custom_effect_tooltip = Oceania_infrastructure_for_clearing_building_slots_tooltip
			add_to_variable = { var = afr_reforming_regional_power_construction_in_progress value = -1 }
        }
		
		ai_will_do = {
			factor = 10
		}
	}
}

Oceania_Prosperity_Mechanic = {
	
	Oceania_build_dockyard = {

		available = {
			custom_trigger_tooltip = {
				tooltip = Oceania_dockyard_forign_help_tooltip
				has_country_flag = RYU_dockyard_forign_help
			}
			custom_trigger_tooltip = {
				tooltip = RYU_prosperity_mechanic_greater_than_15
				check_variable = {
					ryu_prosperity_mechanic > 14
				}
			}
			custom_trigger_tooltip = {
				tooltip = afr_prosperity_mechanic_construction
				check_variable = { afr_reforming_regional_power_construction_in_progress < 1 }
			}
		}

		visible = {
			NOT = { has_country_flag = Oceania_has_dockyard_investment }
		}


		complete_effect = {
			add_political_power = -50
			custom_effect_tooltip = RYU_prosperity_mechanic_minus_15
			add_to_variable = {
				var = ryu_prosperity_mechanic
				value = -15
			}
			add_to_variable = { var = afr_reforming_regional_power_construction_in_progress value = 1 }
			if = {
				limit = {
					has_country_flag = RYU_ENG_dockyard_forign_help
				}
				ENG = { country_event = { id = RYU_dockyard_construction.1 days = 12 } }
			}
		}
		days_remove = 360
		
		cost = 50
		
		modifier = {
			political_power_cost = 0.5
        }
		
		fire_only_once = yes
		
		remove_effect = {
           random_owned_controlled_state ={
				limit = { 
					is_core_of = ROOT 
					is_coastal = yes
				}
				add_extra_state_shared_building_slots = 1
				add_building_construction = {
					type = dockyard
					level = 1
					instant_build = yes
				}
		   }
		   custom_effect_tooltip = EDC_afr.6.t
		   hidden_effect = {
				country_event = { id = EDC_afr.6 hours = 1 } 
		   }
		   add_to_variable = { var = afr_reforming_regional_power_construction_in_progress value = -1 }
        }
		
		ai_will_do = {
			factor = 1000
			modifier = {
				factor = 0
				has_political_power < 50
			}
		}
	}

	Oceania_build_farm = {

		available = {
			if = {
				limit = {
					any_owned_state = {
						is_core_of = ROOT
						farm > 6 
					}
					NOT = { has_tech = threshing_machine }
				}
				custom_trigger_tooltip = {
					tooltip = RYU_prosperity_mechanic_greater_than_5
						check_variable = {
						ryu_prosperity_mechanic > 4
					}
				}
				custom_trigger_tooltip = {
					tooltip = Ocenaia_farm_less_than_7
					any_owned_state = { 
						farm < 7 
						is_core_of = ROOT
					}
				}
				custom_trigger_tooltip = {
					tooltip = Ocenaia_farm_research_threshing_machine
					has_tech = threshing_machine
				}
			}
			if = {
				limit = {
					has_tech = threshing_machine
				}
				custom_trigger_tooltip = {
					tooltip = RYU_prosperity_mechanic_greater_than_5
						check_variable = {
						ryu_prosperity_mechanic > 4
					}
				}
				custom_trigger_tooltip = {
					tooltip = Ocenaia_farm_less_than_10
					any_owned_state = { 
						farm < 10 
						is_core_of = ROOT
					}
				}
			}
			if = {
				limit = {
					any_owned_state = {
						is_core_of = ROOT
						farm < 7 
					}
					NOT = { has_tech = threshing_machine }
				}
				custom_trigger_tooltip = {
					tooltip = RYU_prosperity_mechanic_greater_than_5
						check_variable = {
						ryu_prosperity_mechanic > 4
					}
				}
				custom_trigger_tooltip = {
					tooltip = Ocenaia_farm_less_than_7
					any_owned_state = { 
						farm < 7 
						is_core_of = ROOT
					}
				}
			}
			custom_trigger_tooltip = {
				tooltip = Ocenaia_has_infrastructure_to_support_new_buildings
				any_owned_state = { 
					 
					is_core_of = ROOT
				}
			}
			custom_trigger_tooltip = {
				tooltip = afr_prosperity_mechanic_construction
				check_variable = { afr_reforming_regional_power_construction_in_progress < 1 }
			}
		}

		visible = {
		}


		complete_effect = {
			add_political_power = -25
			custom_effect_tooltip = RYU_prosperity_mechanic_minus_5
			add_to_variable = {
				var = ryu_prosperity_mechanic
				value = -5
			}
			add_to_variable = { var = afr_reforming_regional_power_construction_in_progress value = 1 }
		}
		days_remove = 550
		
		cost = 25
		
		modifier = {
			political_power_cost = 0.5
        }
		
		
		remove_effect = {
           random_owned_controlled_state ={
				limit = { 
					is_core_of = ROOT 
					OR = {
						AND = {
							ROOT = { NOT = { has_tech = threshing_machine } }
							farm < 7
						}
						AND = {
							ROOT = { has_tech = threshing_machine }
							farm < 10
						}
					}
					
				}
				hidden_effect = {
					add_to_variable = { Oceania_extra_state_shared_building_slots = 1 }
				}
				add_extra_state_shared_building_slots = 1
				add_building_construction = {
					type = farm
					level = 1
					instant_build = yes
				}
				add_manpower = 5000
		   }
		   add_to_variable = { var = afr_reforming_regional_power_construction_in_progress value = -1 }
        }
		
		ai_will_do = {
			factor = 10
			modifier = {
				factor = 0
				has_political_power < 50
			}
		}
	}
	
	Oceania_build_cotton_farm = {

		available = {
			if = {
				limit = {
					any_owned_state = {
						is_core_of = ROOT
						cotton_farm > 6 
					}
					NOT = { has_tech = threshing_machine }
				}
				custom_trigger_tooltip = {
					tooltip = RYU_prosperity_mechanic_greater_than_5
						check_variable = {
						ryu_prosperity_mechanic > 4
					}
				}
				custom_trigger_tooltip = {
					tooltip = Ocenaia_cotton_farm_less_than_7
					any_state = { 
						cotton_farm < 7 
						is_core_of = ROOT
					}
				}
				custom_trigger_tooltip = {
					tooltip = Ocenaia_cotton_farm_research_threshing_machine
					has_tech = threshing_machine
				}
			}
			if = {
				limit = {
					has_tech = threshing_machine
				}
				custom_trigger_tooltip = {
					tooltip = RYU_prosperity_mechanic_greater_than_5
						check_variable = {
						ryu_prosperity_mechanic > 4
					}
				}
				custom_trigger_tooltip = {
					tooltip = Ocenaia_cotton_farm_less_than_10
					any_state = { 
						cotton_farm < 10 
						is_core_of = ROOT
					}
				}
			}
			if = {
				limit = {
					any_owned_state = {
						is_core_of = ROOT
						cotton_farm < 7 
					}
					NOT = { has_tech = threshing_machine }
				}
				custom_trigger_tooltip = {
					tooltip = RYU_prosperity_mechanic_greater_than_5
						check_variable = {
						ryu_prosperity_mechanic > 4
					}
				}
				custom_trigger_tooltip = {
					tooltip = Ocenaia_cotton_farm_less_than_7
					any_state = { 
						cotton_farm < 7 
						is_core_of = ROOT
					}
				}
			}
			custom_trigger_tooltip = {
				tooltip = Ocenaia_has_infrastructure_to_support_new_buildings
				any_owned_state = { 
					 
					is_core_of = ROOT
				}
			}
			custom_trigger_tooltip = {
				tooltip = afr_prosperity_mechanic_construction
				check_variable = { afr_reforming_regional_power_construction_in_progress < 1 }
			}
		}

		visible = {
		}

		complete_effect = {
			add_political_power = -50
			custom_effect_tooltip = RYU_prosperity_mechanic_minus_5
			add_to_variable = {
				var = ryu_prosperity_mechanic
				value = -5
			}
			add_to_variable = { var = afr_reforming_regional_power_construction_in_progress value = 1 }
		}
		days_remove = 720
		
		cost = 50
		
		modifier = {
			political_power_cost = 0.5
        }
		
		remove_effect = {
           random_owned_controlled_state ={
				limit = { 
					is_core_of = ROOT 
					OR = {
						AND = {
							ROOT = { NOT = { has_tech = threshing_machine } }
							cotton_farm < 7
						}
						AND = {
							ROOT = { has_tech = threshing_machine }
							cotton_farm < 10
						}
					}
					
				}
				hidden_effect = {
					add_to_variable = { Oceania_extra_state_shared_building_slots = 1 }
				}
				add_extra_state_shared_building_slots = 1
				add_building_construction = {
					type = cotton_farm
					level = 1
					instant_build = yes
				}
		   }
		   add_to_variable = { var = afr_reforming_regional_power_construction_in_progress value = -1 }
        }
		
		ai_will_do = {
			factor = 10
			modifier = {
				factor = 0
				has_political_power < 50
			}
		}
	}
	
	Oceania_prosperity_mechanic_clear_development = {

		available = {
			#custom_trigger_tooltip = {
			#	tooltip = afr_prosperity_mechanic_greater_than_10
			#		check_variable = {
			#		afr_prosperity_mechanic_value > 9
			#	}
			#}
			custom_trigger_tooltip = {
				tooltip = Ocenaia_has_insufficient_infrastructure_to_support_new_buildings
				all_owned_state = {
					if = {
						limit = {
							is_core_of = ROOT
						}
						is_core_of = ROOT
						 
					}
				}
			}
			custom_trigger_tooltip = {
				tooltip = Ocenaia_has_infrastructure_to_support_clearing_land
				any_owned_state = { 
					 
					is_core_of = ROOT
				}
			}
			custom_trigger_tooltip = {
				tooltip = afr_prosperity_mechanic_construction
				check_variable = { afr_reforming_regional_power_construction_in_progress < 1 }
			}
		}

		visible = {
			all_owned_state = {
				if = {
					limit = {
						is_core_of = ROOT
					}
					is_core_of = ROOT
					 
				}
			}
		}

		complete_effect = {
			add_political_power = -15
			#custom_effect_tooltip = afr_prosperity_mechanic_minus_10
			#add_to_variable = {
			#	var = afr_prosperity_mechanic_value
			#	value = -10
			#}
			add_to_variable = { var = afr_reforming_regional_power_construction_in_progress value = 1 }
		}
		
		days_remove = 30
		
		modifier = {
			political_power_cost = 0.1
        }
		
		
		remove_effect = {
			hidden_effect = {
				random_owned_controlled_state = {
					limit = {
						is_core_of = ROOT 
						
					}
					add_to_variable = { Oceania_extra_state_shared_building_slots = -1 }
					add_extra_state_shared_building_slots = -1
				}
			}
			custom_effect_tooltip = Oceania_infrastructure_for_clearing_building_slots_tooltip
			add_to_variable = { var = afr_reforming_regional_power_construction_in_progress value = -1 }
        }
		
		ai_will_do = {
			factor = 10
		}
	}
	
}

Oceania_Regional_Development = {

	Oceania_regional_development_clear_development = {

		available = {
			#custom_trigger_tooltip = {
			#	tooltip = afr_prosperity_mechanic_greater_than_10
			#		check_variable = {
			#		afr_prosperity_mechanic_value > 9
			#	}
			#}
			custom_trigger_tooltip = {
				tooltip = Ocenaia_has_insufficient_infrastructure_to_support_new_buildings
				all_owned_state = {
					if = {
						limit = {
							is_core_of = ROOT
						}
						is_core_of = ROOT
						 
					}
				}
			}
			custom_trigger_tooltip = {
				tooltip = Ocenaia_has_infrastructure_to_support_clearing_land
				any_owned_state = { 
					 
					is_core_of = ROOT
				}
			}
			custom_trigger_tooltip = {
				tooltip = afr_prosperity_mechanic_construction
				check_variable = { afr_reforming_regional_power_construction_in_progress < 1 }
			}
		}

		visible = {
			all_owned_state = {
				if = {
					limit = {
						is_core_of = ROOT
					}
					is_core_of = ROOT
					 
				}
			}
		}

		complete_effect = {
			add_political_power = -15
			#custom_effect_tooltip = afr_prosperity_mechanic_minus_10
			#add_to_variable = {
			#	var = afr_prosperity_mechanic_value
			#	value = -10
			#}
			add_to_variable = { var = afr_reforming_regional_power_construction_in_progress value = 1 }
		}
		
		days_remove = 30
		
		modifier = {
			political_power_cost = 0.1
        }
		
		
		remove_effect = {
			hidden_effect = {
				random_owned_controlled_state = {
					limit = {
						is_core_of = ROOT 
						
					}
					add_to_variable = { Oceania_extra_state_shared_building_slots = -1 }
					add_extra_state_shared_building_slots = -1
				}
			}
			custom_effect_tooltip = Oceania_infrastructure_for_clearing_building_slots_tooltip
			add_to_variable = { var = afr_reforming_regional_power_construction_in_progress value = -1 }
        }
		
		ai_will_do = {
			factor = 10
		}
	}

}
			
				
	