<?xml version="1.0" encoding="utf-8"?>
<Patch>
	<Operation Class="PatchOperationAddModExtension">
		<xpath>Defs/ThingDef[defName="BMT_CaveSpider"]</xpath>
		<value>
			<li Class="CombatExtended.RacePropertiesExtensionCE">
				<bodyShape>Quadruped</bodyShape>
			</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="BMT_CaveSpider"]/statBases</xpath>
		<value>
			<MeleeDodgeChance>0.23</MeleeDodgeChance>
			<MeleeCritChance>0.2</MeleeCritChance>
			<MeleeParryChance>0.25</MeleeParryChance>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="BMT_CaveSpider"]/statBases/ArmorRating_Blunt</xpath>
		<value>
			<ArmorRating_Blunt>12</ArmorRating_Blunt>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="BMT_CaveSpider"]/statBases/ArmorRating_Sharp</xpath>
		<value>
			<ArmorRating_Sharp>7</ArmorRating_Sharp>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="BMT_CaveSpider"]/tools</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<label>head</label>
					<capacities>
						<li>Blunt</li>
					</capacities>
					<power>30</power>
					<cooldownTime>1.85</cooldownTime>
					<linkedBodyPartsGroup>HeadAttackTool</linkedBodyPartsGroup>
					<ensureLinkedBodyPartsGroupAlwaysUsable>true</ensureLinkedBodyPartsGroupAlwaysUsable>
					<chanceFactor>0.2</chanceFactor>
					<armorPenetrationBlunt>6</armorPenetrationBlunt>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>venom-fangs</label>
					<capacities>
						<li>ToxicBite</li>
					</capacities>
					<power>45</power>
					<cooldownTime>2</cooldownTime>
					<linkedBodyPartsGroup>Mouth</linkedBodyPartsGroup>
					<armorPenetrationSharp>10</armorPenetrationSharp>
					<armorPenetrationBlunt>15</armorPenetrationBlunt>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>left leg</label>
					<capacities>
						<li>Blunt</li>
					</capacities>
					<power>23</power>
					<cooldownTime>2</cooldownTime>
					<linkedBodyPartsGroup>FrontLeftLeg</linkedBodyPartsGroup>
					<alwaysTreatAsWeapon>true</alwaysTreatAsWeapon>
					<surpriseAttack>
						<extraMeleeDamages>
							<li>
								<def>Stun</def>
								<amount>20</amount>
							</li>
						</extraMeleeDamages>
					</surpriseAttack>
					<armorPenetrationSharp>10</armorPenetrationSharp>
					<armorPenetrationBlunt>2</armorPenetrationBlunt>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>right leg</label>
					<capacities>
						<li>Blunt</li>
					</capacities>
					<power>23</power>
					<cooldownTime>2</cooldownTime>
					<linkedBodyPartsGroup>FrontRightLeg</linkedBodyPartsGroup>
					<surpriseAttack>
						<extraMeleeDamages>
							<li>
								<def>Stun</def>
								<amount>20</amount>
							</li>
						</extraMeleeDamages>
					</surpriseAttack>
					<armorPenetrationSharp>10</armorPenetrationSharp>
					<armorPenetrationBlunt>2</armorPenetrationBlunt>
				</li>
			</tools>
		</value>
	</Operation>
	
	<Operation Class="PatchOperationConditional">
		<xpath>Defs/ThingDef[defName="BMT_CaveSpider"]/comps</xpath>
		<nomatch Class="PatchOperationAdd">
			<xpath>Defs/ThingDef[defName="BMT_CaveSpider"]</xpath>
			<value>
				<comps />
			</value>
		</nomatch>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="BMT_CaveSpider"]/comps</xpath>
		<value>
			<li Class="CombatExtended.CompProperties_ArmorDurability">
				<Durability>3000</Durability>
				<Regenerates>true</Regenerates>
				<RegenInterval>600</RegenInterval>
				<RegenValue>5</RegenValue>
				<MinArmorPct>0.25</MinArmorPct>
			</li>
		</value>
	</Operation>

</Patch>