###############################
# Gothic war events
#
# Written by just_a_beaver
#
# gothic_war.1 -> gothic_war.5
###############################

namespace = gothic_war

# Resurgence of Ostrogoths under Totila
character_event = {
	id = gothic_war.1
	desc = gothic_war.1.desc
	picture = GFX_evt_warband_on_hill
	
	has_character_flag = gothic_war
	
	trigger = {
		character = 190118 # Totila
		year = 541
		NOT = { year = 542 }
	}
	
	mean_time_to_happen = {
		months = 1
	}
	
	option = { # Totila decides to rally troops to his cause.
		name = gothic_war.1.a
		ai_chance = {
			factor = 60
			modifier = {
				factor = 1.6
				OR = {
					trait = zealous
					trait = proud
					trait = ambitious
					trait = brave
					trait = wroth
				}
			}
			modifier = {
				factor = 0.5
				OR = {
					trait = craven
					is_weak_trigger = yes
					trait = content
					is_dumb_trigger = yes
				}
			}
		}
		set_global_flag = gothic_war
		spawn_unit = {
			province = 351 # Ravenna
			owner = ROOT
			leader = ROOT
			troops = {
				light_infantry = { 1238 1238 }
				heavy_infantry = { 497 497 }
				knights = { 315 315 }
				light_cavalry = { 512 512 }
				archers = { 376 376 }
			}
			attrition = 1.0
		}
		spawn_unit = {
			province = 351 # Ravenna
			owner = ROOT
			#leader = 83100702 # Thuruar
			troops = {
				light_infantry = { 1238 1238 }
				heavy_infantry = { 497 497 }
				knights = { 315 315 }
				light_cavalry = { 512 512 }
				archers = { 376 376 }
			}
			attrition = 1.0
		}
		spawn_unit = {
			province = 351 # Ravenna
			owner = ROOT
			#leader = 83100576 # Beremud of Vicenza
			troops = {
				light_infantry = { 1238 1238 }
				heavy_infantry = { 497 497 }
				knights = { 315 315 }
				light_cavalry = { 512 512 }
				archers = { 376 376 }
			}
			attrition = 1.0
		}
		spawn_unit = {
			province = 351 # Ravenna
			owner = ROOT
			#leader = 83100651 # Walahrabns?
			troops = {
				light_infantry = { 1238 1238 }
				heavy_infantry = { 497 497 }
				knights = { 315 315 }
				light_cavalry = { 512 512 }
				archers = { 376 376 }
			}
			attrition = 1.0
			merge = yes
		}
	}
	option = { # He'd rather not cause more trouble.
		name = gothic_war.1.b
		ai_chance = {
			factor = 40
			modifier = {
				factor = 1.5
				OR = {
					trait = craven
					trait = content
					is_weak_trigger = yes
					is_dumb_trigger = yes
				}
			}
			modifier = {
				factor = 0.3
				OR = {
					trait = zealous
					trait = proud
					trait = ambitious
					trait = brave
					trait = wroth
				}
			}
		}
		e_byzantium = {
			holder_scope = {
				opinion = {
					modifier = opinion_delighted
					who = ROOT
					years = 1
				}
			}
		}
	}
}

# Justinian learns of Totila's resurgence.
character_event = {
	id = gothic_war.2
	desc = gothic_war.2.desc
	picture = GFX_evt_throne_room_byzantine
	
	has_character_flag = gothic_war
	
	trigger = {
		character = 70512
		year = 541
		NOT = { year = 542 }
	}
	
	mean_time_to_happen = {
		months = 1
	}
	
	option = { # Give Narses an Army
		name = gothic_war.2.a
		ai_chance = {
			factor = 60
			modifier = {
				factor = 1.6
				OR = {
					trait = proud
					trait = zealous
					trait = brave
					trait = wroth
					trait = cruel
					trait = ambitious
				}
			}
			modifier = {
				factor = 0.6
				OR = {
					trait = craven
					trait = content
				}
			}
		}
		set_global_flag = gothic_war
		spawn_unit = {
			province = 467 # Split
			owner = ROOT
			leader = 444402 # Narses
			troops = {
				light_infantry = { 1738 1738 }
				heavy_infantry = { 256 256 }
				knights = { 1642 1642 }
				horse_archers = { 675 675 }
				archers = { 117 117 }
			}
			attrition = 1.0
		}
		spawn_unit = {
			province = 467 # Split
			owner = ROOT
			leader = 70512 # Justinian I
			troops = {
				light_infantry = { 1738 1738 }
				heavy_infantry = { 256 256 }
				knights = { 1642 1642 }
				horse_archers = { 675 675 }
				archers = { 117 117 }
			}
			attrition = 1.0
		}
		spawn_unit = {
			province = 467 # Split
			owner = ROOT
			#leader = 83100018 # Maximus Leg. IV Italica
			troops = {
				light_infantry = { 1738 1738 }
				heavy_infantry = { 256 256 }
				knights = { 1642 1642 }
				horse_archers = { 675 675 }
				archers = { 117 117 }
			}
			attrition = 1.0
		}
		spawn_unit = {
			province = 467 # Split
			owner = ROOT
			#leader = 83100013 # Valerius
			troops = {
				light_infantry = { 1738 1738 }
				heavy_infantry = { 256 256 }
				knights = { 1642 1642 }
				horse_archers = { 675 675 }
				archers = { 117 117 }
			}
			attrition = 1.0
			merge = yes
		}
		spawn_fleet = {
			province = 467 # Split
			owner = ROOT
			earmark = narses_expedition_flotilla
			disband_on_peace = yes
			troops = {
				galleys = { 180 180 }
			}
		}
	}
	option = { # Sue for peace.
		name = gothic_war.2.b
		ai_chance = {
			factor = 30
			modifier = {
				factor = 1.3
				OR = {
					trait = craven
					is_weak_trigger = yes
				}
			}
		}
		add_trait = craven
	}
	option = { # Do nothing.
		name = gothic_war.2.c
		ai_chance = {
			factor = 10
			modifier = {
				factor = 1.3
				OR = {
					is_weak_trigger = yes
					is_dumb_trigger = yes
				}
			}
			modifier = {
				factor = 0.3
				OR = {
					trait = zealous
					trait = proud
					trait = wroth
					trait = ambitious
					trait = cruel
					trait = brave
				}
			}
		}
		any_realm_lord = {
			opinion = {
				modifier = opinion_shocked
				who = ROOT
				years = 4
			}
		}
	}
}

# Ostrogoths force ruling Amal dynasty to convert to Ostrogothic.
# Fires for the holder of k_ostrogoths
character_event = {
	id = gothic_war.3
	desc = gothic_war.3.desc
	picture = GFX_evt_emissary
	
	only_rulers = yes
	culture = ostrogothic
	
	trigger = {
		year = 535
		has_landed_title = k_ostrogoths
		any_realm_lord = {
			culture = romano_gothic
		}
		always = no # Melting-pot conflict
	}
	
	mean_time_to_happen = {
		years = 1
	}
	
	option = { # Member refuses to convert
		name = gothic_war.3.a
		ai_chance = {
			factor = 60
			modifier = {
				factor = 1.6
				OR = {
					trait = roman_nostalgia
					trait = proud
					trait = zealous
				}
			}
			modifier = {
				factor = 1.5
				k_ostrogoths = {
					holder_scope = {
						culture = romano_gothic
					}
				}
			}
			modifier = {
				factor = 0.6
				OR = {
					trait = scholar # Scholars are more knowledgeable about different cultures therefore they are more likely to convert.
					trait = craven
				}
			}
			modifier = {
				factor = 0.3
				k_ostrogoths = {
					holder_scope = {
						culture = ostrogothic
					}
				}
			}
		}
		any_realm_lord = {
			limit = { culture = ostrogothic }
			opinion = {
				modifier = opinion_shocked
				who = ROOT
				years = 3
			}
		}
		add_trait = roman_nostalgia
	}
	option = { # Member agrees to convert to Ostrogothic.
		name = gothic_war.3.b
		ai_chance = {
			factor = 40
			modifier = {
				factor = 1.6
				OR = {
					trait = scholar
					trait = craven
				}
			}
			modifier = {
				factor = 1.5
				k_ostrogoths = {
					holder_scope = {
						culture = ostrogothic
					}
				}
			}
			modifier = {
				factor = 0.6
				OR = {
					trait = roman_nostalgia
					trait = proud
					trait = zealous
				}
			}
			modifier = {
				factor = 0.3
				k_ostrogoths = {
					holder_scope = {
						culture = romano_gothic
					}
				}
			}
		}
		any_realm_lord = {
			limit = { culture = ostrogothic }
			opinion = {
				modifier = opinion_delighted
				who = ROOT
				years = 2
			}
		}
		culture = ostrogothic
	}
}

# Amal dynasty forces Ostrogoth nobles to become Romano-Goths
# Fires for the holder of k_ostrogoths
character_event = {
	id = gothic_war.4
	desc = gothic_war.4.desc
	picture = GFX_evt_emissary
	
	only_rulers = yes
	culture = romano_gothic
	
	trigger = {
		year = 535
		has_landed_title = k_ostrogoths
		any_realm_lord = {
			culture = ostrogothic
		}
		always = no # Melting-pot conflict
	}
	
	mean_time_to_happen = {
		years = 1
	}
	
	option = { # Ostrogoth Noble refuses to convert cultures.
		name = gothic_war.4.a
		ai_chance = {
			factor = 60
			modifier = {
				factor = 1.6
				OR = {
					trait = proud
					trait = zealous
					#trait = gothic_loyalist
					trait = brave
				}
			}
			modifier = {
				factor = 1.5
				k_ostrogoths = {
					holder_scope = {
						culture = ostrogothic
					}
				}
			}
			modifier = {
				factor = 0.6
				OR = {
					trait = craven
					trait = scholar
				}
			}
		
			modifier = {
				factor = 0.3
				k_ostrogoths = {
					holder_scope = {
						culture = romano_gothic
					}
				}
			}
		}
		any_realm_lord = {
			limit = { culture = romano_gothic }
			opinion = {
				modifier = opinion_shocked
				who = ROOT
				years = 4
			}
		}
		#add_trait = gothic_loyalist
	}
	option = { # Ostrogothic Noble agrees to change culture.
		name = gothic_war.4.b
		ai_chance = {
			factor = 40
			modifier = {
				factor = 1.6
				OR = {
					trait = scholar
					trait = craven
				}
			}
			modifier = {
				factor = 1.5
				k_ostrogoths = {
					holder_scope = {
						culture = romano_gothic
					}
				}
			}
			modifier = {
				factor = 0.6
				OR = {
					trait = proud
					trait = zealous
					trait = brave
				}
			}
			modifier = {
				factor = 0.3
				k_ostrogoths = {
					holder_scope = {
						culture = ostrogothic
					}
				}
			}
		}
		any_realm_lord = {
			limit = { culture = romano_gothic }
			opinion = {
				modifier = opinion_delighted
				who = ROOT
				years = 2
			}
		}
		culture = romano_gothic
	}
}

# Visigothic Nobles force liege to convert to Visigothic culture.
# Fires for the holder of k_visigoths
character_event = {
	id = gothic_war.5
	desc = gothic_war.5.desc
	picture = GFX_evt_throne_room
	
	only_rulers = yes
	culture = visigothic
	
	trigger = {
		year = 490
		has_landed_title = k_visigoths
		any_realm_lord = {
			culture = romano_hispanic
		}
		always = no # Melting-pot conflict
	}
	
	mean_time_to_happen = {
		years = 1
	}
	
	option = { # Noble refuses to convert to Visigothic
		name = gothic_war.5.a
		ai_chance = {
			factor = 60
			modifier = {
				factor = 1.6
				OR = {
					trait = proud
					trait = zealous
					trait = brave
					trait = roman_nostalgia
				}
			}
			modifier = {
				factor = 1.5
				k_visigoths = {
					holder_scope = {
						culture = romano_hispanic
					}
				}
			}
			modifier = {
				factor = 0.6
				OR = {
					trait = craven
					trait = scholar
				}
			}
			modifier = {
				factor = 0.3
				k_visigoths = {
					holder_scope = {
						culture = visigothic
					}
				}
			}
		}
		any_realm_lord = {
			limit = { culture = visigothic }
			opinion = {
				modifier = opinion_shocked
				who = ROOT
				years = 4
			}
		}
		add_trait = roman_nostalgia
	}
	option = { # Vassal agrees to convert to Visigothic.
		name = gothic_war.5.b
		ai_chance = {
			factor = 40
			modifier = {
				factor = 1.6
				OR = {
					trait = craven
					trait = scholar
				}
			}
			modifier = {
				factor = 1.5
				k_visigoths = {
					holder_scope = {
						culture = visigothic
					}
				}
			}
			modifier = {
				factor = 0.6
				OR = {
					trait = proud
					trait = brave
					trait = zealous
					trait = roman_nostalgia
				}
			}
			modifier = {
				factor = 0.3
				k_visigoths = {
					holder_scope = {
						culture = romano_hispanic
					}
				}
			}
		}
		any_realm_lord = {
			limit = { culture = visigothic }
			opinion = {
				modifier = opinion_delighted
				who = ROOT
				years = 2
			}
		}
		culture = visigothic
	}
}
