﻿add_namespace = bolivia
country_event = {
		id = bolivia.1
		title = bolivia.1.t
		desc = bolivia.1.d
		
		fire_only_once = yes
		is_triggered_only = yes
		
		trigger = {
			#AND = {
				tag = BOL
				#date > 1857.9.9
			#}
		}
		
		immediate = {
			hidden_effect = {
				add_popularity = {
					ideology = centrism
					popularity = 0.25
				}
			}
		}
		
		option = {
			name = bolivia.1.a
			ai_chance = { base = 1 }
			set_politics = {
				ruling_party = centrism
			}
			add_stability = -0.025
			set_capital = { state = 1325 }
			start_civil_war = {
				ruling_party = centrism
				ideology = traditional_conservatism
				size = 0
				capital = 302
				states = { 
					302 688 1071 487 1082 753 1304
				}
				#keep_unit_leaders = {
				#	
				#}
				keep_political_leader = yes
			}
			hidden_effect = { capital_scope = { state_event = { id = bolivia.7 days = 0 trigger_for = controller } } }
		}	
		
		option = {
			name = bolivia.1.b
			ai_chance = { base = 0 }
			add_stability = -0.025
			start_civil_war = {
				ruling_party = traditional_conservatism
				ideology = centrism
				size = 0
				capital = 1325
				states = { 
					1325 1322 1095 924 1100
				}
				#keep_unit_leaders = {
				#	
				#}
				keep_political_leader = yes
			}
			hidden_effect = { capital_scope = { state_event = { id = bolivia.8 days = 0 trigger_for = controller } } }
		}	
}

country_event = {
		id = bolivia.2
		title = bolivia.2.t
		desc = bolivia.2.d

		fire_only_once = yes
		is_triggered_only = yes
		
		trigger = {
			#AND = {
				tag = BOL
				#date > 1861.1.14
			#}
		}
		
		option = {
			name = bolivia.2.a
			add_political_power = -10
			set_politics = {
				ruling_party = traditional_conservatism
			}
			add_popularity = {
				ideology = traditional_conservatism
				popularity = 0.25
			}
			add_stability = 0.05
		}	
}

country_event = {
		id = bolivia.3
		title = bolivia.3.t
		desc = bolivia.3.d
		picture = GFX_report_event_melgarejo
		
		fire_only_once = yes
		is_triggered_only = yes
		
		trigger = {
			#AND = {
				tag = BOL
				#date > 1862.10.16
			#}
		}
		
		option = {
			name = bolivia.3.a
			add_political_power = 5
			add_stability = -0.025
			add_manpower = -1300
		}	
}

country_event = {
		id = bolivia.4
		title = bolivia.4.t
		desc = bolivia.4.d
		picture = GFX_report_event_melgarejo

		fire_only_once = yes
		is_triggered_only = yes
		
		trigger = {
			#AND = {
				tag = BOL
				#date > 1864.12.28
			#}
		}
		
		option = {
			name = bolivia.4.a
			add_war_support = 0.045
			add_stability = -0.02
			set_politics = {
				ruling_party = radical_democracy 
			}
			add_popularity = {
				ideology = radical_democracy 
				popularity = 0.20
			}
		}	
}

country_event = {
		id = bolivia.5
		title = bolivia.5.t
		desc = bolivia.5.d
		picture = GFX_report_event_sucre_rebellion 
		
		fire_only_once = yes
		is_triggered_only = yes
		
		trigger = {
			#AND = {
				tag = BOL
				#date > 1865.1.24
			#}
		}
		
		option = {
			name = bolivia.5.a
			start_civil_war = {
				ideology = traditional_conservatism
				size = 0.2
				capital = 1322
				states = { 
					1322 1095 
				}
				keep_unit_leaders = {
					186307 186308 186309 186311
				}
			}
		}	
}

country_event = {
  id = bolivia.6
  title = bolivia.6.t
  desc = bolivia.6.d

  picture = GFX_news_event_ayacucho_treaty

  major = no

  is_triggered_only = yes

   option = {
	name = bolivia.6.a
	ai_chance = {
		base = 10      
	}

	add_political_power = -10
	BRA = {
		country_event = {
			days = 0
			id = brazil_news.6
		}
	}
  }

  option = {
    name = bolivia.6.b
	ai_chance = {
		base = 90  
	}

	add_political_power = 10
	753 = {
		remove_claim_by = BRA
	}
	1304 = {
		add_core_of = BRA
		remove_core_of = BOL
	}
	BRA = {
		add_opinion_modifier = {
			target = BOL
			modifier = improved_relations
		}
		transfer_state = 1304
	}
	BOL = {
		add_equipment_to_stockpile = {
			type = cavalry_equipment
			amount = 1
		}
	}
	BRA = {
		country_event = {
			days = 0
			id = brazil_news.5
		}
	}
  }
}
state_event = {
	id = bolivia.7
	title = bolivia.7.t
	desc = bolivia.7.d
	hidden = yes
	
	fire_only_once = yes
	is_triggered_only = yes
	
	immediate = {
		OWNER = { set_country_flag = BOL_coup_is_original_tag }
		302 = {
			OWNER = {
				if = { 
					limit = { NOT = { has_country_leader = { name = "Jorge Córdova" ruling_only = yes } } }
					create_country_leader = {
						name = "Jorge Córdova"
						desc = "POLITICS_TEMP_DESC"
						picture = "GFX_Portrait_BOL_Jorge_Cordova"
						expire = 1870.1.1
						ideology = conserv
					}
					generate_character = {
						token_base = BOL_Jorge_Cordova_temp
						name = BOL_Jorge_Cordova_temp
						portraits={
							civilian={
								large="GFX_Portrait_BOL_Jorge_Cordova"
							}
						}
					}
					add_country_leader_role = {
						Character = BOL_Jorge_Cordova_temp
						Promote_leader = yes
						country_leader = {
							ideology = conserv
							expire = "1900.1.1"
						}
					}
					promote_character = BOL_Jorge_Cordova_temp
					promote_character = {
						character = BOL_Jorge_Cordova_temp
						Ideology = conserv
					}
					set_country_leader_portrait = {
						portrait = "GFX_Portrait_BOL_Jorge_Cordova"
					}
				}
				division_template = {
					name = "Córdova's Loyalists"
					priority = 1
					regiments = {
						line_infantry = { x = 0 y = 0 }
					}
					is_locked = yes
				}
				302 = {
					create_unit = {
						division = "name = \"Córdova's Loyalists\" division_template = \"Córdova's Loyalists\" start_experience_factor = 0.6 start_equipment_factor = 1" 
						owner = PREV
					}
					create_unit = {
						division = "name = \"Córdova's Loyalists\" division_template = \"Córdova's Loyalists\" start_experience_factor = 0.6 start_equipment_factor = 1" 
						owner = PREV
					}
				}
				688 = {
					create_unit = {
						division = "name = \"Córdova's Loyalists\" division_template = \"Córdova's Loyalists\" start_experience_factor = 0.6 start_equipment_factor = 1" 
						owner = PREV
					}
				}
				1071 = {
					create_unit = {
						division = "name = \"Córdova's Loyalists\" division_template = \"Córdova's Loyalists\" start_experience_factor = 0.6 start_equipment_factor = 1" 
						owner = PREV
					}
				}
				487 = {
					create_unit = {
						division = "name = \"Córdova's Loyalists\" division_template = \"Córdova's Loyalists\" start_experience_factor = 0.6 start_equipment_factor = 1" 
						owner = PREV
					}
				}
				1082 = {
					create_unit = {
						division = "name = \"Córdova's Loyalists\" division_template = \"Córdova's Loyalists\" start_experience_factor = 0.6 start_equipment_factor = 1" 
						owner = PREV
					}
				}
			}
		}
		1325 = {
			OWNER = {
				if = { 
					limit = { NOT = { has_country_leader = { name = "José Maria Linares" ruling_only = yes } } }
					create_country_leader = {
						name = "José Maria Linares"
						desc = "POLITICS_TEMP_DESC"
						picture = "Portrait_BOL_Jose_Maria_Linares.png"
						expire = 1870.1.1
						ideology = conserv_liberal 
					}
					generate_character = {
						token_base = BOL_Jose_Maria_Linares_temp
						name = BOL_Jose_Maria_Linares_temp
						portraits={
							civilian={
								large = GFX_Portrait_BOL_Jose_Maria_Linares
							}
						}
					}
					add_country_leader_role = {
						Character = BOL_Jose_Maria_Linares_temp
						Promote_leader = yes
						Country_leader = {
							ideology = conserv_liberal 
							expire = "1900.1.1"
						}
					}
					promote_character = BOL_Jose_Maria_Linares_temp
					promote_character = {
						character = BOL_Jose_Maria_Linares_temp
						Ideology = conserv_liberal 
					}
					set_country_leader_portrait = {
						portrait = GFX_Portrait_BOL_Jose_Maria_Linares
					}
				}
				division_template = {
					name = "Rebelión de Linares"
					priority = 1
					regiments = {
						line_infantry = { x = 0 y = 0 }
					}
					is_locked = yes
				}
				1325 = {
					create_unit = {
						division = "name = \"Rebelión de Linares\" division_template = \"Rebelión de Linares\" start_experience_factor = 0.6 start_equipment_factor = 1" 
						owner = PREV
					}
					create_unit = {
						division = "name = \"Rebelión de Linares\" division_template = \"Rebelión de Linares\" start_experience_factor = 0.6 start_equipment_factor = 1" 
						owner = PREV
					}
				}
				1322 = {
					create_unit = {
						division = "name = \"Rebelión de Linares\" division_template = \"Rebelión de Linares\" start_experience_factor = 0.6 start_equipment_factor = 1" 
						owner = PREV
					}
				}
				1095 = {
					create_unit = {
						division = "name = \"Rebelión de Linares\" division_template = \"Rebelión de Linares\" start_experience_factor = 0.6 start_equipment_factor = 1" 
						owner = PREV
					}
				}
				924 = {
					create_unit = {
						division = "name = \"Rebelión de Linares\" division_template = \"Rebelión de Linares\" start_experience_factor = 0.6 start_equipment_factor = 1" 
						owner = PREV
					}
				}
				1100 = {
					create_unit = {
						division = "name = \"Rebelión de Linares\" division_template = \"Rebelión de Linares\" start_experience_factor = 0.6 start_equipment_factor = 1" 
						owner = PREV
					}
				}
			}
		}
	}	
}

country_event = {
	id = bolivia.8
	title = bolivia.8.t
	desc = {
		text = bolivia.8.d
		trigger = { ROOT = { has_country_leader = { name = "José Maria Linares" ruling_only = yes } } }
	}
	desc = {
		text = bolivia.8.b
		trigger = { NOT = { ROOT = { has_country_leader = { name = "José Maria Linares" ruling_only = yes } } } }
	}
	
	fire_only_once = yes
	is_triggered_only = yes
	
	immediate = {	
		hidden_effect = {
			clr_country_flag = BOL_coup_is_original_tag
			if = {
				limit = { has_template = "Córdova's Loyalists" }
				delete_unit_template_and_units = {
					division_template = "Córdova's Loyalists"
					disband = no
				}
			}
			if = {
				limit = { has_template = "Rebelión de Linares" }
				delete_unit_template_and_units = {
					division_template = "Rebelión de Linares"
					disband = no
				}
			}
			if = { 
				limit = { 302 = { is_capital = no } }
				set_capital = {
					state = 302
				}
			}
			if = { 
				limit = { ROOT = { has_country_leader = { name = "José Maria Linares" ruling_only = yes } } }
				ROOT = {
					annex_country = {
						target = FROM
						transfer_troops = yes
					}
				}
			}
			else = {
				ROOT = {
					annex_country = {
						target = FROM
						transfer_troops = yes
					}
				}
			}
		}
	}
	
	option = {
		name = bolivia.8.a
		if = { 
			limit = { ROOT = { has_country_leader = { name = "José Maria Linares" ruling_only = yes } } }
			ROOT = {
				hidden_effect = { retire_country_leader = yes }
				set_politics = { ruling_party = centrism }
				create_country_leader = {
					name = "José Maria Linares"
					desc = "POLITICS_TEMP_DESC"
					picture = "Portrait_BOL_Jose_Maria_Linares.png"
					expire = 1870.1.1
					ideology = conserv_liberal 
				}
			}
		}
		else = {
			ROOT = {
				hidden_effect = { retire_country_leader = yes }
				set_politics = { ruling_party = traditional_conservatism }
				create_country_leader = {
					name = "Jorge Córdova"
					desc = "POLITICS_TEMP_DESC"
					picture = "GFX_Portrait_BOL_Jorge_Cordova"
					expire = 1870.1.1
					ideology = conserv
					}
				}
			}
		}	
	}