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

	<!-- Remove variants -->

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[@Name="BasePsyBlaster_Focus" or @Name="BasePsyBlaster_NeuralHeat"]/recipeMaker/recipeUsers</xpath>
		<value>
			<recipeUsers Inherit="False" />
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[@Name="BasePsyBlaster_Focus" or @Name="BasePsyBlaster_NeuralHeat"]/recipeMaker/researchPrerequisite</xpath>
		<value>
			<researchPrerequisite Inherit="False" />
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[@Name="BasePsyBlaster_Focus" or @Name="BasePsyBlaster_NeuralHeat"]</xpath>
		<value>
			<thingSetMakerTags Inherit="False" />
			<tradeability>None</tradeability>
			<generateCommonality>0</generateCommonality>
		</value>
	</Operation>

	<!-- Tools -->

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="PB_Pistol"]</xpath>
		<value>
			<tools Inherit="False">
				<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="PatchOperationAdd">
		<xpath>
			Defs/ThingDef[
			defName="PB_Rifle" or
			defName="PB_Shotgun" or
			defName="PB_Sniper"]
		</xpath>
		<value>
			<tools Inherit="False">
				<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="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="PB_Braindump_RocketLauncher"]</xpath>
		<value>
			<tools Inherit="False">
				<li Class="CombatExtended.ToolCE">
					<label>barrel</label>
					<capacities>
						<li>Blunt</li>
					</capacities>
					<power>10</power>
					<cooldownTime>2.44</cooldownTime>
					<armorPenetrationBlunt>3.5</armorPenetrationBlunt>
					<linkedBodyPartsGroup>Barrel</linkedBodyPartsGroup>
				</li>
			</tools>
		</value>
	</Operation>


	<!-- Psyblaster rifle-->

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>PB_Rifle</defName>
		<statBases>
			<Mass>3</Mass>
			<RangedWeapon_Cooldown>0.36</RangedWeapon_Cooldown>
			<SightsEfficiency>1.10</SightsEfficiency>
			<ShotSpread>0.08</ShotSpread>
			<SwayFactor>1.20</SwayFactor>
			<Bulk>7.00</Bulk>
			<WorkToMake>49000</WorkToMake>
		</statBases>
		<costList>
			<Steel>45</Steel>
			<Plasteel>25</Plasteel>
			<ComponentIndustrial>4</ComponentIndustrial>
			<ComponentSpacer>1</ComponentSpacer>
			<Chemfuel>10</Chemfuel>
			<VPE_Eltex MayRequire="VanillaExpanded.VPsycastsE">2</VPE_Eltex>
		</costList>
		<Properties>
			<recoilAmount>1.46</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_6x24mmPsychic</defaultProjectile>
			<warmupTime>1.0</warmupTime>
			<range>55</range>
			<ticksBetweenBurstShots>5</ticksBetweenBurstShots>
			<burstShotCount>6</burstShotCount>
			<soundCast>Shot_ChargeRifle</soundCast>
			<soundCastTail>GunTail_Medium</soundCastTail>
			<muzzleFlashScale>9</muzzleFlashScale>
		</Properties>
		<AmmoUser>
			<magazineSize>30</magazineSize>
			<reloadTime>4</reloadTime>
			<ammoSet>AmmoSet_6x24mmPsychic</ammoSet>
		</AmmoUser>
		<FireModes>
			<aimedBurstShotCount>3</aimedBurstShotCount>
			<aiUseBurstMode>TRUE</aiUseBurstMode>
			<aiAimMode>AimedShot</aiAimMode>
		</FireModes>
		<weaponTags>
			<li>CE_AI_AR</li>
			<li>AdvancedGun</li>
		</weaponTags>
		<researchPrerequisite>PB_Psyblasters</researchPrerequisite>
	</Operation>

	<!-- Psyblaster pistol -->

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>PB_Pistol</defName>
		<statBases>
			<WorkToMake>17000</WorkToMake>
			<Mass>1.30</Mass>
			<Bulk>2.20</Bulk>
			<SwayFactor>1.07</SwayFactor>
			<ShotSpread>0.15</ShotSpread>
			<SightsEfficiency>0.8</SightsEfficiency>
			<RangedWeapon_Cooldown>0.36</RangedWeapon_Cooldown>
		</statBases>
		<costList>
			<Steel>20</Steel>
			<Plasteel>30</Plasteel>
			<Chemfuel>5</Chemfuel>
			<ComponentIndustrial>2</ComponentIndustrial>
			<ComponentSpacer>1</ComponentSpacer>
			<VPE_Eltex MayRequire="VanillaExpanded.VPsycastsE">1</VPE_Eltex>
		</costList>
		<Properties>
			<recoilAmount>2.82</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>True</hasStandardCommand>
			<defaultProjectile>Bullet_6x18mmPsychic</defaultProjectile>
			<burstShotCount>3</burstShotCount>
			<ticksBetweenBurstShots>5</ticksBetweenBurstShots>
			<warmupTime>0.5</warmupTime>
			<range>12</range>
			<soundCast>Shot_ChargeRifle</soundCast>
			<soundCastTail>GunTail_Light</soundCastTail>
			<muzzleFlashScale>9</muzzleFlashScale>
		</Properties>
		<AmmoUser>
			<magazineSize>15</magazineSize>
			<reloadTime>4</reloadTime>
			<ammoSet>AmmoSet_6x18mmPsychic</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiAimMode>Snapshot</aiAimMode>
			<aiUseBurstMode>True</aiUseBurstMode>
			<aimedBurstShotCount>2</aimedBurstShotCount>
		</FireModes>
		<weaponTags>
			<li>SpacerGun</li>
			<li>CE_Sidearm</li>
			<li>CE_OneHandedWeapon</li>
		</weaponTags>
	</Operation>

	<!-- Psyblaster shotgun-->

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>PB_Shotgun</defName>
		<statBases>
			<WorkToMake>46000</WorkToMake>
			<Mass>4.35</Mass>
			<Bulk>6.0</Bulk>
			<SwayFactor>1.25</SwayFactor>
			<ShotSpread>0.14</ShotSpread>
			<SightsEfficiency>1</SightsEfficiency>
			<RangedWeapon_Cooldown>0.36</RangedWeapon_Cooldown>
		</statBases>
		<costList>
			<Steel>50</Steel>
			<Plasteel>25</Plasteel>
			<Chemfuel>15</Chemfuel>
			<ComponentIndustrial>4</ComponentIndustrial>
			<ComponentSpacer>1</ComponentSpacer>
			<VPE_Eltex MayRequire="VanillaExpanded.VPsycastsE">2</VPE_Eltex>
		</costList>
		<Properties>
			<recoilAmount>3.0</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>True</hasStandardCommand>
			<defaultProjectile>Bullet_12GaugePsychic</defaultProjectile>
			<warmupTime>0.5</warmupTime>
			<range>20</range>
			<soundCast>Shot_ChargeRifle</soundCast>
			<soundCastTail>GunTail_Heavy</soundCastTail>
			<muzzleFlashScale>9</muzzleFlashScale>
		</Properties>
		<AmmoUser>
			<magazineSize>12</magazineSize>
			<reloadTime>0.85</reloadTime>
			<reloadOneAtATime>True</reloadOneAtATime>
			<ammoSet>AmmoSet_12GaugePsychic</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiAimMode>Snapshot</aiAimMode>
		</FireModes>
		<weaponTags>
			<li>SpacerGun</li>
			<li>CE_AI_AssaultWeapon</li>
		</weaponTags>
	</Operation>

	<!-- Psyblaster sniper -->

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>PB_Sniper</defName>
		<statBases>
			<WorkToMake>49000</WorkToMake>
			<Mass>7.5</Mass>
			<Bulk>14.5</Bulk>
			<SwayFactor>1.62</SwayFactor>
			<ShotSpread>0.03</ShotSpread>
			<SightsEfficiency>2.6</SightsEfficiency>
			<RangedWeapon_Cooldown>0.42</RangedWeapon_Cooldown>
			<NightVisionEfficiency_Weapon>0.4</NightVisionEfficiency_Weapon>
		</statBases>
		<costList>
			<Steel>75</Steel>
			<Plasteel>40</Plasteel>
			<Chemfuel>15</Chemfuel>
			<ComponentIndustrial>6</ComponentIndustrial>
			<ComponentSpacer>1</ComponentSpacer>
			<VPE_Eltex MayRequire="VanillaExpanded.VPsycastsE">2</VPE_Eltex>
		</costList>
		<Properties>
			<recoilAmount>1.8</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>True</hasStandardCommand>
			<defaultProjectile>Bullet_8x50mmPsychic</defaultProjectile>
			<warmupTime>1.6</warmupTime>
			<range>81</range>
			<soundCast>Shot_ChargeRifle</soundCast>
			<soundCastTail>GunTail_Medium</soundCastTail>
			<muzzleFlashScale>11</muzzleFlashScale>
		</Properties>
		<AmmoUser>
			<magazineSize>10</magazineSize>
			<reloadTime>4</reloadTime>
			<ammoSet>AmmoSet_8x50mmPsychic</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiAimMode>AimedShot</aiAimMode>
		</FireModes>
		<weaponTags>
			<li>SniperRifle</li>
			<li>AdvancedGun</li>
			<li>SpacerGun</li>
			<li>CE_AI_SR</li>
			<li>Bipod_DMR</li>
		</weaponTags>
	</Operation>

	<!-- Psychic explosive -->

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>PB_Braindump_RocketLauncher</defName>
		<statBases>
			<WorkToMake>32000</WorkToMake>
			<Mass>8</Mass>
			<Bulk>11</Bulk>
			<SwayFactor>1.67</SwayFactor>
			<ShotSpread>0.15</ShotSpread>
			<SightsEfficiency>1.5</SightsEfficiency>
			<RangedWeapon_Cooldown>2</RangedWeapon_Cooldown>
		</statBases>
		<costList>
			<Steel>40</Steel>
			<Plasteel>30</Plasteel>
			<Chemfuel>10</Chemfuel>
			<ComponentIndustrial>3</ComponentIndustrial>
			<ComponentSpacer>2</ComponentSpacer>
			<VPE_Eltex MayRequire="VanillaExpanded.VPsycastsE">3</VPE_Eltex>
		</costList>
		<Properties>
			<recoilAmount>3.0</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>True</hasStandardCommand>
			<defaultProjectile>Bullet_PsyblasterRocket</defaultProjectile>
			<warmupTime>2</warmupTime>
			<range>40</range>
			<soundCast>Shot_ChargeRifle</soundCast>
			<soundCastTail>GunTail_Heavy</soundCastTail>
			<muzzleFlashScale>15</muzzleFlashScale>
			<targetParams>
				<canTargetLocations>true</canTargetLocations>
			</targetParams>	
		</Properties>
		<FireModes>
			<aiAimMode>AimedShot</aiAimMode>
		</FireModes>
		<weaponTags Inherit="False" /> <!-- probably not a good idea to give a weapon that does 0 damage to raiders-->
	</Operation>

</Patch>