<?xml version="1.0" encoding="utf-8"?>
<Patch>

	<!-- === Remove conflicting apparel layer === -->
	<Operation Class="PatchOperationRemove">
		<xpath>Defs/PawnKindDef[
			defName="Accurex_Medieval_Settlement_Grenadier" or defName="Accurex_Medieval_Settlement_Heavy_Infantry" or
			defName="Accurex_Medieval_Settlement_Crusader_M" or defName="Accurex_Medieval_Settlement_Crusader_R" or 
			defName="Accurex_Medieval_Settlement_Lord" or defName="Accurex_Medieval_Settlement_Ruler"
			]/apparelRequired/li[.="DankPyon_Apparel_Hauberk"]</xpath>
	</Operation>

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/PawnKindDef[
			defName="Accurex_Medieval_Settlement_Grenadier" or defName="Accurex_Medieval_Settlement_Heavy_Infantry" or
			defName="Accurex_Medieval_Settlement_Crusader_M" or defName="Accurex_Medieval_Settlement_Crusader_R" or 
			defName="Accurex_Medieval_Settlement_Lord" or defName="Accurex_Medieval_Settlement_Ruler"
			]/specificApparelRequirements/li[requiredTag="DankPyon_Apparel_Hauberk"]</xpath>
	</Operation>

	<!-- === Replace hard shield requirement === -->
	<Operation Class="PatchOperationRemove">
		<xpath>Defs/PawnKindDef[defName="Accurex_Medieval_Settlement_Heavy_Infantry"]/apparelRequired/li[.="DankPyon_ShieldHeater"]</xpath>
	</Operation>

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/PawnKindDef[defName="Accurex_Medieval_Settlement_Heavy_Infantry"]/specificApparelRequirements/li[requiredTag="DankPyon_ShieldHeater"]</xpath>
	</Operation>

	<!-- === Give backpack to melee pawn with shield chance === -->
	<Operation Class="PatchOperationAdd">
		<xpath>Defs/PawnKindDef[defName="Accurex_Medieval_Settlement_Heavy_Infantry"]/apparelRequired</xpath>
		<value>
			<li>CE_Apparel_TribalBackpack</li>
		</value>
	</Operation>

	<!-- === Give shields === -->
	<Operation Class="PatchOperationAddModExtension">
		<xpath>Defs/PawnKindDef[defName="Accurex_Medieval_Settlement_Heavy_Infantry"]</xpath>
		<value>
			<li Class="CombatExtended.LoadoutPropertiesExtension">
				<shieldMoney>100~350</shieldMoney>
				<shieldTags>
					<li>DankPyon_ShieldHeater</li>
				</shieldTags>
				<shieldChance>0.8</shieldChance>
			</li>
		</value>
	</Operation>

	<!-- === Give loadout === -->
	<Operation Class="PatchOperationAddModExtension">
		<xpath>Defs/PawnKindDef[
			defName="Accurex_Medieval_Settlement_Grenadier" or defName="Accurex_Medieval_Settlement_Crusader_R"]</xpath>
		<value>
			<li Class="CombatExtended.LoadoutPropertiesExtension">
				<primaryMagazineCount>12~20</primaryMagazineCount>
				<forcedSidearm>
					<sidearmMoney>100~200</sidearmMoney>
					<weaponTags>
						<li>NeolithicMeleeBasic</li>
						<li>MedievalMeleeDecent</li>
					</weaponTags>
				</forcedSidearm>
				<shieldMoney>100~350</shieldMoney>
				<shieldTags>
					<li>DankPyon_ShieldKite</li>
				</shieldTags>
				<shieldChance>0.5</shieldChance>
			</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/PawnKindDef[
			defName="Accurex_Medieval_Settlement_Grenadier" or defName="Accurex_Medieval_Settlement_Crusader_R"
			]/weaponTags</xpath>
		<value>
			<li>CE_XBow</li>
		</value>
	</Operation>

</Patch>