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

	<!-- ========= Fleshling ============ -->

	<Operation Class="PatchOperationAddModExtension">
		<xpath>Defs/ThingDef[defName="GR_Fleshling"]</xpath>
		<value>
			<li Class="CombatExtended.RacePropertiesExtensionCE">
				<bodyShape>Quadruped</bodyShape>
			</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="GR_Fleshling"]/statBases</xpath>
		<value>
			<MeleeDodgeChance>0.05</MeleeDodgeChance>
			<MeleeCritChance>0.23</MeleeCritChance>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="GR_Fleshling"]/tools</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<capacities>
						<li>Bite</li>
					</capacities>
					<power>3</power>
					<cooldownTime>1.65</cooldownTime>
					<linkedBodyPartsGroup>Mouth</linkedBodyPartsGroup>
					<armorPenetrationSharp>0.35</armorPenetrationSharp>
					<armorPenetrationBlunt>1.8</armorPenetrationBlunt>
				</li>
			</tools>
		</value>
	</Operation>

	<!-- ========= Aberrant Fleshbeast ============ -->

	<Operation Class="PatchOperationAddModExtension">
		<xpath>Defs/ThingDef[defName="GR_AberrantFleshbeast"]</xpath>
		<value>
			<li Class="CombatExtended.RacePropertiesExtensionCE">
				<bodyShape>QuadrupedLow</bodyShape>
			</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="GR_AberrantFleshbeast"]/statBases</xpath>
		<value>
			<MeleeDodgeChance>0.01</MeleeDodgeChance>
			<MeleeCritChance>0.10</MeleeCritChance>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="GR_AberrantFleshbeast"]/tools</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<capacities>
						<li>Bite</li>
					</capacities>
					<power>5</power>
					<cooldownTime>2.56</cooldownTime>
					<linkedBodyPartsGroup>Mouth</linkedBodyPartsGroup>
					<armorPenetrationSharp>0.45</armorPenetrationSharp>
					<armorPenetrationBlunt>2</armorPenetrationBlunt>
				</li>
			</tools>
		</value>
	</Operation>

	<!-- ========= Flesh Monstrosity ============ -->

	<Operation Class="PatchOperationAddModExtension">
		<xpath>Defs/ThingDef[defName="GR_FleshMonstrosity"]</xpath>
		<value>
			<li Class="CombatExtended.RacePropertiesExtensionCE">
				<bodyShape>Quadruped</bodyShape>
			</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="GR_FleshMonstrosity"]/statBases</xpath>
		<value>
			<MeleeDodgeChance>0.01</MeleeDodgeChance>
			<MeleeCritChance>0.23</MeleeCritChance>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="GR_FleshMonstrosity"]/tools</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<capacities>
						<li>GR_RabidSlash</li>
					</capacities>
					<power>35</power>
					<cooldownTime>2.56</cooldownTime>
					<linkedBodyPartsGroup>Mouth</linkedBodyPartsGroup>
					<armorPenetrationSharp>6</armorPenetrationSharp>
					<armorPenetrationBlunt>9</armorPenetrationBlunt>
				</li>
			</tools>
		</value>
	</Operation>

	<!-- ========= Flesh Growth ============ -->

	<Operation Class="PatchOperationAddModExtension">
		<xpath>Defs/ThingDef[defName="GR_FleshGrowth"]</xpath>
		<value>
			<li Class="CombatExtended.RacePropertiesExtensionCE">
				<bodyShape>Birdlike</bodyShape>
			</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="GR_FleshGrowth"]/statBases</xpath>
		<value>
			<MeleeDodgeChance>0.01</MeleeDodgeChance>
			<MeleeCritChance>0.01</MeleeCritChance>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="GR_FleshGrowth"]/tools</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<capacities>
						<li>Bite</li>
					</capacities>
					<power>1</power>
					<cooldownTime>1.65</cooldownTime>
					<linkedBodyPartsGroup>Mouth</linkedBodyPartsGroup>
					<armorPenetrationSharp>0.35</armorPenetrationSharp>
					<armorPenetrationBlunt>1.8</armorPenetrationBlunt>
				</li>
			</tools>
		</value>
	</Operation>

	<!-- ========= Fleshflies ============ -->

	<Operation Class="PatchOperationAddModExtension">
		<xpath>Defs/ThingDef[defName="GR_FleshFlies"]</xpath>
		<value>
			<li Class="CombatExtended.RacePropertiesExtensionCE">
				<bodyShape>Vehicle</bodyShape><!-- Not so much a 'body' as a swarm. -->
			</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[defName="GR_FleshFlies"]/statBases/ArmorRating_Blunt</xpath>
	</Operation>

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[defName="GR_FleshFlies"]/statBases/ArmorRating_Sharp</xpath>
	</Operation>

	<!-- 
Rather than using armor, use damage multipliers to mimic
only being able to kill a small part of the swarm with each
attack.
-->
	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="GR_FleshFlies"]</xpath>
		<value>
			<damageMultipliers>
				<li>
					<damageDef>Cut</damageDef>
					<multiplier>0.20</multiplier>
				</li>
				<li>
					<damageDef>Stab</damageDef>
					<multiplier>0.20</multiplier>
				</li>
				<li>
					<damageDef>Blunt</damageDef>
					<multiplier>0.20</multiplier>
				</li>
				<li>
					<damageDef>Bullet</damageDef>
					<multiplier>0.10</multiplier>
				</li>
			</damageMultipliers>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="GR_FleshFlies"]/statBases</xpath>
		<value>
			<MeleeDodgeChance>0.80</MeleeDodgeChance>
			<MeleeCritChance>0.00</MeleeCritChance>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="GR_FleshFlies"]/tools</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<capacities>
						<li>Bite</li>
					</capacities>
					<power>1</power>
					<cooldownTime>0.96</cooldownTime>
					<linkedBodyPartsGroup>Mouth</linkedBodyPartsGroup>
					<armorPenetrationSharp>0.03</armorPenetrationSharp>
					<armorPenetrationBlunt>0.01</armorPenetrationBlunt>
				</li>
			</tools>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/PawnKindDef[defName="GR_FleshFlies"]/lifeStages/li/bodyGraphicData/texPath</xpath>
		<value>
			<texPath>Things/Pawn/Animal/Failures/Fleshflies/FleshfliesA</texPath>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/PawnKindDef[defName="GR_FleshFlies"]/lifeStages/li/bodyGraphicData/drawSize</xpath>
		<value>
			<drawSize>2.0</drawSize>
		</value>
	</Operation>

</Patch>