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.299
	desc = "EVTDESCmechfl.2"
	is_triggered_only = yes
	hide_window = yes
	
	trigger = {
		war = yes
		has_artifact = mech_suit
		in_command = yes
		ai = yes
		NOT = { trait = maimed }
		NOT = { trait = wounded }
		NOT = { has_character_modifier = usedmech }
	}

	option = {
		name = mechfl.atk1
		ai_chance = {factor = 100}
		if = {
		
			martial <= 15
			limit = {NOT = {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.10
					}
			}
		}		
		
		if = {
		
			martial >= 15
			any_current_enemy = {
				limit = { in_command = yes at_location = ROOT}
				troops = -0.25
				}
			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 = 5
				character_event = { id = mechfl_siege.99 }
			}
				
		}
		
		hidden_tooltip = {
				add_character_modifier = { modifier = usedmech duration = 20}
			} 
	}
}

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

character_event = {

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

	option = {
		name = mechfl.atk1
		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.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.10
					}
			}
		}		
		
		if = {
		
			martial >= 15
			any_current_enemy = {
				limit = { in_command = yes at_location = ROOT}
			random = {
				chance = 25
				add_trait = wounded
			}
			random = {
				chance = 15
				add_trait = maimed
			}
				troops = -0.25
				}
			any_current_enemy = {
				any_realm_lord = {
					limit = { in_command = yes at_location = ROOT}
			random = {
				chance = 25
				add_trait = wounded
			}
			random = {
				chance = 15
				add_trait = maimed
			}
					troops = -0.10
					}
				any_courtier = {
					limit = { in_command = yes at_location = ROOT}
			random = {
				chance = 25
				add_trait = wounded
			}
			random = {
				chance = 15
				add_trait = maimed
			}
					troops = -0.15
				}
			}
		}
		
		if = {
		
			limit = {trait = wounded }
		hidden_tooltip = {			
			random = {
				chance = 10
				character_event = { id = mechfl.oops5 } 
				}
			}
		
		}
		
		if = {
			limit = { NOT = { trait = maimed } NOT = { trait = wounded } }
			random = {
				chance = 5
				character_event = { id = mechfl_siege.99 }
			}
				
		}
		
		hidden_tooltip = {
				add_character_modifier = { modifier = usedmech duration = 30 }
			}	 
	}
}


###Use Mech Defend###
##		Working		##
#Heals friendly morale

character_event = {

	id = mechfl.3
	desc = "EVTDESCmechfl.3"
	border = GFX_event_normal_frame_war
	picture = GFX_mech_defend
	is_triggered_only = yes
	
	potential = {
		NOT = { has_character_modifier = usedmech }
		has_artifact = mech_suit
	}
	option = {
		name = mechfl.def1
		morale = 0.5
		hidden_tooltip = {
				add_character_modifier = { modifier = usedmech duration = 30 }
			}
	}
}



###Use Mech Defend AI###
##		Working		##
#Heals friendly morale AI version

character_event = {

	id = mechfl.399
	desc = "EVTDESCmechfl.3"
	is_triggered_only = yes
	hide_window = yes
	
	trigger = {
		war = yes
		has_artifact = mech_suit
		in_command = yes
		ai = yes
		NOT = { has_character_modifier = usedmech }
		morale > 50
	}
	
	option = {
		name = mechfl.def1
		ai_chance = { factor = 100 }
		morale = 0.5	
	}
	hidden_tooltip = {
		add_character_modifier = { modifier = usedmech duration = 30 }
	}
}
