# standard costs
@maa_buy_cost = 150
@maa_low_maintenance_cost = 1.0
@maa_high_maintenance_cost = 5.0
@cultural_maa_extra_ai_score = 80 # Equivalent to having 8 extra regiments beyond what the code scoring would indicate (see NEGATIVE_SCORE_PER_EXISTING_REGIMENT)

# Must be synced between files with the values located at "# Provisions Costs #".
@provisions_cost_infantry_cheap = 3
@provisions_cost_infantry_moderate = 7
@provisions_cost_infantry_expensive = 12
@provisions_cost_infantry_bankrupting = 15

@provisions_cost_cavalry_cheap = 7
@provisions_cost_cavalry_moderate = 15
@provisions_cost_cavalry_expensive = 21
@provisions_cost_cavalry_bankrupting = 30

@provisions_cost_special_cheap = 6
@provisions_cost_special_moderate = 12
@provisions_cost_special_expensive = 18
@provisions_cost_special_bankrupting = 24

nomadic_riders = {
	type = nomadic_horde
	
	damage = 12
	toughness = 12
	pursuit = 10
	screen = 15
	
	terrain_bonus = {
		steppe = { damage = 8 pursuit = 10 }
		plains = { damage = 4 pursuit = 6 }
		drylands = { damage = 4 pursuit = 6 }
	}
	
	# No cost as this is the basic type of MAA given by converting your Herd
	provision_cost = @provisions_cost_cavalry_cheap

	# Prevents this MaA type from being shown in the interface
	# Nomadic Riders are always created and raised from code
	special_recruit_only = yes

	illustration = {
		trigger = {
			OR = {
				government_has_flag = government_is_nomadic
				government_has_flag = government_is_true_herder
			}
		}
		reference = nomadic_riders
	}
	illustration = {
		reference = light_cavalry
	}
	stack = 100
	# No AI for the same reason as above
	icon = nomadic_riders
}

torch_bearers = {
	type = siege_weapon
	fights_in_main_phase = no
	
	damage = 20
	toughness = 12
	
	siege_tier = 1
	siege_value = 0.1

	can_recruit = {
		government_has_flag = government_is_nomadic
	}
	
	holding_bonus = {
		nomad_holding = {
			siege_value = 0.3
		}
		tribal_holding = {
			siege_value = 0.1
		}
	}

	buy_cost = { gold = torch_bearers_recruitment_cost }
	low_maintenance_cost = { gold = torch_bearers_low_maint_cost }
	high_maintenance_cost = { gold = torch_bearers_high_maint_cost }
	provision_cost = @provisions_cost_special_cheap
	
	stack = 10
	allowed_in_hired_troops = no
	icon = torch_bearers
}

kheshig = {
	type = archer_cavalry
	
	damage = 94
	toughness = 60
	pursuit = 24
	screen = 36
	
	terrain_bonus = {
		steppe = { damage = 90 screen = 20 }
		plains = { damage = 50 screen = 10 }
		drylands = { damage = 20 }
		jungle = { damage = -40 pursuit = -20 }
		wetlands = { damage = -70 pursuit = -40 }
		mountains = { damage = -70 pursuit = -40 }
		desert_mountains = { damage = -70 pursuit = -40 }
	}
	
	can_recruit = {
		dynasty ?= { has_dynasty_perk = mpo_nomad_legacy_4 }
	}

	counters = {
		light_cavalry = 1
		heavy_cavalry = 0.5
		elephant_cavalry = 1
	}

	max_regiments = 1

	buy_cost = { gold = kheshig_recruitment_cost }
	low_maintenance_cost = { gold = kheshig_veterans_low_maint_cost }
	high_maintenance_cost = { gold = kheshig_veterans_high_maint_cost }
	provision_cost = @provisions_cost_cavalry_cheap

	stack = 50
	ai_quality = { value = 100 }
	icon = keshig
}

steppe_raiders = {
	type = light_cavalry
	
	damage = 22
	toughness = 15
	pursuit = 30
	screen = 30
	
	terrain_bonus = {
		steppe = { damage = 15 }
		plains = { damage = 15 }
		drylands = { damage = 15 }
		desert = { damage = 10 }
		forest = { damage = 5 }
		taiga = { damage = 5 }
		mountains = { damage = -5 pursuit = -10 }
		desert_mountains = { damage = -5 pursuit = -10 }
		wetlands = { damage = -10 toughness = -5 pursuit = -15 screen = -15 }
	}
	
	counters = {
		archers = 1
		gunpowder = 1
	}

	can_recruit = {
		mpo_can_recruit_nomad_maa_trigger = yes
	}

	buy_cost = { gold = steppe_raiders_recruitment_cost }
	low_maintenance_cost = { gold = steppe_raiders_low_maint_cost }
	high_maintenance_cost = { gold = steppe_raiders_high_maint_cost }
	provision_cost = @provisions_cost_cavalry_cheap

	holy_order_fallback = yes

	stack = 100
	ai_quality = { 
		value = culture_ai_weight_light_cavalry
		add = counter_synergy_ai_weight_light_cavalry
		add = -20
	}
	icon = steppe_raiders
}

heavy_horse_archers = {
	type = archer_cavalry
	
	damage = 92
	toughness = 42
	pursuit = 24
	screen = 24
	
	terrain_bonus = {
		steppe = { damage = 80 }
		plains = { damage = 40 }
		forest = { damage = -20 pursuit = -10 }
		taiga = { damage = -20 pursuit = -10 }
		jungle = { damage = -50 pursuit = -25 }
		wetlands = { damage = -85 pursuit = -40 }
		mountains = { damage = -85 pursuit = -40 }
		desert_mountains = { damage = -85 pursuit = -40 }
	}

	can_recruit = {
		mpo_can_recruit_nomad_maa_trigger = yes
		trigger_if = {
			limit = {
				government_has_flag = government_is_nomadic
				exists = domicile
			}
			domicile = {
				has_domicile_parameter = unlock_maa_heavy_horse_archers
			}
		}
	}

	counters = {
		light_cavalry = 1
		elephant_cavalry = 1
	}

	winter_bonus = {
		normal_winter = { damage = -10 toughness = -5 }
		harsh_winter = { damage = -20 toughness = -10 }
	}

	buy_cost = { gold = heavy_horse_archers_recruitment_cost }
	low_maintenance_cost = { gold = heavy_horse_archers_low_maint_cost }
	high_maintenance_cost = { gold = heavy_horse_archers_high_maint_cost }
	provision_cost = @provisions_cost_cavalry_expensive
	
	stack = 50
	ai_quality = {
		value = @cultural_maa_extra_ai_score
		add = 100 #I mean... they're horse archers
	}
	icon = heavy_horse_archers
}

nomad_lancers = {
	type = heavy_cavalry
	
	damage = 120
	toughness = 30
	pursuit = 20
	screen = 0
	
	terrain_bonus = {
		steppe = { damage = 50 }
		plains = { damage = 40 }
		drylands = { damage = 10 }
		hills = { damage = -20 }
		mountains = { damage = -75 }
		desert_mountains = { damage = -75 }
		wetlands = { damage = -75 toughness = -10 pursuit = -10 }
	}

	can_recruit = {
		mpo_can_recruit_nomad_heavy_cavalry_maa_trigger = yes
		NOT = {
			culture = { has_cultural_parameter = strength_in_numbers_heavy_maa_ban }
		}
	}

	counters = {
		archers = 0.5
		gunpowder = 0.5
	}

	winter_bonus = {
		normal_winter = { damage = -10 toughness = -5 }
		harsh_winter = { damage = -20 toughness = -10 }
	}

	buy_cost = { gold = nomad_lancers_recruitment_cost }
	low_maintenance_cost = { gold = nomad_lancers_low_maint_cost }
	high_maintenance_cost = { gold = nomad_lancers_high_maint_cost }
	provision_cost = @provisions_cost_cavalry_expensive
	
	stack = 50
	ai_quality = {
		value = culture_ai_weight_heavy_cavalry
		add = 100
	}
	icon = nomad_lancers
}

mangudai = {
	type = archer_cavalry
	
	damage = 50
	toughness = 6
	pursuit = 60
	screen = 10
	
	terrain_bonus = {
		steppe = { damage = 45 }
		plains = { damage = 20 }
		hills = { damage = 10 }
		mountains = { damage = -10 pursuit = -10 }
		jungle = { damage = -20 pursuit = -20 }
		wetlands = { damage = -30 pursuit = -30 }
		desert_mountains = { damage = -30 pursuit = -30 }
	}

	counters = {
		#pikemen = 0.5
		peasant_militia = 2
		#heavy_infantry = 1
	}
	
	can_recruit = {
		valid_for_maa_trigger = { PARAMETER = unlock_maa_mangudai }
	}

	buy_cost = { gold = mangudai_recruitment_cost }
	low_maintenance_cost = { gold = mangudai_low_maint_cost }
	high_maintenance_cost = { gold = mangudai_high_maint_cost }
	provision_cost = @provisions_cost_cavalry_cheap
	
	stack = 100
	ai_quality = {
		value = @cultural_maa_extra_ai_score
	}
	icon = mangudai
}

cataphract_archers = {
	type = heavy_cavalry
	
	damage = 90
	toughness = 52
	pursuit = 20
	screen = 10
	
	terrain_bonus = {
		steppe = { damage = 40 }
		drylands = { damage = 40 }
		plains = { damage = 40 }
		hills = { damage = -20 }
		desert_mountains = { damage = -50 }
		mountains = { damage = -75 }
		wetlands = { damage = -75 toughness = -10 pursuit = -10 }
	}

	can_recruit = {
		valid_for_maa_trigger = { PARAMETER = unlock_maa_cataphract_archers }
		#Either non-nomadic or has some dominance
		NOT = {
			culture = { has_cultural_parameter = strength_in_numbers_heavy_maa_ban }
		}
		OR = {
			NOT = {
				government_has_flag = government_is_nomadic
			}
			has_realm_law_flag = unlock_maa_nomad_lancers
		}
	}

	counters = {
		archer_cavalry = 1
		archers = 1
		#gunpowder = 0.5
	}

	winter_bonus = {
		normal_winter = { damage = -10 toughness = -5 }
		harsh_winter = { damage = -20 toughness = -10 }
	}

	buy_cost = { gold = cataphract_archers_recruitment_cost }
	low_maintenance_cost = { gold = cataphract_archers_low_maint_cost }
	high_maintenance_cost = { gold = cataphract_archers_high_maint_cost }
	provision_cost = @provisions_cost_cavalry_expensive
	
	stack = 50
	ai_quality = {
		value = @cultural_maa_extra_ai_score
		add = 200
	}
	icon = cataphract_archers
}

maturkan_warriors = {
	type = archers
	
	damage = 16
	toughness = 15
	pursuit = 0
	screen = 16
	
	terrain_bonus = {
		taiga = { damage = 12 toughness = 6 }
		forest = { damage = 10 toughness = 4 }
		hills = { damage = 6 toughness = 3 }
		mountains = { damage = 6 toughness = 3 }
	}

	counters = {
		skirmishers = 1
	}
	
	winter_bonus = {
		harsh_winter = { toughness = 6 screen = 12 }
		normal_winter = { toughness = 4 screen = 8 }
	}

	can_recruit = {
		valid_for_maa_trigger = { PARAMETER = unlock_maa_maturkan_warriors }
	}

	buy_cost = { gold = maturkan_warriors_recruitment_cost }
	low_maintenance_cost = { gold = maturkan_warriors_low_maint_cost }
	high_maintenance_cost = { gold = maturkan_warriors_high_maint_cost }
	provision_cost = @provisions_cost_infantry_cheap
	
	stack = 100
	ai_quality = {
		value = @cultural_maa_extra_ai_score
		add = counter_synergy_ai_weight_archers
	}
	icon = maturkan_warriors
}
