﻿# 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

#handgonners = { # Vanilla added them to base lmao
#	type = archers
#	
#	damage = 50
#	toughness = 20
#	pursuit = 0
#	screen = 0
#	
#	
#	can_recruit = {
#		culture = { has_cultural_parameter = unlock_maa_handgonners }
#	}
#
#	terrain_bonus = {
#		hills = { damage = 10 }
#		plains = { toughness = -8 }
#		drylands = { toughness = -8 }
#		desert = { toughness = -8 }
#	}
#
#	counters = {
#		heavy_infantry = 1
#		heavy_cavalry = 1
#		archer_cavalry = 0.5
#	}
#
#	buy_cost = { gold = crossbowmen_recruitment_cost }
#	low_maintenance_cost = { gold = crossbowmen_low_maint_cost }
#	high_maintenance_cost = { gold = crossbowmen_high_maint_cost }
#	provision_cost = @provisions_cost_infantry_moderate
#
#	holy_order_fallback = yes
#
#	stack = 100
#	ai_quality = {
#		value = counter_synergy_ai_weight_archers
#	}
#	icon = handgonners
#}

redcoats = {
	type = gunpowder

	damage = 60
	toughness = 28
	pursuit = 0
	screen = 10

	can_recruit = {
		gunpowder_raise_limit_existing_gunpowder_units < gunpowder_raise_limit_existing_gunpowder_buildings	# one powder magazine must be owned to support three handgunner regiments, regardless of maa size
		culture = { has_cultural_parameter = unlock_late_medieval_gunpowder_units }
		valid_for_maa_trigger = { PARAMETER = unlock_maa_redcoats }
	}

	terrain_bonus = {
		wetlands = { damage = -10 }
		floodplains = { damage = -5 }
	}

	counters = {
		heavy_infantry = 1
		heavy_cavalry = 1
		pikemen = 1 
	}

	buy_cost = { gold = conrois_recruitment_cost }
	low_maintenance_cost = { gold = conrois_low_maint_cost }
	high_maintenance_cost = { gold = conrois_high_maint_cost }
	provision_cost = @provisions_cost_infantry_bankrupting

	ai_quality = {
		value = counter_synergy_ai_weight_gunpowder
	}

	stack = 100

	icon = handgonne

}


ironsides = {
	type = heavy_cavalry
	
	damage = 135
	toughness = 60
	pursuit = 0
	screen = 10
	
	terrain_bonus = {
		plains = { damage = 30 toughness = 5 }
		drylands = { damage = 20 }
		hills = { damage = -10 }
		terraced_hills = { damage = -10 }
		mountains = { damage = -50 }
		desert_mountains = { damage = -50 }
		wetlands = { damage = -70 toughness = -15 pursuit = -10 }
		jungle = { damage = -80 toughness = -15 pursuit = -10 }
	}

	counters = {
		archers = 1
		heavy_infantry = 2
		skirmishers  = 2
		chemical_weapons = 1
		heavy_cavalry = 1
	}

	winter_bonus = {
		normal_winter = { damage = -15 toughness = -5 }
		harsh_winter = { damage = -30 toughness = -10 }
	}
	
	can_recruit = {
		valid_for_maa_trigger = { PARAMETER = unlock_maa_ironsides }
	}

	buy_cost = { gold = tiefutu_recruitment_cost }
	low_maintenance_cost = { gold = tiefutu_low_maint_cost }
	high_maintenance_cost = { gold = tiefutu_high_maint_cost }
	provision_cost = @provisions_cost_cavalry_bankrupting
	
	stack = 50
	ai_quality = { value = @cultural_maa_extra_ai_score }

	icon = tiefutu_cavalry
}


cuirassiers  = { #Copy pasted Conrois, need to think of how to make them unique later
	type = heavy_cavalry

	damage = 90
	toughness = 20
	pursuit = 25
	screen = 0

	terrain_bonus = {
		plains = { damage = 30 }
		drylands = { damage = 30 }
		farmlands = { damage = 30 }
		hills = { damage = -20 }
		mountains = { damage = -75 }
		desert_mountains = { damage = -75 }
		wetlands = { damage = -75 toughness = -10 pursuit = -10 }
		jungle = { damage = -75 toughness = -10 pursuit = -10 }
	}

	counters = {
		archers = 1
		light_cavalry = 1
		skirmishers = 1
		chemical_weapons = 1
	}

	can_recruit = {
		valid_for_maa_trigger = { PARAMETER = unlock_maa_cuirassiers }
	}

	winter_bonus = {
		normal_winter = { damage = -15 toughness = -5 }
		harsh_winter = { damage = -25 toughness = -10 }
	}

	buy_cost = { gold = conrois_recruitment_cost }
	low_maintenance_cost = { gold = conrois_low_maint_cost }
	high_maintenance_cost = { gold = conrois_high_maint_cost }
	provision_cost = @provisions_cost_cavalry_cheap

	stack = 50
	ai_quality = { value = @[cultural_maa_extra_ai_score + 35 ] }
	icon = conrois
}

columneers = {
	type = archers
	can_recruit = {
		valid_for_maa_trigger = { PARAMETER = unlock_maa_columneers }
	}
	
	damage = 18
	toughness = 20
	pursuit = 0
	screen = 22
	
	terrain_bonus = {
		hills = { damage = 12 toughness = 4 }
	}

	counters = {
		archers = 1
		skirmishers= 1
		chemical_weapons = 1
		peasant_militia = 1
		pikemen = 1
	}

	buy_cost = { gold = longbowmen_recruitment_cost }
	low_maintenance_cost = { gold = longbowmen_low_maint_cost }
	high_maintenance_cost = { gold = longbowmen_high_maint_cost }
	provision_cost = @provisions_cost_infantry_moderate
	
	stack = 100
	ai_quality = { value = @cultural_maa_extra_ai_score }
	icon = bowmen
}

pioneers = {
	type = heavy_infantry

	damage = 40
	toughness = 32
	pursuit = 10
	screen = 10
	siege_value = 0.1

	terrain_bonus = {
		farmlands = { damage = 8 }
		plains = { damage = 8 toughness = 6 }
		forest = { damage = 8 toughness = 6 }
	}

	counters = {
		pikemen = 1
		peasant_militia = 2
		heavy_infantry = 1
		archers = 1
	}

	can_recruit = {
		valid_for_maa_trigger = { PARAMETER = unlock_maa_pioneers }
	}

	buy_cost = { gold = varangian_guards_recruitment_cost }
	low_maintenance_cost = { gold = varangian_guards_low_maint_cost }
	high_maintenance_cost = { gold = varangian_guards_high_maint_cost }
	provision_cost = @provisions_cost_infantry_moderate

	stack = 100
	ai_quality = { value = @cultural_maa_extra_ai_score }
	icon = heavy_infantry
}


gardians = {
	type = light_cavalry
	
	damage = 30
	toughness = 10
	pursuit = 30
	screen = 30
	
	terrain_bonus = {
		hills = { damage = 10 }
		mountains = { pursuit = -30 }
		desert_mountains = { damage = -15 pursuit = -30 }
		wetlands = { damage = 5 pursuit = 5 screen = 5 }
	}

	counters = {
		archers = 1
		heavy_infantry = 1
	}

	winter_bonus = {
		normal_winter = { damage = -3 }
		harsh_winter = { damage = -5 toughness = -2 }
	}

	buy_cost = { gold = hobelar_recruitment_cost }
	low_maintenance_cost = { gold = hobelar_low_maint_cost }
	high_maintenance_cost = { gold = hobelar_high_maint_cost }
	provision_cost = @provisions_cost_cavalry_cheap
	
	stack = 100
	ai_quality = { value = @cultural_maa_extra_ai_score }
	icon = light_cavalry
}

voltigeurs = {
	type = archers
	
	damage = 25
	toughness = 20
	pursuit = 5
	screen = 20
	siege_value = 0.1
	
	terrain_bonus = {
		hills = { damage = 4 toughness = 6 }
		mountains = { damage = 4 pursuit = 6 }
		forest = { damage = 4 toughness = 8 pursuit = 4 }
		wetlands = { damage = 4 pursuit = 6 }
	}

	counters = {
		heavy_infantry = 1
	}

	buy_cost = { gold = guanch_vaulter_recruitment_cost }
	low_maintenance_cost = { gold = guanch_vaulter_low_maint_cost }
	high_maintenance_cost = { gold = guanch_vaulter_high_maint_cost }
	provision_cost = @provisions_cost_infantry_moderate
	
	
	stack = 100
	ai_quality = { value = culture_ai_weight_skirmishers }
	icon = bowmen
}

spahis = {
	type = horse_archers
	
	damage = 36
	toughness = 18
	pursuit = 40
	screen = 30
	
	terrain_bonus = {
		drylands = { damage = 15 toughness = 3 }
		desert = { damage = 10 }
		oasis = { damage = 10 }
		desert_mountains = { pursuit = -10 }
		mountains = { pursuit = -20 }
		wetlands = { damage = -10 toughness = -10 pursuit = -30 screen = -30 }
	}

	counters = {
		skirmishers = 1
		chemical_weapons = 1
		heavy_infantry = 1
	}

	buy_cost = { gold = horse_archers_recruitment_cost }
	low_maintenance_cost = { gold = horse_archers_low_maint_cost }
	high_maintenance_cost = { gold = horse_archers_high_maint_cost }
	provision_cost = @provisions_cost_cavalry_cheap
	
	stack = 100
	ai_quality = {
		value = @cultural_maa_extra_ai_score
		add = 60 #I mean... they're horse archers
	}
	icon = horse_archers
}

NEOW_militia = {
	type = peasant_militia

	damage = 12
	toughness = 16
	pursuit = 10
	screen = 4

	terrain_bonus = {
		mountains = { toughness = 8 }
		desert_mountains = { toughness = 8 }
		hills = { toughness = 4 }
		farmlands = { toughness = 8 }
		floodplains = { toughness = 8 }
		terraced_hills = { toughness = 8 }
	}

	counters = {
		light_cavalry = 1
		heavy_cavalry = 0.5
		camel_cavalry = 1
	}
	can_recruit = {
		OR = {
			AND = {
				militia_raise_limit_existing_militia_units < militia_raise_limit_existing_militia_buildings
				OR = {
					has_trait = education_martial_1
					has_trait = education_martial_2
					has_trait = education_martial_3
					has_trait = education_martial_4
					has_trait = education_martial_5
					has_trait = peasant_leader
					has_trait = heresiarch
					has_trait = populist_leader
					has_lifestyle = martial_lifestyle
					has_martial_lifestyle_trait_trigger = yes
					cp:councillor_marshal = { martial = 13 }
				}
			}
			can_recruit_militia = yes
		}
	}

	buy_cost = { gold = militia_recruitment_cost }
	low_maintenance_cost = { gold = militia_low_maint_cost }
	high_maintenance_cost = { gold = militia_high_maint_cost }
	provision_cost = @provisions_cost_infantry_cheap
	stack = 200
	ai_quality = { value = culture_ai_weight_skirmishers }

	illustration = {
		trigger = {
			should_use_asian_maa_graphics = yes
		}
		reference = pikemen_militia_asia
	}
	illustration = {
		reference = pikemen_militia
	}
	icon = pikemen_militia
}

carabineers = {
	type = gun_cavalry
	
	damage = 60
	toughness = 18
	pursuit = 30
	screen = 25
	
	terrain_bonus = {
		steppe = { damage = 45 }
		plains = { damage = 20 }
		drylands = { damage = 20 }
		jungle = { damage = -20 pursuit = -20 }
		wetlands = { damage = -30 pursuit = -30 }
		mountains = { damage = -30 pursuit = -30 }
		desert_mountains = { damage = -30 pursuit = -30 }
	}

	counters = {
		skirmishers = 1
		chemical_weapons = 1
		heavy_infantry = 1
	}

	can_recruit = {
		gunpowder_raise_limit_existing_gunpowder_units < gunpowder_raise_limit_existing_gunpowder_buildings	# one powder magazine must be owned to support three handgunner regiments, regardless of maa size
		culture = { has_cultural_parameter = unlock_late_medieval_gunpowder_units }
	}

	buy_cost = { gold = horse_archers_recruitment_cost }
	low_maintenance_cost = { gold = horse_archers_low_maint_cost }
	high_maintenance_cost = { gold = horse_archers_high_maint_cost }
	provision_cost = @provisions_cost_cavalry_cheap
	
	stack = 100
	ai_quality = {
		value = @cultural_maa_extra_ai_score
		add = 60 #I mean... they're horse archers
	}
	illustration = {
		reference = horse_gunmen_ill
	}
	icon = horse_gunmen
}

cowboys = {
	type = gun_cavalry
	
	damage = 60
	toughness = 18
	pursuit = 40
	screen = 15
	
	terrain_bonus = {
		steppe = { damage = 45 }
		plains = { damage = 20 }
		drylands = { damage = 20 }
		jungle = { damage = -20 pursuit = -20 }
		wetlands = { damage = -30 pursuit = -30 }
		mountains = { damage = -30 pursuit = -30 }
		desert_mountains = { damage = -30 pursuit = -30 }
	}

	counters = {
		skirmishers = 1
		chemical_weapons = 1
		heavy_infantry = 1
	}

	can_recruit = {
		gunpowder_raise_limit_existing_gunpowder_units < gunpowder_raise_limit_existing_gunpowder_buildings	# one powder magazine must be owned to support three handgunner regiments, regardless of maa size
		culture = { has_cultural_parameter = unlock_maa_kuhjung }
	}

	buy_cost = { gold = horse_archers_recruitment_cost }
	low_maintenance_cost = { gold = horse_archers_low_maint_cost }
	high_maintenance_cost = { gold = horse_archers_high_maint_cost }
	provision_cost = @provisions_cost_cavalry_cheap
	
	stack = 100
	ai_quality = {
		value = @cultural_maa_extra_ai_score
		add = 60 #I mean... they're horse archers
	}
	illustration = {
		reference = horse_gunmen_ill
	}
	icon = horse_gunmen
}

full_plate_footmen = {
	type = super_heavy_infantry

	damage = 45
	toughness = 50
	pursuit = 0
	screen = 24

	counters = {
		pikemen = 1
		light_cavalry = 1
		peasant_militia = 2
		skirmishers = 1
	}

	can_recruit = {
		culture = {
			has_innovation = innovation_plate_armor
		}
		NOR = {
			government_has_flag = government_is_nomadic
			government_has_flag = government_is_herder
		}
	}

	should_show_when_unavailable = {
		government_allows = subject_men_at_arms
	}

	terrain_bonus = {
		jungle = { damage = -40 toughness = -40 }
		terraced_hills = { damage = -20 toughness = -20 }
		mountains = { damage = -20 toughness = -20 }
		desert_mountains = { damage = -20 toughness = -20 }
		wetlands = { damage = -30 toughness = -30 }
	}
	buy_cost = { gold = super_heavy_infantry_recruitment_cost }
	low_maintenance_cost = { gold = super_heavy_infantry_low_maint_cost }
	high_maintenance_cost = { gold = super_heavy_infantry_high_maint_cost }
	provision_cost = @provisions_cost_infantry_moderate


	stack = 100
	ai_quality = {
		value = culture_ai_weight_heavy_infantry
		add = counter_synergy_ai_weight_heavy_infantry
	}


	illustration = {
		reference = ill_super_heavy_infantry
	}
	icon = super_heavy_infantry
}

toxic_gas_slingers = {
	type = chemical_weapons

	damage = 40
	toughness = 12
	pursuit = 10
	screen = 16

	terrain_bonus = {
		forest = { damage = 4 toughness = 6 }
		taiga = { damage = 4 toughness = 6 }
		jungle = { damage = 4 toughness = 6 }
	}

	counters = {
		heavy_infantry = 1
		pikemen = 1
		peasant_militia = 2
		super_heavy_infantry = 2
	}

	can_recruit = {
		toxic_gas_slingers_raise_limit_existing_toxic_gas_slingers_units < toxic_gas_slingers_raise_limit_existing_toxic_gas_slingers_buildings
	}
	
	illustration = {
		reference = ill_chemical_weapons
	}

	should_show_when_unavailable = {
		government_allows = subject_men_at_arms
	}

	buy_cost = { gold = chemical_weapons_recruitment_cost }
	low_maintenance_cost = { gold = chemical_weapons_low_maint_cost }
	high_maintenance_cost = { gold = chemical_weapons_high_maint_cost }
	provision_cost = @provisions_cost_infantry_cheap

	stack = 50
	ai_quality = { value = culture_ai_weight_skirmishers }
	icon = chemical_weapons
}
airships = {
	type = airship
	
	damage = 250
	toughness = 100
	pursuit = 0
	screen = 250
	
	siege_value = 0.5
	
	terrain_bonus = {
		jungle = { damage = -35 toughness = 20 }
		terraced_hills = { damage = -35 }
		mountains = { damage = -100 }
		desert_mountains = { damage = -100 }
		hills = { damage = -35 }
		forest = { damage = -35 toughness = 20 }
	}

	winter_bonus = {
		normal_winter = { damage = -30 toughness = -10 }
		harsh_winter = { damage = -60 toughness = -15 }
	}

	buy_cost = { gold = airship_recruitment_cost }
	low_maintenance_cost = { gold = airship_low_maint_cost }
	high_maintenance_cost = { gold = airship_high_maint_cost }
	provision_cost = @provisions_cost_cavalry_bankrupting
	
	can_recruit = {
		airships_raise_limit_existing_airships_units < airships_raise_limit_existing_airships_buildings
	}
	
	illustration = {
		reference = ill_airship
	}
	stack = 20
	ai_quality = { value = culture_ai_weight_elephants }
	icon = airship
}

guides = {
	type = light_cavalry
	
	damage = 25
	toughness = 8
	pursuit = 35
	screen = 35
	
	terrain_bonus = {
		wetlands = { damage = 5 pursuit = 5 screen = 5 }
		plains = { damage = 15 }
		drylands = { damage = 15 }
		hills = { damage = -5 }
		mountains = { damage = -20 pursuit = -20 }
		desert_mountains = { damage = -15 pursuit = -30 }
	}

	counters = {
		archers = 1
		skirmishers = 1
	}

	winter_bonus = {
		normal_winter = { damage = -3 }
		harsh_winter = { damage = -5 toughness = -2 }
	}

	buy_cost = { gold = hobelar_recruitment_cost }
	low_maintenance_cost = { gold = hobelar_low_maint_cost }
	high_maintenance_cost = { gold = hobelar_high_maint_cost }
	provision_cost = @provisions_cost_cavalry_cheap
	
	stack = 100
	ai_quality = { value = @cultural_maa_extra_ai_score }
	icon = light_cavalry
}
