# -*- ck2.combat_tactics -*-

### At the moment we have a pretty basic icon system for combat tactics showing
### the uniticon which has the biggest bonus value in the tactic.
### This is the sprite number for each unit:
### Good 	 1=LI	 2=HI	 3=PIKE	 4=LC	 5=KNIGHTS	 6=ARCHERS	 7=HORSE ARCH.	 8=GALLEY	 9=ELEPHANT	10=CAMEL
### Neutral 11=LI	12=HI	13=PIKE	14=LC	15=KNIGHTS	16=ARCHERS	17=HORSE ARCH.	18=GALLEY	19=ELEPHANT	20=CAMEL
### Bad 	21=LI	22=HI	23=PIKE	24=LC	25=KNIGHTS	26=ARCHERS	27=HORSE ARCH.	28=GALLEY	29=ELEPHANT	30=CAMEL

#
# Tactics based off the following Lodge retinues info:
# Mazdan Lodge: light_cavalry + horse_archers 				120 + 130
# Eastern Lodge: archers + war_elephants 					200 + 20
# Aztec Lodge: light_infantry + heavy_infantry				375 + 125
# Muslim Lodge: camel_cavalry								250
# Jewish Lodge: heavy_infantry								200

#Call to Glory - Mazdan "Sunburst Tactic" - Mazdan/Iranian (horse_archers)
glorious_ws_mazdan_tactic = {
	days = 6
	sprite = 1
	group = defensive

	trigger = {
		phase = melee
		horse_archers = 0.05
		leader = {
			has_character_modifier = call_to_glory
			society_member_of = warrior_lodge_ws_mazdan
			NOR = {
				any_current_enemy = { has_opinion_modifier = { who = PREV modifier = opinion_honorable_combat } }
				AND = { 
					OR = { 
						is_ruler = no 
						is_playable = no
					}
					liege = { any_current_enemy = { has_opinion_modifier = { who = PREV modifier = opinion_honorable_combat } } }
				}
			}
		}
		location = { 
			NOT = { terrain = forest }
			# NOT = { terrain = woods }
			# NOT = { terrain = mountain }
			NOT = { terrain = impassable_mountains }
			NOT = { terrain = jungle }
			NOT = { terrain = marsh }
		}
	}

	mean_time_to_happen = {
		days = 15
		modifier = {
			factor = 2
			flank_has_leader = yes
			leader = {
				martial = 10
			}
			light_troops = {
				who = horse_archers
				value = 0.3
			}
		}
		modifier = {
			factor = 2
			flank_has_leader = yes
			leader = {
				martial = 4
			}
			light_troops = {
				who = horse_archers
				value = 0.4
			}
		}
	}
	
	change_phase_to = skirmish
	
	horse_archers_offensive =  3.0
	light_cavalry_offensive = 1.8
}

#Call to Glory - Eastern "Charge of the Elephants" - Eastern (archers and war_elephants)
glorious_ws_eastern_tactic = {
	days = 10
	sprite = 5
	group = charge

	trigger = {
		phase = skirmish
		is_flanking = no
		
		OR = {
			war_elephants = 0.01
			knights = 0.2
		}
		leader = {
			has_character_modifier = call_to_glory
			society_member_of = warrior_lodge_ws_eastern
		}
		
		days = 10 # duration of combat >= 10 days
	}

	mean_time_to_happen = {
		days = 2 # this has nothing to do with days, it just represents relative chance of selecting this tactic, higher is better
		modifier = {
			factor = 3
			flank_has_leader = yes
			leader = {
				martial = 8
			}
			war_elephants = 0.04
		}
		modifier = {
			factor = 3
			flank_has_leader = yes
			leader = {
				martial = 12
			}
			war_elephants = 0.03
		}
		modifier = {
			factor = 3
			flank_has_leader = yes
			leader = {
				martial = 18
			}
			war_elephants = 0.02
		}
		modifier = {
			factor = 8
			flank_has_leader = yes
			leader = {
				martial = 18
			}
			troops = {
				who = knights
				value = 0.4
			}
		}
	}

	change_phase_to = melee

	archers_offensive = 2.75
	archers_defensive = 1.25
	knights_offensive = 1.75
	war_elephants_offensive = 4.5
}

#Call to Glory - Aztec "Eagles' Last Stand" Tactic - Aztec (light_infantry and heavy_infantry)
glorious_ws_aztec_tactic = {
	days = 18
	sprite = 3
	group = stand_fast

	trigger = {
		phase = melee
		light_infantry = 0.01
		leader = {
			has_character_modifier = call_to_glory
			society_member_of = warrior_lodge_ws_aztec
		}
	}

	mean_time_to_happen = {
		days = 15
		modifier = {
			factor = 1.5
			flank_has_leader = yes
			leader = {
				martial = 8
			}
			light_troops = { 
				who = light_infantry
				value = 0.7
			}
		}
		modifier = {
			factor = 1.5
			flank_has_leader = yes
			leader = {
				martial = 12
			}
			light_troops = { 
				who = light_infantry
				value = 0.6
			}
		}
		modifier = {
			factor = 1.5
			flank_has_leader = yes
			leader = {
				martial = 16
			}
			light_troops = { 
				who = light_infantry
				value = 0.5
			}
		}
	}

	light_infantry_offensive = 1.25
	light_infantry_defensive = 2.5
	light_cavalry_defensive = 1.25
	heavy_infantry_offensive = 1.25
	heavy_infantry_defensive = 1.5

	enemy = {
		group = charge
		factor = 3
	}
}

#Call to Glory - Muslim "Crescent Ambush" - Muslim (camel_cavalry)
glorious_ws_muslim_tactic = {
	days = 18
	sprite = 3
	group = stand_fast

	trigger = {
		phase = melee
		OR = {
			light_cavalry = 0.1
			camel_cavalry = 0.1
		}
		light_infantry = 0.1
		leader = {
			has_character_modifier = call_to_glory
			society_member_of = warrior_lodge_ws_muslim
		}
	}

	mean_time_to_happen = {
		days = 3
		modifier = {
			factor = 3.5
			flank_has_leader = yes
			leader = {
				martial = 10
			}
			OR = {
				troops = { 
					who = light_cavalry
					value = 0.2
				}
				troops = { 
					who = camel_cavalry
					value = 0.2
				}
			}
			troops = { 
				who = light_infantry
				value = 0.2
			}
		}
		modifier = {
			factor = 3
			flank_has_leader = yes
			leader = {
				martial = 10
				trait = trickster
			}
			OR = {
				troops = { 
					who = light_cavalry
					value = 0.2
				}
				troops = { 
					who = camel_cavalry
					value = 0.2
				}
			}
			troops = { 
				who = light_infantry
				value = 0.2
			}
		}
	}

	light_cavalry_offensive = 1.8
	camel_cavalry_offensive = 3.4
	light_infantry_offensive = 1.2
	horse_archers_offensive = 1.2
	archers_offensive = 1.2
	enemy = {
		group = advance
		factor = 3
	}
}

#Call to Glory - Jewish "Faithfuls' Last Stand" - Jewish (heavy_infantry)
glorious_ws_jewish_tactic = {
	days = 18
	sprite = 3
	group = stand_fast

	trigger = {
		phase = melee
		heavy_infantry = 0.01
		leader = {
			has_character_modifier = call_to_glory
			society_member_of = warrior_lodge_ws_jewish
		}
	}

	mean_time_to_happen = {
		days = 15
		modifier = {
			factor = 1.5
			flank_has_leader = yes
			leader = {
				martial = 8
			}
			heavy_troops = { 
				who = heavy_infantry
				value = 0.7
			}
		}
		modifier = {
			factor = 1.5
			flank_has_leader = yes
			leader = {
				martial = 12
			}
			heavy_troops = { 
				who = heavy_infantry
				value = 0.6
			}
		}
		modifier = {
			factor = 1.5
			flank_has_leader = yes
			leader = {
				martial = 16
			}
			heavy_troops = { 
				who = heavy_infantry
				value = 0.5
			}
		}
	}

	heavy_infantry_offensive = 1.25
	heavy_infantry_defensive = 2.5
	light_infantry_defensive = 1.25

	enemy = {
		group = charge
		factor = 3
	}
}
