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

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

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="BMT_BunkerBug"]/statBases</xpath>
		<value>
			<MeleeDodgeChance>0.05</MeleeDodgeChance>
			<MeleeCritChance>1.75</MeleeCritChance>
			<MeleeParryChance>0.25</MeleeParryChance>
		</value>
	</Operation>

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

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

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="BMT_BunkerBug"]/tools</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<label>claw</label>
					<capacities>
						<li>Cut</li>
					</capacities>
					<power>30</power>
					<cooldownTime>2</cooldownTime>
					<linkedBodyPartsGroup>HeadClaw</linkedBodyPartsGroup>
					<armorPenetrationSharp>12</armorPenetrationSharp>
					<armorPenetrationBlunt>40</armorPenetrationBlunt>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>head</label>
					<capacities>
						<li>Blunt</li>
					</capacities>
					<power>25</power>
					<cooldownTime>4</cooldownTime>
					<linkedBodyPartsGroup>HeadAttackTool</linkedBodyPartsGroup>
					<armorPenetrationBlunt>45</armorPenetrationBlunt>
				</li>
			</tools>
		</value>
	</Operation>

	<Operation Class="PatchOperationAddModExtension">
		<xpath>Defs/ThingDef[defName="BMT_BunkerBug"]</xpath>
		<value>
			<li Class="CombatExtended.PartialArmorExt">
				<stats>
					<li>
						<ArmorRating_Sharp>0.6</ArmorRating_Sharp>
						<parts>
							<li>InsectHead</li>
							<li>Antenna</li>
							<li>Eye</li>
							<li>Ear</li>
							<li>InsectNostril</li>
							<li>InsectMouth</li>
							<li>HeadClaw</li>
						</parts>
					</li>
					<li>
						<ArmorRating_Blunt>0.6</ArmorRating_Blunt>
						<parts>
							<li>InsectHead</li>
							<li>Antenna</li>
							<li>Eye</li>
							<li>Ear</li>
							<li>InsectNostril</li>
							<li>InsectMouth</li>
							<li>HeadClaw</li>
						</parts>
					</li>
				</stats>
			</li>
		</value>
	</Operation>

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

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="BMT_BunkerBug"]/comps</xpath>
		<value>
			<li Class="CombatExtended.CompProperties_ArmorDurability">
				<Durability>11500</Durability> <!-- Bunkerbug wears a metal APC hull as a shell. -->
				<Regenerates>true</Regenerates>
				<RegenInterval>600</RegenInterval>
				<RegenValue>5</RegenValue>
				<MinArmorPct>0.5</MinArmorPct>
			</li>
		</value>
	</Operation>

</Patch>