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

	<!-- ========== Replace stuff category for crafting ========== -->

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[@ParentName="BaseMeleeWeapon_Sharp" or @ParentName="BaseMeleeWeapon_Blunt" or @ParentName="BaseMeleeWeapon_Sharp_Quality" or @ParentName="BaseMeleeWeapon_Blunt_Quality"]/stuffCategories/li[.="Metallic"]</xpath>
		<value>
			<li>Metallic_Weapon</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_Knife" or defName="MeleeWeapon_Mace" or defName="MeleeWeapon_Gladius" or defName="MeleeWeapon_LongSword"]/stuffCategories/li[.="Woody"]</xpath>
	</Operation>

	<!-- ========== Knife ========== -->

	<!-- Patch stats -->

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_Knife"]/tools</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<label>handle</label>
					<capacities>
						<li>Poke</li>
					</capacities>
					<power>1</power>
					<chanceFactor>0.33</chanceFactor>
					<cooldownTime>1.26</cooldownTime>
					<armorPenetrationBlunt>0.250</armorPenetrationBlunt>
					<linkedBodyPartsGroup>Handle</linkedBodyPartsGroup>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>blade</label>
					<capacities>
						<li>Cut</li>
					</capacities>
					<power>10</power>
					<cooldownTime>1.18</cooldownTime>
					<armorPenetrationBlunt>0.36</armorPenetrationBlunt>
					<armorPenetrationSharp>0.32</armorPenetrationSharp>
					<linkedBodyPartsGroup>Blade</linkedBodyPartsGroup>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>point</label>
					<capacities>
						<li>Stab</li>
					</capacities>
					<power>11</power>
					<cooldownTime>1.2</cooldownTime>
					<armorPenetrationBlunt>0.25</armorPenetrationBlunt>
					<armorPenetrationSharp>0.42</armorPenetrationSharp>
					<linkedBodyPartsGroup>Point</linkedBodyPartsGroup>
				</li>
			</tools>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_Knife"]/statBases</xpath>
		<value>
			<Bulk>1</Bulk>
			<MeleeCounterParryBonus>0.15</MeleeCounterParryBonus>
			<!-- <StuffEffectMultiplierToughness>1</StuffEffectMultiplierToughness> --><!-- Same as apaprel thickness multiplier but for toughness -->
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_Knife"]</xpath>
		<value>
			<equippedStatOffsets>
				<MeleeCritChance>0.5</MeleeCritChance>
				<MeleeParryChance>0.15</MeleeParryChance>
				<MeleeDodgeChance>0.05</MeleeDodgeChance>
			</equippedStatOffsets>
		</value>
	</Operation>

	<!-- Add tags -->

	<Operation Class="PatchOperationConditional">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_Knife"]/weaponTags</xpath>
		<nomatch Class="PatchOperationAdd">
			<xpath>Defs/ThingDef[defName="MeleeWeapon_Knife"]</xpath>
			<value>
				<weaponTags />
			</value>
		</nomatch>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_Knife"]/weaponTags</xpath>
		<value>
			<li>CE_Sidearm_Melee</li>
			<li>CE_OneHandedWeapon</li>
		</value>
	</Operation>

	<!-- ========== Club ========== -->

	<!-- Patch stats -->

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_Club"]/tools</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<label>handle</label>
					<capacities>
						<li>Poke</li>
					</capacities>
					<power>4</power>
					<chanceFactor>0.33</chanceFactor>
					<cooldownTime>1.78</cooldownTime>
					<armorPenetrationBlunt>1</armorPenetrationBlunt>
					<linkedBodyPartsGroup>Handle</linkedBodyPartsGroup>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>head</label>
					<capacities>
						<li>Blunt</li>
					</capacities>
					<power>11</power>
					<cooldownTime>3.48</cooldownTime>
					<armorPenetrationBlunt>4</armorPenetrationBlunt>
					<linkedBodyPartsGroup>Head</linkedBodyPartsGroup>
				</li>
			</tools>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_Club"]/statBases</xpath>
		<value>
			<Bulk>4</Bulk>
			<MeleeCounterParryBonus>0.15</MeleeCounterParryBonus>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_Club"]</xpath>
		<value>
			<equippedStatOffsets>
				<MeleeCritChance>0.67</MeleeCritChance>
				<MeleeParryChance>0.15</MeleeParryChance>
				<MeleeDodgeChance>0.2</MeleeDodgeChance>
			</equippedStatOffsets>
		</value>
	</Operation>

	<!-- Add tags -->

	<Operation Class="PatchOperationConditional">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_Club"]/weaponTags</xpath>
		<nomatch Class="PatchOperationAdd">
			<xpath>Defs/ThingDef[defName="MeleeWeapon_Club"]</xpath>
			<value>
				<weaponTags />
			</value>
		</nomatch>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_Club"]/weaponTags</xpath>
		<value>
			<li>CE_Sidearm_Tribal</li>
			<li>CE_OneHandedWeapon</li>
		</value>
	</Operation>

	<!-- ========== Mace ========== -->

	<!-- Patch stats -->

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_Mace"]/tools</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<label>handle</label>
					<capacities>
						<li>Poke</li>
					</capacities>
					<power>2</power>
					<chanceFactor>0.33</chanceFactor>
					<cooldownTime>1.59</cooldownTime>
					<armorPenetrationBlunt>0.625</armorPenetrationBlunt>
					<linkedBodyPartsGroup>Handle</linkedBodyPartsGroup>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>head</label>
					<capacities>
						<li>Blunt</li>
					</capacities>
					<power>15</power>
					<cooldownTime>1.9</cooldownTime>
					<armorPenetrationBlunt>5.625</armorPenetrationBlunt>
					<linkedBodyPartsGroup>Head</linkedBodyPartsGroup>
				</li>
			</tools>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_Mace"]/statBases</xpath>
		<value>
			<Bulk>3.5</Bulk>
			<MeleeCounterParryBonus>0.24</MeleeCounterParryBonus>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_Mace"]</xpath>
		<value>
			<equippedStatOffsets>
				<MeleeCritChance>0.42</MeleeCritChance>
				<MeleeParryChance>0.24</MeleeParryChance>
				<MeleeDodgeChance>0.2</MeleeDodgeChance>
			</equippedStatOffsets>
		</value>
	</Operation>

	<!-- Add tags -->

	<Operation Class="PatchOperationConditional">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_Mace"]/weaponTags</xpath>
		<nomatch Class="PatchOperationAdd">
			<xpath>Defs/ThingDef[defName="MeleeWeapon_Mace"]</xpath>
			<value>
				<weaponTags />
			</value>
		</nomatch>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_Mace"]/weaponTags</xpath>
		<value>
			<li>CE_OneHandedWeapon</li>
		</value>
	</Operation>

	<!-- ========== Gladius ========== -->

	<!-- Patch stats -->

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_Gladius"]/tools</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<label>handle</label>
					<capacities>
						<li>Poke</li>
					</capacities>
					<power>2</power>
					<chanceFactor>0.33</chanceFactor>
					<cooldownTime>1.44</cooldownTime>
					<armorPenetrationBlunt>0.425</armorPenetrationBlunt>
					<linkedBodyPartsGroup>Handle</linkedBodyPartsGroup>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>point</label>
					<capacities>
						<li>Stab</li>
					</capacities>
					<power>27</power>
					<cooldownTime>1.44</cooldownTime>
					<armorPenetrationBlunt>0.425</armorPenetrationBlunt>
					<armorPenetrationSharp>0.48</armorPenetrationSharp>
					<linkedBodyPartsGroup>Point</linkedBodyPartsGroup>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>edge</label>
					<capacities>
						<li>Cut</li>
					</capacities>
					<power>20</power>
					<cooldownTime>1.34</cooldownTime>
					<armorPenetrationBlunt>0.956</armorPenetrationBlunt>
					<armorPenetrationSharp>0.43</armorPenetrationSharp>
					<linkedBodyPartsGroup>Edge</linkedBodyPartsGroup>
				</li>
			</tools>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_Gladius"]/statBases</xpath>
		<value>
			<Bulk>3.5</Bulk>
			<MeleeCounterParryBonus>0.35</MeleeCounterParryBonus>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_Gladius"]</xpath>
		<value>
			<equippedStatOffsets>
				<MeleeCritChance>0.2</MeleeCritChance>
				<MeleeParryChance>0.35</MeleeParryChance>
				<MeleeDodgeChance>0.2</MeleeDodgeChance>
			</equippedStatOffsets>
		</value>
	</Operation>

	<!-- Add tags -->

	<Operation Class="PatchOperationConditional">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_Gladius"]/weaponTags</xpath>
		<nomatch Class="PatchOperationAdd">
			<xpath>Defs/ThingDef[defName="MeleeWeapon_Gladius"]</xpath>
			<value>
				<weaponTags />
			</value>
		</nomatch>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_Gladius"]/weaponTags</xpath>
		<value>
			<li>CE_OneHandedWeapon</li>
		</value>
	</Operation>

	<!-- ========== Ikwa ========== -->

	<!-- Patch stats -->

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_Ikwa"]/tools</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<label>shaft</label>
					<capacities>
						<li>Blunt</li>
					</capacities>
					<power>3</power>
					<chanceFactor>0.33</chanceFactor>
					<cooldownTime>1.36</cooldownTime>
					<armorPenetrationBlunt>0.93</armorPenetrationBlunt>
					<linkedBodyPartsGroup>Shaft</linkedBodyPartsGroup>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>point</label>
					<capacities>
						<li>Poke</li>
					</capacities>
					<power>2</power>
					<chanceFactor>0.33</chanceFactor>
					<cooldownTime>1.54</cooldownTime>
					<armorPenetrationBlunt>0.55</armorPenetrationBlunt>
					<linkedBodyPartsGroup>Point</linkedBodyPartsGroup>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>head</label>
					<capacities>
						<li>Stab</li>
					</capacities>
					<power>22</power>
					<cooldownTime>1.54</cooldownTime>
					<armorPenetrationBlunt>0.55</armorPenetrationBlunt>
					<armorPenetrationSharp>0.46</armorPenetrationSharp>
					<linkedBodyPartsGroup>Head</linkedBodyPartsGroup>
				</li>
			</tools>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_Ikwa"]/statBases</xpath>
		<value>
			<Bulk>4</Bulk>
			<MeleeCounterParryBonus>0.58</MeleeCounterParryBonus>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_Ikwa"]</xpath>
		<value>
			<equippedStatOffsets>
				<MeleeCritChance>0.11</MeleeCritChance>
				<MeleeParryChance>0.23</MeleeParryChance>
				<MeleeDodgeChance>0.27</MeleeDodgeChance>
			</equippedStatOffsets>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_Ikwa"]/weaponTags</xpath>
		<value>
			<li>CE_OneHandedWeapon</li>
		</value>
	</Operation>

	<!-- ========== Spear ========== -->

	<!-- Patch stats -->

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_Spear"]/tools</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<label>shaft</label>
					<capacities>
						<li>Blunt</li>
					</capacities>
					<power>7</power>
					<cooldownTime>1.35</cooldownTime>
					<chanceFactor>0.15</chanceFactor>
					<armorPenetrationBlunt>2.25</armorPenetrationBlunt>
					<linkedBodyPartsGroup>Shaft</linkedBodyPartsGroup>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>shaft</label>
					<capacities>
						<li>Poke</li>
					</capacities>
					<power>4</power>
					<cooldownTime>1.78</cooldownTime>
					<chanceFactor>0.05</chanceFactor>
					<armorPenetrationBlunt>1</armorPenetrationBlunt>
					<linkedBodyPartsGroup>Point</linkedBodyPartsGroup>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>head</label>
					<capacities>
						<li>Stab</li>
					</capacities>
					<power>18</power>
					<cooldownTime>1.19</cooldownTime>
					<armorPenetrationBlunt>2.25</armorPenetrationBlunt>
					<armorPenetrationSharp>2.25</armorPenetrationSharp>
					<linkedBodyPartsGroup>Head</linkedBodyPartsGroup>
				</li>
			</tools>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_Spear"]/statBases</xpath>
		<value>
			<Bulk>10</Bulk>
			<MeleeCounterParryBonus>1.68</MeleeCounterParryBonus>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_Spear"]</xpath>
		<value>
			<equippedStatOffsets>
				<MeleeCritChance>0.17</MeleeCritChance>
				<MeleeParryChance>1.45</MeleeParryChance>
				<MeleeDodgeChance>0.9</MeleeDodgeChance>
			</equippedStatOffsets>
		</value>
	</Operation>

	<!-- ========== Longsword ========== -->

	<!-- Patch stats -->

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_LongSword"]/tools</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<label>handle</label>
					<capacities>
						<li>Poke</li>
					</capacities>
					<power>4</power>
					<cooldownTime>1.78</cooldownTime>
					<chanceFactor>0.10</chanceFactor>
					<armorPenetrationBlunt>1.0</armorPenetrationBlunt>
					<linkedBodyPartsGroup>Handle</linkedBodyPartsGroup>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>point</label>
					<capacities>
						<li>Stab</li>
					</capacities>
					<power>18</power>
					<cooldownTime>1.78</cooldownTime>
					<armorPenetrationBlunt>1.0</armorPenetrationBlunt>
					<armorPenetrationSharp>2.0</armorPenetrationSharp>
					<linkedBodyPartsGroup>Point</linkedBodyPartsGroup>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>edge</label>
					<capacities>
						<li>Cut</li>
					</capacities>
					<power>40</power>
					<cooldownTime>1.64</cooldownTime>
					<armorPenetrationBlunt>3.24</armorPenetrationBlunt>
					<armorPenetrationSharp>0.72</armorPenetrationSharp>
					<linkedBodyPartsGroup>Edge</linkedBodyPartsGroup>
				</li>
			</tools>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_LongSword"]/statBases</xpath>
		<value>
			<Bulk>8</Bulk>
			<MeleeCounterParryBonus>0.8</MeleeCounterParryBonus>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_LongSword"]</xpath>
		<value>
			<equippedStatOffsets>
				<MeleeCritChance>0.5</MeleeCritChance>
				<MeleeParryChance>0.6</MeleeParryChance>
				<MeleeDodgeChance>0.4</MeleeDodgeChance>
			</equippedStatOffsets>
		</value>
	</Operation>

	<!-- ========== Breach Axe ========== -->

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_BreachAxe"]/tools</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<label>handle</label>
					<capacities>
						<li>Poke</li>
					</capacities>
					<power>5</power>
					<cooldownTime>1.97</cooldownTime>
					<chanceFactor>0.1</chanceFactor>
					<armorPenetrationBlunt>1.500</armorPenetrationBlunt>
					<linkedBodyPartsGroup>Handle</linkedBodyPartsGroup>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>head</label>
					<capacities>
						<li>Demolish</li>
					</capacities>
					<power>17</power>
					<cooldownTime>2.65</cooldownTime>
					<armorPenetrationBlunt>3.375</armorPenetrationBlunt>
					<linkedBodyPartsGroup>Head</linkedBodyPartsGroup>
				</li>
			</tools>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_BreachAxe"]/statBases</xpath>
		<value>
			<Bulk>9.5</Bulk>
			<MeleeCounterParryBonus>0.20</MeleeCounterParryBonus>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="MeleeWeapon_BreachAxe"]</xpath>
		<value>
			<equippedStatOffsets>
				<MeleeCritChance>0.04</MeleeCritChance>
				<MeleeParryChance>0.15</MeleeParryChance>
				<MeleeDodgeChance>0.30</MeleeDodgeChance>
			</equippedStatOffsets>
		</value>
	</Operation>

</Patch>