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

	<!-- Chainsaw -->
	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="BioferriteChainsaw"]/tools</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<label>handle</label>
					<capacities>
						<li>Blunt</li>
					</capacities>
					<power>8</power>
						<extraMeleeDamages>
						<li>
							<def>Scratch</def>
							<amount>6</amount>
							<chance>0.5</chance>
						</li>
						</extraMeleeDamages>
					<cooldownTime>2.2</cooldownTime>
					<armorPenetrationBlunt>0.6</armorPenetrationBlunt>
					<linkedBodyPartsGroup>Handle</linkedBodyPartsGroup>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>saw blade</label>
					<labelUsedInLogging>false</labelUsedInLogging>
					<capacities>
						<li>Cut</li>
						<li>Stab</li>
					</capacities>
					<power>25</power>
					<extraMeleeDamages>
						<li>
							<def>Flame</def>
							<amount>5</amount>
							<chance>0.5</chance>
						</li>
						<li>
							<def>Burn</def>
							<amount>5</amount>
							<chance>0.5</chance>
						</li>
					</extraMeleeDamages>					
					<cooldownTime>1.2</cooldownTime>
					<armorPenetrationBlunt>2</armorPenetrationBlunt>
					<armorPenetrationSharp>1.2</armorPenetrationSharp>
					<linkedBodyPartsGroup>Edge</linkedBodyPartsGroup>
				</li>
			</tools>
		</value>
	</Operation>

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

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="BioferriteChainsaw"]</xpath>
		<value>
			<equippedStatOffsets>
				<MeleeCritChance>0.4</MeleeCritChance>
				<MeleeParryChance>0.15</MeleeParryChance>
				<MeleeDodgeChance>0.1</MeleeDodgeChance>
			</equippedStatOffsets>
		</value>
	</Operation>

	<!-- Chainsaw Arm -->
	<Operation Class="PatchOperationReplace">
		<xpath>Defs/HediffDef[defName="BioferriteChainsawGhoul"]/comps/li[@Class="HediffCompProperties_VerbGiver"]/tools</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<label>chainsaw arm</label>
					<capacities>
						<li>Cut</li>
						<li>Stab</li>
					</capacities>
					<power>12</power>
					<cooldownTime>1.25</cooldownTime>
					<armorPenetrationSharp>1.25</armorPenetrationSharp>
					<armorPenetrationBlunt>1.6</armorPenetrationBlunt>
					<soundMeleeHit>Pawn_Melee_PowerClaw_Hit</soundMeleeHit>
					<soundMeleeMiss>Pawn_Melee_PowerClaw_Miss</soundMeleeMiss>
				</li>
			</tools>
		</value>
	</Operation>

	<Operation Class="PatchOperationFindMod">
		<mods>
			<li>Vanilla Factions Expanded - Pirates</li>
		</mods>
		<match Class="PatchOperationSequence">
			<operations>

			<!-- Chain Sword -->
			<li Class="PatchOperationReplace">
				<xpath>Defs/ThingDef[defName="WarcasketBioferriteChainsaw"]/tools</xpath>
				<value>
					<tools>
						<li Class="CombatExtended.ToolCE">
							<label>handle</label>
							<capacities>
								<li>Blunt</li>
							</capacities>
							<power>56</power>
							<extraMeleeDamages>
								<li>
									<def>Scratch</def>
									<amount>6</amount>
									<chance>0.5</chance>
								</li>
							</extraMeleeDamages>
							<cooldownTime>2.5</cooldownTime>
							<chanceFactor>0.60</chanceFactor>
							<armorPenetrationBlunt>11.5</armorPenetrationBlunt>
							<armorPenetrationSharp>12</armorPenetrationSharp>
							<linkedBodyPartsGroup>Point</linkedBodyPartsGroup>
						</li>
						<li Class="CombatExtended.ToolCE">
							<label>saw blade</label>
							<labelUsedInLogging>false</labelUsedInLogging>
							<capacities>
								<li>Cut</li>
								<li>Stab</li>
							</capacities>
							<power>42</power>
							<extraMeleeDamages>
							<li>
								<def>Flame</def>
								<amount>7</amount>
								<chance>0.5</chance>
							</li>
							<li>
								<def>Burn</def>
								<amount>7</amount>
								<chance>0.5</chance>
							</li>
							</extraMeleeDamages>
							<cooldownTime>3.45</cooldownTime>
							<chanceFactor>0.30</chanceFactor>
							<armorPenetrationBlunt>8.6</armorPenetrationBlunt>
							<armorPenetrationSharp>4.8</armorPenetrationSharp>
							<linkedBodyPartsGroup>Edge</linkedBodyPartsGroup>
						</li>
					</tools>
				</value>
			</li>

			<li Class="PatchOperationAdd">
				<xpath>Defs/ThingDef[defName="WarcasketBioferriteChainsaw"]</xpath>
				<value>
					<equippedStatOffsets>
						<MeleeCritChance>0.11</MeleeCritChance>
						<MeleeParryChance>0.47</MeleeParryChance>
						<MeleeDodgeChance>0.15</MeleeDodgeChance>
					</equippedStatOffsets>
				</value>
			</li>

			<li Class="PatchOperationAdd">
				<xpath>Defs/ThingDef[defName="WarcasketBioferriteChainsaw"]/statBases</xpath>
				<value>
					<Bulk>18</Bulk>
					<MeleeCounterParryBonus>1</MeleeCounterParryBonus>
					<ToughnessRating>20</ToughnessRating>
				</value>
			</li>

			</operations>
		</match>
	</Operation>
</Patch>