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

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[@Name="BugsThingBase"]/statBases</xpath>
		<value>
			<PainShockThreshold>0.99</PainShockThreshold>
		</value>
	</Operation>

	<!-- Basic Warrior -->
	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="Arachnid_WarriorBug" or defName="Arachnid_WarriorBugHive"]/statBases</xpath>
		<value>
			<ArmorRating_Blunt>0.5</ArmorRating_Blunt>
			<ArmorRating_Sharp>0.5</ArmorRating_Sharp>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="Arachnid_WarriorBug" or defName="Arachnid_WarriorBugHive" or defName="Arachnid_FireFlyBug" or defName="Arachnid_HopperBug"]/statBases</xpath>
		<value>
			<MeleeDodgeChance>0.09</MeleeDodgeChance>
			<MeleeCritChance>0.53</MeleeCritChance>
			<MeleeParryChance>0.02</MeleeParryChance>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="Arachnid_WarriorBug" or defName="Arachnid_WarriorBugHive" or defName="Arachnid_FireFlyBug" or defName="Arachnid_HopperBug"]/tools</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<label>front left leg</label>
					<capacities>
						<li>Stab</li>
					</capacities>
					<power>24</power>
					<cooldownTime>1.0</cooldownTime>
					<linkedBodyPartsGroup>FrontLeftInsectLeg</linkedBodyPartsGroup>
					<armorPenetrationSharp>40</armorPenetrationSharp>
					<armorPenetrationBlunt>24</armorPenetrationBlunt>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>front right leg</label>
					<capacities>
						<li>Stab</li>
					</capacities>
					<power>24</power>
					<cooldownTime>1.0</cooldownTime>
					<linkedBodyPartsGroup>FrontRightInsectLeg</linkedBodyPartsGroup>
					<armorPenetrationSharp>40</armorPenetrationSharp>
					<armorPenetrationBlunt>20</armorPenetrationBlunt>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>head</label>
					<capacities>
						<li>Stab</li>
					</capacities>
					<power>36</power>
					<cooldownTime>1.33</cooldownTime>
					<linkedBodyPartsGroup>HeadAttackTool</linkedBodyPartsGroup>
					<ensureLinkedBodyPartsGroupAlwaysUsable>true</ensureLinkedBodyPartsGroupAlwaysUsable>
					<armorPenetrationSharp>20</armorPenetrationSharp>
					<armorPenetrationBlunt>68</armorPenetrationBlunt>
				</li>
			</tools>
		</value>
	</Operation>

	<!-- Bombardier -->

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="Arachnid_BombardierBug"]/tools</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<label>head</label>
					<capacities>
						<li>Bite</li>
					</capacities>
					<power>9</power>
					<cooldownTime>1.6</cooldownTime>
					<linkedBodyPartsGroup>HeadAttackTool</linkedBodyPartsGroup>
					<ensureLinkedBodyPartsGroupAlwaysUsable>true</ensureLinkedBodyPartsGroupAlwaysUsable>
					<armorPenetrationSharp>0.24</armorPenetrationSharp>
					<armorPenetrationBlunt>0.5</armorPenetrationBlunt>
				</li>
			</tools>
		</value>
	</Operation>

	<!-- Plasma Grenadier -->

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="Arachnid_PlasmaGrenadierBug"]/statBases</xpath>
		<value>
			<ArmorRating_Blunt>2</ArmorRating_Blunt>
			<ArmorRating_Sharp>1</ArmorRating_Sharp>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="Arachnid_PlasmaGrenadierBug"]/statBases</xpath>
		<value>
			<MeleeDodgeChance>0.09</MeleeDodgeChance>
			<MeleeCritChance>0.31</MeleeCritChance>
			<MeleeParryChance>0.05</MeleeParryChance>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="Arachnid_PlasmaGrenadierBug"]/tools</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<label>front left leg</label>
					<capacities>
						<li>Blunt</li>
					</capacities>
					<power>22</power>
					<cooldownTime>2.13</cooldownTime>
					<linkedBodyPartsGroup>FrontLeftInsectLeg</linkedBodyPartsGroup>
					<armorPenetrationBlunt>14.640</armorPenetrationBlunt>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>front right leg</label>
					<capacities>
						<li>Blunt</li>
					</capacities>
					<power>22</power>
					<cooldownTime>2.13</cooldownTime>
					<linkedBodyPartsGroup>FrontRightInsectLeg</linkedBodyPartsGroup>
					<armorPenetrationBlunt>14.640</armorPenetrationBlunt>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>head</label>
					<capacities>
						<li>Bite</li>
					</capacities>
					<power>24</power>
					<cooldownTime>1.33</cooldownTime>
					<linkedBodyPartsGroup>HeadAttackTool</linkedBodyPartsGroup>
					<ensureLinkedBodyPartsGroupAlwaysUsable>true</ensureLinkedBodyPartsGroupAlwaysUsable>
					<chanceFactor>0.2</chanceFactor>
					<armorPenetrationSharp>40</armorPenetrationSharp>
					<armorPenetrationBlunt>20</armorPenetrationBlunt>
				</li>
			</tools>
		</value>
	</Operation>

	<!-- Large-class -->

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

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

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

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

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="Arachnid_TankerBug" or defName="Arachnid_ScorpionBug" or defName="Arachnid_PlasmaBug"]/statBases</xpath>
		<value>
			<MeleeDodgeChance>0.09</MeleeDodgeChance>
			<MeleeCritChance>0.76</MeleeCritChance>
			<MeleeParryChance>0.05</MeleeParryChance>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="Arachnid_TankerBug" or defName="Arachnid_ScorpionBug" or defName="Arachnid_PlasmaBug"]/tools</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<label>front left leg</label>
					<capacities>
						<li>Blunt</li>
					</capacities>
					<power>33</power>
					<cooldownTime>2.13</cooldownTime>
					<linkedBodyPartsGroup>FrontLeftInsectLeg</linkedBodyPartsGroup>
					<armorPenetrationBlunt>14.640</armorPenetrationBlunt>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>front right leg</label>
					<capacities>
						<li>Blunt</li>
					</capacities>
					<power>33</power>
					<cooldownTime>2.13</cooldownTime>
					<linkedBodyPartsGroup>FrontRightInsectLeg</linkedBodyPartsGroup>
					<armorPenetrationBlunt>14.640</armorPenetrationBlunt>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>head</label>
					<capacities>
						<li>Bite</li>
					</capacities>
					<power>24</power>
					<cooldownTime>1.33</cooldownTime>
					<linkedBodyPartsGroup>HeadAttackTool</linkedBodyPartsGroup>
					<ensureLinkedBodyPartsGroupAlwaysUsable>true</ensureLinkedBodyPartsGroupAlwaysUsable>
					<chanceFactor>0.2</chanceFactor>
					<armorPenetrationSharp>40</armorPenetrationSharp>
					<armorPenetrationBlunt>20</armorPenetrationBlunt>
				</li>
			</tools>
		</value>
	</Operation>
</Patch>