<?xml version="1.0" encoding="utf-8"?>
<Patch>
	<!-- Melee -->
	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="O21_Gun_HighlandPistol" or defName="O21_Gun_FlintlockPistol" or defName="O21_Gun_MatchlockPistol"]/tools</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<label>grip</label>
					<capacities>
						<li>Blunt</li>
					</capacities>
					<power>2</power>
					<cooldownTime>1.54</cooldownTime>
					<chanceFactor>1.5</chanceFactor>
					<armorPenetrationBlunt>0.555</armorPenetrationBlunt>
					<linkedBodyPartsGroup>Grip</linkedBodyPartsGroup>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>muzzle</label>
					<capacities>
						<li>Poke</li>
					</capacities>
					<power>2</power>
					<cooldownTime>1.54</cooldownTime>
					<armorPenetrationBlunt>0.555</armorPenetrationBlunt>
					<linkedBodyPartsGroup>Muzzle</linkedBodyPartsGroup>
				</li>
			</tools>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="O21_Gun_ResonanceRifle"]/tools</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<label>stock</label>
					<capacities>
						<li>Blunt</li>
					</capacities>
					<power>8</power>
					<cooldownTime>1.55</cooldownTime>
					<chanceFactor>1.5</chanceFactor>
					<armorPenetrationBlunt>2.755</armorPenetrationBlunt>
					<linkedBodyPartsGroup>Stock</linkedBodyPartsGroup>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>barrel</label>
					<capacities>
						<li>Blunt</li>
					</capacities>
					<power>5</power>
					<cooldownTime>2.02</cooldownTime>
					<armorPenetrationBlunt>1.630</armorPenetrationBlunt>
					<linkedBodyPartsGroup>Barrel</linkedBodyPartsGroup>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>muzzle</label>
					<capacities>
						<li>Poke</li>
					</capacities>
					<power>8</power>
					<cooldownTime>1.55</cooldownTime>
					<armorPenetrationBlunt>2.755</armorPenetrationBlunt>
					<linkedBodyPartsGroup>Muzzle</linkedBodyPartsGroup>
				</li>
			</tools>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[@Name="TropicalBlowpipeBase"]/tools</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<capacities>
						<li>Blunt</li>
					</capacities>
					<power>7</power>
					<cooldownTime>1.6</cooldownTime>
					<armorPenetrationBlunt>0.65</armorPenetrationBlunt>
				</li>
			</tools>
		</value>
	</Operation>

	<!-- Various Pistols -->
	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>O21_Gun_HighlandPistol</defName>
		<statBases>
			<Mass>1.25</Mass>
			<Bulk>3.90</Bulk>
			<SwayFactor>1.22</SwayFactor>
			<ShotSpread>0.36</ShotSpread>
			<SightsEfficiency>0.7</SightsEfficiency>
			<RangedWeapon_Cooldown>0.85</RangedWeapon_Cooldown>
		</statBases>
		<Properties>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>True</hasStandardCommand>
			<defaultProjectile>Bullet_SlowMusketBall</defaultProjectile>
			<warmupTime>1.66</warmupTime>
			<range>12</range>
			<soundCast>Shot_Revolver</soundCast>
			<soundCastTail>GunTail_Light</soundCastTail>
			<muzzleFlashScale>9</muzzleFlashScale>
		</Properties>
		<AmmoUser>
			<magazineSize>1</magazineSize>
			<AmmoGenPerMagOverride>5</AmmoGenPerMagOverride>
			<reloadTime>6.5</reloadTime>
			<ammoSet>AmmoSet_SlowMusketBall</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiAimMode>AimedShot</aiAimMode>
		</FireModes>
		<weaponTags>
			<li>CE_OneHandedWeapon</li>
		</weaponTags>
	</Operation>

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>O21_Gun_FlintlockPistol</defName>
		<statBases>
			<Mass>1.25</Mass>
			<Bulk>3.90</Bulk>
			<SwayFactor>1.22</SwayFactor>
			<ShotSpread>0.36</ShotSpread>
			<SightsEfficiency>0.7</SightsEfficiency>
			<RangedWeapon_Cooldown>0.85</RangedWeapon_Cooldown>
		</statBases>
		<Properties>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>True</hasStandardCommand>
			<defaultProjectile>Bullet_SlowMusketBall</defaultProjectile>
			<warmupTime>1.66</warmupTime>
			<range>12</range>
			<soundCast>Shot_Revolver</soundCast>
			<soundCastTail>GunTail_Light</soundCastTail>
			<muzzleFlashScale>9</muzzleFlashScale>
		</Properties>
		<AmmoUser>
			<magazineSize>1</magazineSize>
			<AmmoGenPerMagOverride>5</AmmoGenPerMagOverride>
			<reloadTime>6.5</reloadTime>
			<ammoSet>AmmoSet_SlowMusketBall</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiAimMode>AimedShot</aiAimMode>
		</FireModes>
		<weaponTags>
			<li>CE_OneHandedWeapon</li>
		</weaponTags>
	</Operation>

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>O21_Gun_MatchlockPistol</defName>
		<statBases>
			<Mass>1.45</Mass>
			<Bulk>4</Bulk>
			<SwayFactor>1.24</SwayFactor>
			<ShotSpread>0.37</ShotSpread>
			<SightsEfficiency>0.7</SightsEfficiency>
			<RangedWeapon_Cooldown>0.85</RangedWeapon_Cooldown>
		</statBases>
		<Properties>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>True</hasStandardCommand>
			<defaultProjectile>Bullet_SlowMusketBall</defaultProjectile>
			<warmupTime>1.86</warmupTime>
			<range>12</range>
			<soundCast>Shot_Revolver</soundCast>
			<soundCastTail>GunTail_Light</soundCastTail>
			<muzzleFlashScale>9</muzzleFlashScale>
		</Properties>
		<AmmoUser>
			<magazineSize>1</magazineSize>
			<AmmoGenPerMagOverride>5</AmmoGenPerMagOverride>
			<reloadTime>6.9</reloadTime>
			<ammoSet>AmmoSet_SlowMusketBall</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiAimMode>AimedShot</aiAimMode>
		</FireModes>
		<weaponTags>
			<li>CE_OneHandedWeapon</li>
		</weaponTags>
	</Operation>

	<!-- Blowpipes -->

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[@Name="TropicalBlowpipeBase"]/verbs</xpath>
	</Operation>

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[@Name="TropicalBlowpipeBase"]/statBases/AccuracyTouch</xpath>
	</Operation>

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[@Name="TropicalBlowpipeBase"]/statBases/AccuracyShort</xpath>
	</Operation>

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[@Name="TropicalBlowpipeBase"]/statBases/AccuracyMedium</xpath>
	</Operation>

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[@Name="TropicalBlowpipeBase"]/statBases/AccuracyLong</xpath>
	</Operation>

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>O21_TropicalBoneBlowpipe</defName>
		<statBases>
			<Mass>1</Mass>
			<Bulk>2.50</Bulk>
			<SwayFactor>1.22</SwayFactor>
			<ShotSpread>0.36</ShotSpread>
			<SightsEfficiency>0.8</SightsEfficiency>
			<RangedWeapon_Cooldown>0.85</RangedWeapon_Cooldown>
		</statBases>
		<Properties>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>True</hasStandardCommand>
			<defaultProjectile>Projectile_Dart_Venom</defaultProjectile>
			<warmupTime>1.20</warmupTime>
			<range>10</range>
			<soundCast>Bow_Small</soundCast>
			<muzzleFlashScale>9</muzzleFlashScale>
		</Properties>
		<AmmoUser>
			<magazineSize>1</magazineSize>
			<AmmoGenPerMagOverride>3</AmmoGenPerMagOverride>
			<reloadTime>3</reloadTime>
			<ammoSet>AmmoSet_Blowdart</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiAimMode>AimedShot</aiAimMode>
		</FireModes>
		<weaponTags>
			<li>CE_OneHandedWeapon</li>
		</weaponTags>
	</Operation>

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>O21_TropicalBambooBlowpipe</defName>
		<statBases>
			<Mass>1</Mass>
			<Bulk>2.50</Bulk>
			<SwayFactor>1.22</SwayFactor>
			<ShotSpread>0.36</ShotSpread>
			<SightsEfficiency>0.8</SightsEfficiency>
			<RangedWeapon_Cooldown>1.85</RangedWeapon_Cooldown>
		</statBases>
		<Properties>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>True</hasStandardCommand>
			<defaultProjectile>Projectile_Dart_Venom</defaultProjectile>
			<warmupTime>2.60</warmupTime>
			<range>10</range>
			<soundCast>Bow_Small</soundCast>
			<muzzleFlashScale>9</muzzleFlashScale>
		</Properties>
		<AmmoUser>
			<magazineSize>1</magazineSize>
			<AmmoGenPerMagOverride>3</AmmoGenPerMagOverride>
			<reloadTime>5.3</reloadTime>
			<ammoSet>AmmoSet_Blowdart</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiAimMode>AimedShot</aiAimMode>
		</FireModes>
		<weaponTags>
			<li>CE_OneHandedWeapon</li>
		</weaponTags>
	</Operation>

	<!-- ========== Boomerang =========== -->

	<Operation Class="PatchOperationAttributeSet">
		<xpath>Defs/ThingDef[defName="O21_DNI_Boomerang"]</xpath>
		<attribute>ParentName</attribute>
		<value>BaseWeapon</value>
	</Operation>

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[defName="O21_DNI_Boomerang"]/costStuffCount</xpath>
	</Operation>

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[defName="O21_DNI_Boomerang"]/recipeMaker</xpath>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="O21_DNI_Boomerang"]</xpath>
		<value>
			<thingCategories>
				<li>WeaponsRanged</li>
			</thingCategories>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="O21_DNI_Boomerang"]/statBases</xpath>
		<value>
			<statBases>
				<SightsEfficiency>0.8</SightsEfficiency>
				<ShotSpread>0.6</ShotSpread>
				<SwayFactor>2</SwayFactor>
				<Bulk>1</Bulk>
				<Mass>0.5</Mass>
				<RangedWeapon_Cooldown>1.3</RangedWeapon_Cooldown>
			</statBases>
			<stackLimit>25</stackLimit>
			<tradeTags>
				<li>CE_AutoEnableTrade</li>
			</tradeTags>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="O21_DNI_Boomerang"]/verbs</xpath>
		<value>
			<verbs>
				<li Class="CombatExtended.VerbPropertiesCE">
					<verbClass>CombatExtended.Verb_ShootCEOneUse</verbClass>
					<hasStandardCommand>true</hasStandardCommand>
					<defaultProjectile>Boomerang_Thrown</defaultProjectile>
					<warmupTime>1.5</warmupTime>
					<range>16</range>
					<soundCast>Interact_BeatFire</soundCast>
				</li>
			</verbs>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="O21_DNI_Boomerang"]/tools</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<label>handle</label>
					<capacities>
						<li>Poke</li>
					</capacities>
					<power>3</power>
					<cooldownTime>1.69</cooldownTime>
					<armorPenetrationBlunt>0.8</armorPenetrationBlunt>
					<linkedBodyPartsGroup>Handle</linkedBodyPartsGroup>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>head</label>
					<capacities>
						<li>Blunt</li>
					</capacities>
					<power>6</power>
					<cooldownTime>3.29</cooldownTime>
					<chanceFactor>1.5</chanceFactor>
					<armorPenetrationBlunt>3.2</armorPenetrationBlunt>
					<linkedBodyPartsGroup>Head</linkedBodyPartsGroup>
				</li>
			</tools>
		</value>
	</Operation>

	<!-- === Resonance Rifle === -->
	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>O21_Gun_ResonanceRifle</defName>
		<statBases>
			<Mass>4.8</Mass>
			<Bulk>14.9</Bulk>
			<SwayFactor>1.92</SwayFactor>
			<ShotSpread>0.30</ShotSpread>
			<SightsEfficiency>1</SightsEfficiency>
			<RangedWeapon_Cooldown>1.35</RangedWeapon_Cooldown>
		</statBases>
		<Properties>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>True</hasStandardCommand>
			<defaultProjectile>Bullet_FastMusketBall</defaultProjectile>
			<warmupTime>2.5</warmupTime>
			<range>45</range>
			<soundCast>Shot_Revolver</soundCast>
			<soundCastTail>GunTail_Light</soundCastTail>
			<muzzleFlashScale>12</muzzleFlashScale>
		</Properties>
		<AmmoUser>
			<magazineSize>1</magazineSize>
			<AmmoGenPerMagOverride>5</AmmoGenPerMagOverride>
			<reloadTime>10</reloadTime>
			<ammoSet>AmmoSet_FastMusketBall</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiAimMode>AimedShot</aiAimMode>
		</FireModes>
	</Operation>
</Patch>