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

	<!-- ========== Ship Charge Blaster ========== -->

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFE_Turret_ChargeBlasterCannon"]/thingClass</xpath>
		<value>
			<thingClass>CombatExtended.Building_TurretGunCE</thingClass>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFE_Turret_ChargeBlasterCannon"]/statBases/ShootingAccuracyTurret</xpath>
		<value>
			<ShootingAccuracyTurret>0.75</ShootingAccuracyTurret>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="VFE_Turret_ChargeBlasterCannon"]/statBases</xpath>
		<value>
			<AimingAccuracy>0.5</AimingAccuracy>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFE_Turret_ChargeBlasterCannon"]/statBases/Mass</xpath>
		<value>
			<Mass>300</Mass>
		</value>
	</Operation>

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[defName="VFE_Turret_ChargeBlasterCannon"]/comps/li[@Class="CompProperties_Explosive"]</xpath>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFE_Turret_ChargeBlasterCannon"]/fillPercent</xpath>
		<value>
			<fillPercent>0.85</fillPercent>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFE_Turret_ChargeBlasterCannon"]/building/turretBurstCooldownTime</xpath>
		<value>
			<turretBurstCooldownTime>2.0</turretBurstCooldownTime>
		</value>
	</Operation>

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>VFE_Gun_ChargeBlasterCannon</defName>
		<statBases>
			<Mass>200.00</Mass>
			<RangedWeapon_Cooldown>0.36</RangedWeapon_Cooldown>
			<SightsEfficiency>1</SightsEfficiency>
			<ShotSpread>0.01</ShotSpread>
			<SwayFactor>1.33</SwayFactor>
		</statBases>
		<Properties>
			<recoilAmount>0.45</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_12x64mmCharged</defaultProjectile>
			<warmupTime>3.0</warmupTime>
			<range>75</range>
			<ticksBetweenBurstShots>6</ticksBetweenBurstShots>
			<burstShotCount>20</burstShotCount>
			<soundCast>Shot_ChargeBlaster</soundCast>
			<soundCastTail>GunTail_Heavy</soundCastTail>
			<muzzleFlashScale>9</muzzleFlashScale>
		</Properties>
		<FireModes>
			<aiAimMode>AimedShot</aiAimMode>
			<noSingleShot>true</noSingleShot>
		</FireModes>
	</Operation>

	<!-- ========== Ship Charge Lance ========== -->

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFE_Turret_ChargeLanceCannon"]/thingClass</xpath>
		<value>
			<thingClass>CombatExtended.Building_TurretGunCE</thingClass>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFE_Turret_ChargeLanceCannon"]/statBases/ShootingAccuracyTurret</xpath>
		<value>
			<ShootingAccuracyTurret>1.5</ShootingAccuracyTurret>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="VFE_Turret_ChargeLanceCannon"]/statBases</xpath>
		<value>
			<AimingAccuracy>1</AimingAccuracy>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFE_Turret_ChargeLanceCannon"]/statBases/Mass</xpath>
		<value>
			<Mass>85</Mass>
		</value>
	</Operation>

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[defName="VFE_Turret_ChargeLanceCannon"]/comps/li[@Class="CompProperties_Explosive"]</xpath>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFE_Turret_ChargeLanceCannon"]/fillPercent</xpath>
		<value>
			<fillPercent>0.85</fillPercent>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFE_Turret_ChargeLanceCannon"]/building/turretBurstCooldownTime</xpath>
		<value>
			<turretBurstCooldownTime>1</turretBurstCooldownTime>
		</value>
	</Operation>

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>VFE_Gun_ChargeLanceCannon</defName>
		<statBases>
			<Mass>35.00</Mass>
			<RangedWeapon_Cooldown>0.35</RangedWeapon_Cooldown>
			<SightsEfficiency>1</SightsEfficiency>
			<ShotSpread>0.01</ShotSpread>
			<SwayFactor>0.44</SwayFactor>
		</statBases>
		<Properties>
			<recoilAmount>0.44</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>VFE_Bullet_5x35mmHyper</defaultProjectile>
			<warmupTime>2.0</warmupTime>
			<range>86</range>
			<burstShotCount>1</burstShotCount>
			<soundCast>ChargeLance_Fire</soundCast>
			<soundCastTail>GunTail_Heavy</soundCastTail>
			<muzzleFlashScale>9</muzzleFlashScale>
			<minRange>1.9</minRange>
		</Properties>
		<FireModes>
			<aiAimMode>AimedShot</aiAimMode>
			<noSnapshot>true</noSnapshot>
		</FireModes>
	</Operation>

	<!-- ========== Auto Inferno Cannon ========== -->

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFE_Turret_InfernoLauncherArtillery"]/thingClass</xpath>
		<value>
			<thingClass>CombatExtended.Building_TurretGunCE</thingClass>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFE_Turret_InfernoLauncherArtillery"]/statBases/ShootingAccuracyTurret</xpath>
		<value>
			<ShootingAccuracyTurret>0.5</ShootingAccuracyTurret>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="VFE_Turret_InfernoLauncherArtillery"]/statBases</xpath>
		<value>
			<AimingAccuracy>0.5</AimingAccuracy>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFE_Turret_InfernoLauncherArtillery"]/statBases/Mass</xpath>
		<value>
			<Mass>600</Mass>
		</value>
	</Operation>

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[defName="VFE_Turret_InfernoLauncherArtillery"]/comps/li[@Class="CompProperties_Explosive"]</xpath>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFE_Turret_InfernoLauncherArtillery"]/fillPercent</xpath>
		<value>
			<fillPercent>0.85</fillPercent>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFE_Turret_InfernoLauncherArtillery"]/building/turretBurstCooldownTime</xpath>
		<value>
			<turretBurstCooldownTime>12.0</turretBurstCooldownTime>
		</value>
	</Operation>

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>VFE_Gun_InfernoArtillery</defName>
		<statBases>
			<Mass>300.00</Mass>
			<RangedWeapon_Cooldown>2.52</RangedWeapon_Cooldown>
			<SightsEfficiency>1</SightsEfficiency>
			<ShotSpread>0.01</ShotSpread>
			<SwayFactor>0.82</SwayFactor>
		</statBases>
		<Properties>
			<recoilAmount>1.3</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_80x256mmFuel_Incendiary</defaultProjectile>
			<warmupTime>8.6</warmupTime>
			<range>86</range>
			<ticksBetweenBurstShots>60</ticksBetweenBurstShots>
			<burstShotCount>3</burstShotCount>
			<soundCast>InfernoCannon_Fire</soundCast>
			<soundCastTail>GunTail_Light</soundCastTail>
			<muzzleFlashScale>14</muzzleFlashScale>
			<ai_AvoidFriendlyFireRadius>5</ai_AvoidFriendlyFireRadius>
			<minRange>9.9</minRange>
			<ai_IsBuildingDestroyer>true</ai_IsBuildingDestroyer>
			<recoilPattern>Mounted</recoilPattern>
		</Properties>
		<FireModes>
			<aiAimMode>AimedShot</aiAimMode>
			<noSnapshot>true</noSnapshot>
		</FireModes>
	</Operation>

	<!-- ========== Auto Mortar ========== -->

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFE_Turret_AutoMortarCannon"]/thingClass</xpath>
		<value>
			<thingClass>CombatExtended.Building_TurretGunCE</thingClass>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFE_Turret_AutoMortarCannon"]/statBases/ShootingAccuracyTurret</xpath>
		<value>
			<ShootingAccuracyTurret>0.5</ShootingAccuracyTurret>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="VFE_Turret_AutoMortarCannon"]/statBases</xpath>
		<value>
			<AimingAccuracy>0.25</AimingAccuracy>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFE_Turret_AutoMortarCannon"]/statBases/Mass</xpath>
		<value>
			<Mass>75</Mass>
		</value>
	</Operation>

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[defName="VFE_Turret_AutoMortarCannon"]/comps/li[@Class="CompProperties_Explosive"]</xpath>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFE_Turret_AutoMortarCannon"]/fillPercent</xpath>
		<value>
			<fillPercent>0.85</fillPercent>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="VFE_Gun_AutoMortarCannon"]</xpath>
		<value>
			<statBases>
				<SightsEfficiency>0.5</SightsEfficiency>
			</statBases>
		</value>
	</Operation>

	<!--Test for comps and add if not present-->

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

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="VFE_Gun_AutoMortarCannon"]/comps</xpath>
		<value>
			<li Class="CombatExtended.CompProperties_Charges">
				<chargeSpeeds>
					<li>30</li>
					<li>50</li>
					<li>70</li>
					<li>90</li>
				</chargeSpeeds>
			</li>
		</value>
	</Operation>

	<!--Test for tags and add if not present-->

	<Operation Class="PatchOperationConditional">
		<xpath>Defs/ThingDef[defName="VFE_Gun_AutoMortarCannon"]/weaponTags</xpath>
		<nomatch Class="PatchOperationAdd">
			<xpath>Defs/ThingDef[defName="VFE_Gun_AutoMortarCannon"]</xpath>
			<value>
				<weaponTags />
			</value>
		</nomatch>
		<match Class="PatchOperationAdd">
			<xpath>Defs/ThingDef[defName="VFE_Gun_AutoMortarCannon"]</xpath>
			<value>
			</value>
		</match>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="VFE_Gun_AutoMortarCannon"]/weaponTags</xpath>
		<value>
			<li>TurretGun</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFE_Gun_AutoMortarCannon"]/verbs</xpath>
		<value>
			<verbs>
				<li Class="CombatExtended.VerbPropertiesCE">
					<verbClass>CombatExtended.Verb_ShootMortarCE</verbClass>
					<forceNormalTimeSpeed>false</forceNormalTimeSpeed>
					<hasStandardCommand>true</hasStandardCommand>
					<defaultProjectile>Bullet_66mmThermalBolt_Incendiary</defaultProjectile>
					<warmupTime>11</warmupTime>
					<minRange>32</minRange>
					<range>700</range>
					<burstShotCount>1</burstShotCount>
					<soundCast>Mortar_LaunchA</soundCast>
					<muzzleFlashScale>16</muzzleFlashScale>
					<circularError>1</circularError>
					<indirectFirePenalty>0.2</indirectFirePenalty>
					<targetParams>
						<canTargetLocations>true</canTargetLocations>
					</targetParams>
				</li>
			</verbs>
		</value>
	</Operation>

	<!-- ========== Ship Charge Railgun ========== -->

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFE_Turret_ChargeRailgun"]/thingClass</xpath>
		<value>
			<thingClass>CombatExtended.Building_TurretGunCE</thingClass>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFE_Turret_ChargeRailgun"]/statBases/ShootingAccuracyTurret</xpath>
		<value>
			<ShootingAccuracyTurret>1.5</ShootingAccuracyTurret>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="VFE_Turret_ChargeRailgun"]/statBases</xpath>
		<value>
			<AimingAccuracy>2</AimingAccuracy>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFE_Turret_ChargeRailgun"]/statBases/Mass</xpath>
		<value>
			<Mass>800</Mass>
		</value>
	</Operation>

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[defName="VFE_Turret_ChargeRailgun"]/comps/li[@Class="CompProperties_Explosive"]</xpath>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFE_Turret_ChargeRailgun"]/fillPercent</xpath>
		<value>
			<fillPercent>0.99</fillPercent>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="VFE_Turret_ChargeRailgun"]/building/turretBurstCooldownTime</xpath>
		<value>
			<turretBurstCooldownTime>18.0</turretBurstCooldownTime>
		</value>
	</Operation>

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>VFE_Gun_ChargeRailgun</defName>
		<statBases>
			<Mass>300.00</Mass>
			<RangedWeapon_Cooldown>0.36</RangedWeapon_Cooldown>
			<SightsEfficiency>4.5</SightsEfficiency>
			<ShotSpread>0.01</ShotSpread>
			<SwayFactor>1.33</SwayFactor>
		</statBases>
		<Properties>
			<recoilAmount>0.92</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>VFE_Bullet_ChargeRailgun_CE</defaultProjectile>
			<warmupTime>5.2</warmupTime>
			<range>500</range>
			<burstShotCount>1</burstShotCount>
			<soundCast>VFE_Shot_ChargeRailgun</soundCast>
			<soundCastTail>GunTail_Heavy</soundCastTail>
			<muzzleFlashScale>16</muzzleFlashScale>
			<minRange>8.9</minRange>
		</Properties>
		<FireModes>
			<aiAimMode>AimedShot</aiAimMode>
			<noSnapshot>true</noSnapshot>
		</FireModes>
	</Operation>

</Patch>