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

	<!-- Tools -->
	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[
			defName="DV_Gun_ClashHMG" or
			defName="DV_Gun_BruteRifle" or
			defName="DV_Gun_PhotonSMG" or
			defName="DV_Gun_PlasmaBlaster" or
			defName="DV_Gun_CoilgunLance" or
			defName="DV_Gun_ClashRifle"
			]/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[defName="DV_Gun_SonicStunner"]/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>

	<!-- Clash HMG -->
	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>DV_Gun_ClashHMG</defName>
		<statBases>
			<Bulk>25</Bulk>
			<SwayFactor>1.87</SwayFactor>
			<ShotSpread>0.07</ShotSpread>
			<SightsEfficiency>1</SightsEfficiency>
			<RangedWeapon_Cooldown>0.47</RangedWeapon_Cooldown>
		</statBases>
		<Properties>
			<recoilAmount>1.86</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>True</hasStandardCommand>
			<defaultProjectile>Bullet_145x114mm_FMJ</defaultProjectile>
			<burstShotCount>10</burstShotCount>
			<ticksBetweenBurstShots>9</ticksBetweenBurstShots>
			<warmupTime>2.1</warmupTime>
			<range>60</range>
			<soundCast>Shot_Autocannon</soundCast>
			<soundCastTail>GunTail_Medium</soundCastTail>
			<muzzleFlashScale>12</muzzleFlashScale>
		</Properties>
		<AmmoUser>
			<magazineSize>60</magazineSize>
			<reloadTime>4.9</reloadTime>
			<ammoSet>AmmoSet_145x114mm</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiUseBurstMode>FALSE</aiUseBurstMode>
			<aiAimMode>SuppressFire</aiAimMode>
			<aimedBurstShotCount>5</aimedBurstShotCount>
		</FireModes>
		<weaponTags>
			<li>CE_MachineGun</li>
			<li>CE_AI_LMG</li>
		</weaponTags>
	</Operation>

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[defName="DV_Gun_ClashHMG"]/equippedStatOffsets/MoveSpeed</xpath>
	</Operation>

	<!-- Coilgun Sniper -->
	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>DV_Gun_CoilgunLance</defName>
		<statBases>
			<Mass>4.0</Mass>
			<Bulk>9.0</Bulk>
			<SwayFactor>1.30</SwayFactor>
			<ShotSpread>0.07</ShotSpread>
			<SightsEfficiency>1.10</SightsEfficiency>
			<RangedWeapon_Cooldown>0.38</RangedWeapon_Cooldown>
		</statBases>
		<Properties>
			<recoilAmount>2.09</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>True</hasStandardCommand>
			<defaultProjectile>Bullet_CoilGunLance</defaultProjectile>
			<warmupTime>1.1</warmupTime>
			<range>60</range>
			<soundCast>Shot_TurretSniper</soundCast>
			<soundCastTail>GunTail_Heavy</soundCastTail>
			<muzzleFlashScale>9</muzzleFlashScale>
		</Properties>
		<AmmoUser>
			<magazineSize>1</magazineSize>
			<reloadTime>4</reloadTime>
			<ammoSet>AmmoSet_6mmRailgun_CoilgunLance</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiAimMode>AimedShot</aiAimMode>
			<aiUseBurstMode>False</aiUseBurstMode>
		</FireModes>
		<weaponTags>
			<li>SpacerGun</li>
			<li>Coilgun</li>
		</weaponTags>
	</Operation>

	<!-- Photon Blaster -->
	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>DV_Gun_PhotonSMG</defName>
		<statBases>
			<Mass>2.50</Mass>
			<RangedWeapon_Cooldown>0.37</RangedWeapon_Cooldown>
			<SightsEfficiency>1.00</SightsEfficiency>
			<ShotSpread>0.14</ShotSpread>
			<SwayFactor>0.94</SwayFactor>
			<Bulk>4.50</Bulk>
		</statBases>
		<Properties>
			<recoilAmount>1.79</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_Bolt_PhotonBlaster</defaultProjectile>
			<warmupTime>0.6</warmupTime>
			<range>25</range>
			<burstShotCount>6</burstShotCount>
			<ticksBetweenBurstShots>3</ticksBetweenBurstShots>
			<soundCast>DV_Shot_PhotonSMG</soundCast>
			<soundCastTail>GunTail_Medium</soundCastTail>
			<muzzleFlashScale>9</muzzleFlashScale>
		</Properties>
		<AmmoUser>
			<magazineSize>60</magazineSize>
			<reloadTime>4</reloadTime>
			<ammoSet>AmmoSet_PhotonBlaster</ammoSet>
		</AmmoUser>
		<FireModes>
			<aimedBurstShotCount>3</aimedBurstShotCount>
			<aiUseBurstMode>FALSE</aiUseBurstMode>
			<aiAimMode>Snapshot</aiAimMode>
		</FireModes>
		<weaponTags>
			<li>CE_SMG</li>
			<li>CE_AI_BROOM</li>
		</weaponTags>
	</Operation>

	<!-- Plasma Blaster -->
	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>DV_Gun_PlasmaBlaster</defName>
		<statBases>
			<Mass>8.7</Mass>
			<RangedWeapon_Cooldown>0.56</RangedWeapon_Cooldown>
			<SightsEfficiency>1</SightsEfficiency>
			<ShotSpread>0.05</ShotSpread>
			<SwayFactor>1.37</SwayFactor>
			<Bulk>12.9</Bulk>
		</statBases>
		<Properties>
			<recoilAmount>1.38</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_Bolt_PlasmaBlaster</defaultProjectile>
			<warmupTime>1.3</warmupTime>
			<range>62</range>
			<ticksBetweenBurstShots>7</ticksBetweenBurstShots>
			<burstShotCount>5</burstShotCount>
			<soundCast>DV_Shot_PlasmaBlaster</soundCast>
			<soundCastTail>GunTail_Medium</soundCastTail>
			<muzzleFlashScale>9</muzzleFlashScale>
		</Properties>
		<AmmoUser>
			<magazineSize>25</magazineSize>
			<reloadTime>4.9</reloadTime>
			<ammoSet>AmmoSet_PlasmaBlaster</ammoSet>
		</AmmoUser>
		<FireModes>
			<aimedBurstShotCount>3</aimedBurstShotCount>
			<aiUseBurstMode>FALSE</aiUseBurstMode>
			<aiAimMode>SuppressFire</aiAimMode>
		</FireModes>
		<weaponTags>
			<li>CE_MachineGun</li>
			<li>CE_AI_LMG</li>
		</weaponTags>
	</Operation>

	<!-- Brute Rifle -->
	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>DV_Gun_BruteRifle</defName>
		<statBases>
			<Bulk>25</Bulk>
			<SwayFactor>2.07</SwayFactor>
			<ShotSpread>0.07</ShotSpread>
			<SightsEfficiency>1</SightsEfficiency>
			<RangedWeapon_Cooldown>0.47</RangedWeapon_Cooldown>
		</statBases>
		<Properties>
			<recoilAmount>2.33</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>True</hasStandardCommand>
			<defaultProjectile>Bullet_50BMG_FMJ</defaultProjectile>
			<burstShotCount>4</burstShotCount>
			<ticksBetweenBurstShots>10</ticksBetweenBurstShots>
			<warmupTime>2.1</warmupTime>
			<range>40</range>
			<soundCast>Shot_Autocannon</soundCast>
			<soundCastTail>GunTail_Medium</soundCastTail>
			<muzzleFlashScale>12</muzzleFlashScale>
		</Properties>
		<AmmoUser>
			<magazineSize>15</magazineSize>
			<reloadTime>4.9</reloadTime>
			<ammoSet>AmmoSet_50BMG</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiUseBurstMode>true</aiUseBurstMode>
			<aiAimMode>Snapshot</aiAimMode>
			<aimedBurstShotCount>2</aimedBurstShotCount>
		</FireModes>
	</Operation>

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[defName="DV_Gun_BruteRifle"]/equippedStatOffsets/MoveSpeed</xpath>
	</Operation>

	<!-- Neutron Streamer -->

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>DV_Gun_NeutronStreamer</defName>
		<statBases>
			<WorkToMake>60000</WorkToMake>
			<Mass>14.0</Mass>
			<Bulk>21.0</Bulk>
			<SwayFactor>1.35</SwayFactor>
			<ShotSpread>0.05</ShotSpread>
			<SightsEfficiency>0.75</SightsEfficiency>
			<RangedWeapon_Cooldown>0.56</RangedWeapon_Cooldown>
		</statBases>
		<Properties>
			<recoilAmount>1.0</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>True</hasStandardCommand>
			<defaultProjectile>Bullet_NeutronStreamer</defaultProjectile>
			<burstShotCount>25</burstShotCount>
			<ticksBetweenBurstShots>6</ticksBetweenBurstShots>
			<warmupTime>2.4</warmupTime>
			<range>63</range>
			<soundCast>DV_Shot_PhotonSMG</soundCast>
			<soundCastTail>GunTail_Medium</soundCastTail>
			<muzzleFlashScale>9</muzzleFlashScale>
		</Properties>
		<AmmoUser>
			<magazineSize>200</magazineSize>
			<reloadTime>9.2</reloadTime>
			<ammoSet>AmmoSet_NeutronCell</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiAimMode>Snapshot</aiAimMode>
			<aimedBurstShotCount>13</aimedBurstShotCount>
		</FireModes>
		<weaponTags>
			<li>SpacerGun</li>
		</weaponTags>
		<AllowWithRunAndGun>false</AllowWithRunAndGun>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="DV_Gun_NeutronStreamer"]/tools</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<label>barrel</label>
					<capacities>
						<li>Blunt</li>
					</capacities>
					<power>10</power>
					<cooldownTime>2.44</cooldownTime>
					<armorPenetrationBlunt>3.5</armorPenetrationBlunt>
					<linkedBodyPartsGroup>Barrels</linkedBodyPartsGroup>
				</li>
			</tools>
		</value>
	</Operation>

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[defName="DV_Gun_NeutronStreamer"]/equippedStatOffsets</xpath>
	</Operation>

	<Operation Class="PatchOperationAddModExtension">
		<xpath>Defs/ThingDef[defName="DV_Gun_NeutronStreamer"]</xpath>
		<value>
			<li Class="CombatExtended.GunDrawExtension">
				<DrawOffset>0.1,-0.15</DrawOffset>
			</li>
		</value>
	</Operation>

	<!-- Clash Rifle -->

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>DV_Gun_ClashRifle</defName>
		<statBases>
			<Bulk>11</Bulk>
			<SwayFactor>1.68</SwayFactor>
			<ShotSpread>0.07</ShotSpread>
			<SightsEfficiency>1</SightsEfficiency>
			<RangedWeapon_Cooldown>0.46</RangedWeapon_Cooldown>
		</statBases>
		<Properties>
			<recoilAmount>1.34</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>True</hasStandardCommand>
			<defaultProjectile>Bullet_762x51mmNATO_FMJ</defaultProjectile>
			<burstShotCount>6</burstShotCount>
			<ticksBetweenBurstShots>7</ticksBetweenBurstShots>
			<warmupTime>1.2</warmupTime>
			<range>54</range>
			<soundCast>Shot_Minigun</soundCast>
			<soundCastTail>GunTail_Medium</soundCastTail>
			<muzzleFlashScale>9</muzzleFlashScale>
		</Properties>
		<AmmoUser>
			<magazineSize>30</magazineSize>
			<reloadTime>3.8</reloadTime>
			<ammoSet>AmmoSet_762x51mmNATO</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiUseBurstMode>False</aiUseBurstMode>
			<aiAimMode>AimedShot</aiAimMode>
			<aimedBurstShotCount>3</aimedBurstShotCount>
		</FireModes>
		<weaponTags>
			<li>CE_AI_AssaultWeapon</li>
			<li>IndustrialGunAdvanced</li>
		</weaponTags>
	</Operation>

	<!-- Laserpulse Longrifle -->

	<!-- Due to complications with patching (Yet another case of adding Defs with patches) I have
	been forced to do this-->

	<Operation Class="PatchOperationFindMod">
		<mods>
			<li>Det's Xenotypes - Venators</li>
		</mods>
		<match Class="PatchOperationSequence">
			<operations>

				<li Class="PatchOperationAttributeSet">
					<xpath>Defs/ThingDef[defName="DV_Gun_LaserpulseLongrifle"]</xpath>
					<attribute>ParentName</attribute>
					<value>BaseHumanMakeableGun</value>
				</li>

				<li Class="PatchOperationReplace">
					<xpath>Defs/ThingDef[defName="DV_Gun_LaserpulseLongrifle"]/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>
				</li>

				<li Class="CombatExtended.PatchOperationMakeGunCECompatible">
					<defName>DV_Gun_LaserpulseLongrifle</defName>
					<statBases>
						<SightsEfficiency>3</SightsEfficiency>
						<ShotSpread>0.03</ShotSpread>
						<SwayFactor>1.35</SwayFactor>
						<Bulk>13.7</Bulk>
						<Mass>9.7</Mass>
						<RangedWeapon_Cooldown>1.36</RangedWeapon_Cooldown>
					</statBases>
					<costList>
						<Plasteel>70</Plasteel>
						<Uranium>30</Uranium>
						<ComponentSpacer>4</ComponentSpacer>
					</costList>
					<Properties>
						<recoilAmount>0.01</recoilAmount>
						<verbClass>CombatExtended.Verb_ShootCE</verbClass>
						<hasStandardCommand>true</hasStandardCommand>
						<defaultProjectile>Bullet_Laser_LaserpulseLongrifle</defaultProjectile>
						<warmupTime>1.8</warmupTime>
						<range>88</range>
						<soundCast>DV_Shot_PhotonSMG</soundCast>
						<soundCastTail>GunTail_Heavy</soundCastTail>
						<muzzleFlashScale>12</muzzleFlashScale>
						<ammoConsumedPerShotCount>10</ammoConsumedPerShotCount>
					</Properties>
					<AmmoUser>
						<magazineSize>50</magazineSize>
						<reloadTime>4</reloadTime>
						<ammoSet>AmmoSet_LaserpulseLongrifle</ammoSet>
					</AmmoUser>
					<FireModes>
						<aiAimMode>AimedShot</aiAimMode>
					</FireModes>
					<weaponTags>
						<li>CE_AI_SR</li>
						<li>Bipod_AMR</li>
						<li>Longrifle</li>
					</weaponTags>
				</li>

				<li Class="PatchOperationAddModExtension">
				  <xpath>Defs/ThingDef[defName="DV_Gun_LaserpulseLongrifle"]</xpath>
					  <value>
						  <li Class="EBSGFramework.EquipRestrictExtension">
							<requiredGenesToEquip>
								<li>DV_Farsighted</li>
							</requiredGenesToEquip>
						  </li>
					  </value>
				</li>

				<li Class="PatchOperationAdd">
				  <xpath>Defs/ThingDef[defName="DV_Gun_LaserpulseLongrifle"]</xpath>
					<value>
						<equippedAngleOffset>45</equippedAngleOffset>
					</value>
				</li>

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