namespace = mechfl

#####Directory#####

###Use Mech Field Combat AI version###
###Use Mech Field Combat###

#####High Pri Events to do#####
#None
#####LOWPRI#####


########################Start#########################


###Use Mech Combat AI version###
##		Working		##
#AI triggered automatically

character_event = {

	id = mechfl.3005
	desc = "EVTDESCmechfl.2"
	is_triggered_only = yes
	hide_window = yes
	
	trigger = {
		war = yes
		has_artifact = common_mech_suit
		in_command = yes
		ai = yes
		NOT = { trait = maimed }
		NOT = { trait = wounded }
		NOT = { has_character_modifier = usedmech }
	}

	option = {
		name = mechfl.atk3
		ai_chance = {factor = 100}
		if = {
		
			martial <= 15
			limit = {NOT = {martial >= 15}}
			any_current_enemy = {
				limit = { in_command = yes at_location = ROOT}
				troops = -0.10
				}
			any_current_enemy = {
				any_realm_lord = {
					limit = { in_command = yes at_location = ROOT}
					troops = -0.05
					}
				any_courtier = {
					limit = { in_command = yes at_location = ROOT}
					troops = -0.05
					}
			}
		}		
		
		if = {
		
			martial >= 15
			any_current_enemy = {
				limit = { in_command = yes at_location = ROOT}
				troops = -0.15
				}
			any_current_enemy = {
				any_realm_lord = {
					limit = { in_command = yes at_location = ROOT}
					troops = -0.10
					}
				any_courtier = {
					limit = { in_command = yes at_location = ROOT}
					troops = -0.15
				}
			}
		}
		
		if = {
		
			limit = {trait = wounded }
			
			random = {
				chance = 50
				add_trait = maimed
				
			}
		
		}
		
		if = {
			limit = { NOT = { trait = maimed } NOT = { trait = wounded } }
			random = {
				chance = 25
				character_event = { id = mechfl_siege.99 }
			}
				
		}
		
		hidden_tooltip = {
				add_character_modifier = { modifier = usedmech duration = 30}
			} 
	}
}

###Use Mech Field Combat###
##		Working		##
#User triggered via decision menu

character_event = {

	id = mechfl.4
	desc = "EVTDESCmechfl.2"
	picture = GFX_mech_fight
	border = GFX_event_normal_frame_war
	is_triggered_only = yes

	option = {
		name = mechfl.atk3
		if = {
		
			martial <= 15
			limit = {NOT = {martial >= 15}}
			any_current_enemy = {
				limit = { in_command = yes at_location = ROOT}
			random = {
				chance = 15
				add_trait = wounded
			}
				troops = -0.10
				}
			any_current_enemy = {
				any_realm_lord = {
					limit = { in_command = yes at_location = ROOT}
			random = {
				chance = 15
				add_trait = wounded
			}
					troops = -0.05
					}
				any_courtier = {
					limit = { in_command = yes at_location = ROOT}
			random = {
				chance = 15
				add_trait = wounded
			}
					troops = -0.05
					}
			}
		}		
		
		if = {
		
			martial >= 15
			any_current_enemy = {
				limit = { in_command = yes at_location = ROOT}
			random = {
				chance = 15
				add_trait = wounded
			}
				troops = -0.15
				}
			any_current_enemy = {
				any_realm_lord = {
					limit = { in_command = yes at_location = ROOT}
			random = {
				chance = 15
				add_trait = wounded
			}
					troops = -0.10
					}
				any_courtier = {
					limit = { in_command = yes at_location = ROOT}
			random = {
				chance = 15
				add_trait = wounded
			}
					troops = -0.15
				}
			}
		}
		
		if = {
		
			limit = {trait = wounded }
		hidden_tooltip = {			
			random = {
				chance = 15
				character_event = { id = mechfl.oops5 } 
				}
			}
		
		}
		
		if = {
			limit = { NOT = { trait = maimed } NOT = { trait = wounded } }
			random = {
				chance = 25
				character_event = { id = mechfl_siege.99 }
			}
				
		}
		
		hidden_tooltip = {
				add_character_modifier = { modifier = usedmech duration = 30 }
			}	 
	}
}

####DESTROYED MECH SUIT####
	character_event = {
		id = mechfl.oops5
		desc = "EVTDESCmechfl.oops5"
		border = GFX_event_normal_frame_war
		picture = GFX_roy_aftermath
	
		is_triggered_only = yes
	
		option = { 
		name = "mechfl.oops5" 
			add_trait = severely_injured 
			random_artifact = { 
				limit = { has_artifact_flag = mecha_suit
					is_artifact_active = yes }
				unsafe_destroy_artifact = yes }
			random = {
				chance = 15
				add_trait = one_legged
			}
		}
}