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

	<!-- ========== Trader ========== -->

	<Operation Class="PatchOperationAddModExtension">
		<xpath>Defs/PawnKindDef[defName="Empire_Common_Trader"]</xpath>
		<value>
			<li Class="CombatExtended.LoadoutPropertiesExtension">
				<primaryMagazineCount>
					<min>2</min>
					<max>3</max>
				</primaryMagazineCount>
				<sidearms>
					<li>
						<generateChance>0.3</generateChance>
						<sidearmMoney>
							<min>20</min>
							<max>140</max>
						</sidearmMoney>
						<weaponTags>
							<li>CE_Sidearm_Melee</li>
						</weaponTags>
					</li>
				</sidearms>
			</li>
		</value>
	</Operation>

	<!-- ========== Fighters ========== -->

	<!-- ====== Trooper ====== -->

	<Operation Class="PatchOperationAddModExtension">
		<xpath>Defs/PawnKindDef[defName="Empire_Fighter_Trooper"]</xpath>
		<value>
			<li Class="CombatExtended.LoadoutPropertiesExtension">
				<primaryMagazineCount>
					<min>3</min>
					<max>5</max>
				</primaryMagazineCount>
				<sidearms>
					<li>
						<generateChance>0.5</generateChance>
						<sidearmMoney>
							<min>150</min>
							<max>350</max>
						</sidearmMoney>
						<weaponTags>
							<li>CE_Sidearm_Melee</li>
						</weaponTags>
					</li>
					<li>
						<generateChance>0.175</generateChance>
						<sidearmMoney>
							<min>80</min>
							<max>160</max>
						</sidearmMoney>
						<weaponTags>
							<li>CE_FlareLauncher</li>
						</weaponTags>
						<magazineCount>
							<min>4</min>
							<max>8</max>
						</magazineCount>
					</li>
					<li>
						<generateChance>0.25</generateChance>
						<sidearmMoney>
							<min>10</min>
							<max>100</max>
						</sidearmMoney>
						<weaponTags>
							<li>GrenadeSmoke</li>
						</weaponTags>
						<magazineCount>
							<min>0</min>
							<max>1</max>
						</magazineCount>
					</li>
					<li>
						<generateChance>0.15</generateChance>
						<sidearmMoney>
							<min>10</min>
							<max>100</max>
						</sidearmMoney>
						<weaponTags>
							<li>GrenadeDestructive</li>
						</weaponTags>
						<magazineCount>
							<min>0</min>
							<max>0</max>
						</magazineCount>
					</li>
				</sidearms>
			</li>
		</value>
	</Operation>

	<!-- ====== Janissary ====== -->

	<!--removed gunlink-->

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/PawnKindDef[defName="Empire_Fighter_Janissary"]</xpath>
		<value>
			<apparelIgnoreSeasons>true</apparelIgnoreSeasons>
		</value>
	</Operation>

	<Operation Class="PatchOperationConditional">
		<xpath>Defs/PawnKindDef[defName="Empire_Fighter_Janissary"]/specificApparelRequirements/li[bodyPartGroup="UpperHead"]/alternateTagChoices/li[tag="Gunlink"]</xpath>
		<match Class="PatchOperationRemove">
			<xpath>Defs/PawnKindDef[defName="Empire_Fighter_Janissary"]/specificApparelRequirements/li[bodyPartGroup="UpperHead"]/alternateTagChoices/li[tag="Gunlink"]</xpath>
		</match>
	</Operation>

	<Operation Class="PatchOperationAddModExtension">
		<xpath>Defs/PawnKindDef[defName="Empire_Fighter_Janissary"]</xpath>
		<value>
			<li Class="CombatExtended.LoadoutPropertiesExtension">
				<primaryMagazineCount>
					<min>4</min>
					<max>6</max>
				</primaryMagazineCount>
				<sidearms>
					<li>
						<generateChance>0.5</generateChance>
						<sidearmMoney>
							<min>200</min>
							<max>400</max>
						</sidearmMoney>
						<weaponTags>
							<li>CE_Sidearm_Melee</li>
						</weaponTags>
					</li>
					<li>
						<generateChance>0.25</generateChance>
						<sidearmMoney>
							<min>10</min>
							<max>100</max>
						</sidearmMoney>
						<weaponTags>
							<li>GrenadeSmoke</li>
						</weaponTags>
						<magazineCount>
							<min>0</min>
							<max>1</max>
						</magazineCount>
					</li>
					<li>
						<generateChance>0.25</generateChance>
						<sidearmMoney>
							<min>10</min>
							<max>100</max>
						</sidearmMoney>
						<weaponTags>
							<li>GrenadeDestructive</li>
						</weaponTags>
						<magazineCount>
							<min>0</min>
							<max>0</max>
						</magazineCount>
					</li>
					<li>
						<generateChance>0.125</generateChance>
						<sidearmMoney>
							<min>80</min>
							<max>160</max>
						</sidearmMoney>
						<weaponTags>
							<li>CE_FlareLauncher</li>
						</weaponTags>
						<magazineCount>
							<min>2</min>
							<max>5</max>
						</magazineCount>
					</li>
				</sidearms>
			</li>
		</value>
	</Operation>

	<!-- ====== Champion ====== -->

	<Operation Class="PatchOperationAddModExtension">
		<xpath>Defs/PawnKindDef[defName="Empire_Fighter_Champion"]</xpath>
		<value>
			<li Class="CombatExtended.LoadoutPropertiesExtension">
				<shieldMoney>
					<min>620</min>
					<max>1200</max>
				</shieldMoney>
				<shieldTags>
					<li>OutlanderShield</li>
					<li>TribalShield</li>
				</shieldTags>
				<forceShieldMaterial>true</forceShieldMaterial> 
				<shieldMaterialFilter>
					<thingDefs>
						<li>Plasteel</li>
					</thingDefs>
				</shieldMaterialFilter>				
				<shieldChance>0.75</shieldChance>
			</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/PawnKindDef[defName="Empire_Fighter_Champion"]</xpath>
		<value>
			<apparelMoney>2500~3750</apparelMoney>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/PawnKindDef[defName="Empire_Fighter_Champion"]/apparelRequired</xpath>
		<value>
			<li>CE_Apparel_PlateHelmet</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationConditional">
		<xpath>Defs/PawnKindDef[defName="Empire_Fighter_Champion"]/specificApparelRequirements</xpath>
		<match Class="PatchOperationReplace">
			<xpath>Defs/PawnKindDef[defName="Empire_Fighter_Champion"]/specificApparelRequirements</xpath>
			<value>
				<specificApparelRequirements>
					<li>
						<bodyPartGroup>Torso</bodyPartGroup>
						<apparelLayer>Shell</apparelLayer>
						<stuff>Plasteel</stuff>
					</li>
					<li>
						<bodyPartGroup>FullHead</bodyPartGroup>
						<apparelLayer>Overhead</apparelLayer>
						<stuff>Plasteel</stuff>
					</li>
				</specificApparelRequirements>
			</value>
		</match>
		<nomatch Class="PatchOperationAdd">
			<xpath>Defs/PawnKindDef[defName="Empire_Fighter_Champion"]</xpath>
			<value>
				<specificApparelRequirements>
					<li>
						<bodyPartGroup>Torso</bodyPartGroup>
						<apparelLayer>Shell</apparelLayer>
						<stuff>Plasteel</stuff>
					</li>
					<li>
						<bodyPartGroup>FullHead</bodyPartGroup>
						<apparelLayer>Overhead</apparelLayer>
						<stuff>Plasteel</stuff>
					</li>
				</specificApparelRequirements>
			</value>
		</nomatch>
	</Operation>

	<!-- ====== Grenadier ====== -->

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/PawnKindDef[defName="Empire_Fighter_Grenadier"]</xpath>
		<value>
			<apparelIgnoreSeasons>true</apparelIgnoreSeasons>
		</value>
	</Operation>

	<Operation Class="PatchOperationConditional">
		<xpath>Defs/PawnKindDef[defName="Empire_Fighter_Grenadier"]/weaponTags/li[.="EmpireGrenadeDestructive"]</xpath>
		<match Class="PatchOperationReplace">
			<xpath>Defs/PawnKindDef[defName="Empire_Fighter_Grenadier"]/weaponTags/li[.="EmpireGrenadeDestructive"]</xpath>
			<value>
				<li>GunHeavy</li>
			</value>
		</match>
	</Operation>

	<Operation Class="PatchOperationAddModExtension">
		<xpath>Defs/PawnKindDef[defName="Empire_Fighter_Grenadier"]</xpath>
		<value>
			<li Class="CombatExtended.LoadoutPropertiesExtension">
				<primaryMagazineCount>
					<min>4</min>
					<max>6</max>
				</primaryMagazineCount>
				<weightedAmmoCategories>
					<GrenadeHE>0.5</GrenadeHE>
					<GrenadeHETF>0.25</GrenadeHETF>
					<GrenadeHEDP>0.25</GrenadeHEDP>
					<GrenadeEMP>0.1</GrenadeEMP>
				</weightedAmmoCategories>				
				<sidearms>
					<li>
						<generateChance>0.5</generateChance>
						<sidearmMoney>
							<min>300</min>
							<max>500</max>
						</sidearmMoney>
						<weaponTags>
							<li>CE_Sidearm_Melee</li>
						</weaponTags>
					</li>
					<li>
						<generateChance>0.1</generateChance>
						<sidearmMoney>
							<min>10</min>
							<max>100</max>
						</sidearmMoney>
						<weaponTags>
							<li>GrenadeSmoke</li>
						</weaponTags>
						<magazineCount>
							<min>1</min>
							<max>2</max>
						</magazineCount>
					</li>
					<li>
						<generateChance>0.1</generateChance>
						<sidearmMoney>
							<min>80</min>
							<max>160</max>
						</sidearmMoney>
						<weaponTags>
							<li>CE_FlareLauncher</li>
						</weaponTags>
						<magazineCount>
							<min>1</min>
							<max>3</max>
						</magazineCount>
					</li>
				</sidearms>
			</li>
		</value>
	</Operation>

	<!-- ====== Cataphracts ====== -->

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/PawnKindDef[@Name="CataphractBase"]</xpath>
		<value>
			<apparelIgnoreSeasons>true</apparelIgnoreSeasons>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/PawnKindDef[@Name="CataphractBase"]</xpath>
		<value>
			<minGenerationAge>18</minGenerationAge>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/PawnKindDef[defName="Empire_Fighter_Cataphract"]/weaponTags</xpath>
		<value>
			<li>Minigun</li>
		</value>
	</Operation>

	<!--removed gunlink-->

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/PawnKindDef[defName="Empire_Fighter_Cataphract"]/specificApparelRequirements/li[1]</xpath>
	</Operation>

	<Operation Class="PatchOperationAddModExtension">
		<xpath>Defs/PawnKindDef[defName="Empire_Fighter_Cataphract"]</xpath>
		<value>
			<li Class="CombatExtended.LoadoutPropertiesExtension">
				<primaryMagazineCount>
					<min>4</min>
					<max>6</max>
				</primaryMagazineCount>
				<weightedAmmoCategories>
					<FullMetalJacket>0.2</FullMetalJacket>
					<ArmorPiercing>0.2</ArmorPiercing>
					<HollowPoint>0.1</HollowPoint>
					<IncendiaryAP>0.33</IncendiaryAP>
					<ExplosiveAP>0.33</ExplosiveAP>
					<Sabot>0.25</Sabot>
				</weightedAmmoCategories>				
				<sidearms>
					<li>
						<generateChance>0.5</generateChance>
						<sidearmMoney>
							<min>300</min>
							<max>500</max>
						</sidearmMoney>
						<weaponTags>
							<li>CE_Sidearm_Melee</li>
						</weaponTags>
					</li>
					<li>
						<generateChance>0.8</generateChance>
						<sidearmMoney>
							<min>10</min>
							<max>100</max>
						</sidearmMoney>
						<weaponTags>
							<li>GrenadeSmoke</li>
						</weaponTags>
						<magazineCount>
							<min>1</min>
							<max>2</max>
						</magazineCount>
					</li>
					<li>
						<generateChance>0.8</generateChance>
						<sidearmMoney>
							<min>60</min>
							<max>160</max>
						</sidearmMoney>
						<weaponTags>
							<li>CE_GrenadeFlashbang</li>
							<li>GrenadeDestructive</li>
						</weaponTags>
						<magazineCount>
							<min>0</min>
							<max>1</max>
						</magazineCount>
					</li>
					<li>
						<generateChance>0.1</generateChance>
						<sidearmMoney>
							<min>80</min>
							<max>160</max>
						</sidearmMoney>
						<weaponTags>
							<li>CE_FlareLauncher</li>
						</weaponTags>
						<magazineCount>
							<min>1</min>
							<max>3</max>
						</magazineCount>
					</li>
				</sidearms>
			</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationAddModExtension">
		<xpath>Defs/PawnKindDef[defName="Empire_Fighter_StellicGuardRanged"]</xpath>
		<value>
			<li Class="CombatExtended.LoadoutPropertiesExtension">
				<primaryMagazineCount>
					<min>4</min>
					<max>6</max>
				</primaryMagazineCount>
				<weightedAmmoCategories>
					<FullMetalJacket>0.2</FullMetalJacket>
					<ArmorPiercing>0.2</ArmorPiercing>
					<HollowPoint>0.1</HollowPoint>
					<IncendiaryAP>0.33</IncendiaryAP>
					<ExplosiveAP>0.33</ExplosiveAP>
					<Sabot>0.25</Sabot>
				</weightedAmmoCategories>				
				<sidearms>
					<li>
						<generateChance>0.5</generateChance>
						<sidearmMoney>
							<min>400</min>
							<max>600</max>
						</sidearmMoney>
						<weaponTags>
							<li>CE_Sidearm_Melee</li>
						</weaponTags>
					</li>
					<li>
						<generateChance>0.8</generateChance>
						<sidearmMoney>
							<min>60</min>
							<max>160</max>
						</sidearmMoney>
						<weaponTags>
							<li>CE_GrenadeFlashbang</li>
						</weaponTags>
						<magazineCount>
							<min>0</min>
							<max>0</max>
						</magazineCount>
					</li>
					<li>
						<generateChance>0.8</generateChance>
						<sidearmMoney>
							<min>60</min>
							<max>160</max>
						</sidearmMoney>
						<weaponTags>
							<li>GrenadeSmoke</li>
						</weaponTags>
						<magazineCount>
							<min>0</min>
							<max>0</max>
						</magazineCount>
					</li>
				</sidearms>
			</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationAddModExtension">
		<xpath>Defs/PawnKindDef[defName="Empire_Fighter_StellicGuardMelee"]</xpath>
		<value>
			<li Class="CombatExtended.LoadoutPropertiesExtension">
				<shieldMoney>
					<min>1000</min>
					<max>1600</max>
				</shieldMoney>
				<shieldTags>
					<li>OutlanderShield</li>
				</shieldTags>
				<forceShieldMaterial>true</forceShieldMaterial> 
				<shieldMaterialFilter>
					<thingDefs>
						<li>Plasteel</li>
					</thingDefs>
				</shieldMaterialFilter>
				<shieldChance>0.5</shieldChance>
			</li>
		</value>
	</Operation>

	<!-- ========== Add Loadbearing Gear to Imperial Fighters ========== -->

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/PawnKindDef[@Name="ImperialFighterBase"]/specificApparelRequirements</xpath>
		<value>
			<li>
				<bodyPartGroup>Shoulders</bodyPartGroup>
				<apparelLayer>Backpack</apparelLayer>
				<stuff>Cloth</stuff>
			</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/PawnKindDef[defName="Empire_Fighter_Cataphract"]/specificApparelRequirements</xpath>
		<value>
			<li>
				<bodyPartGroup>Shoulders</bodyPartGroup>
				<apparelLayer>Backpack</apparelLayer>
				<stuff>Synthread</stuff>
			</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/PawnKindDef[@Name="StellicGuardBase"]/specificApparelRequirements</xpath>
		<value>
			<li>
				<bodyPartGroup>Shoulders</bodyPartGroup>
				<apparelLayer>Backpack</apparelLayer>
				<stuff>Hyperweave</stuff>
			</li>
		</value>
	</Operation>

</Patch>