<?xml version="1.0" encoding="utf-8"?>
<Patch>
	<!-- ========== Sergal Musket (CE implementation based on Musket from Vanilla Weapons Expanded) ========== -->

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>SergalBurnCannon</defName>
		<statBases>
			<Bulk>14.9</Bulk>
			<Mass>4.8</Mass>
			<SwayFactor>1.92</SwayFactor>
			<ShotSpread>0.10</ShotSpread>
			<SightsEfficiency>1.0</SightsEfficiency>
			<RangedWeapon_Cooldown>1.35</RangedWeapon_Cooldown>
			<WorkToMake>20000</WorkToMake>
		</statBases>
		<costList>
			<WoodLog>15</WoodLog>
			<Steel>65</Steel>
			<ComponentIndustrial>1</ComponentIndustrial>
		</costList>
		<Properties>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_Sergal_LeadBall</defaultProjectile>
			<warmupTime>2.5</warmupTime>
			<range>45</range>
			<soundCast>Sergalgun</soundCast>
			<soundCastTail>GunTail_Heavy</soundCastTail>
			<muzzleFlashScale>12</muzzleFlashScale>
		</Properties>

		<AmmoUser>
			<magazineSize>1</magazineSize>
			<AmmoGenPerMagOverride>3</AmmoGenPerMagOverride>
			<reloadTime>10</reloadTime>
			<ammoSet>AmmoSet_Sergal_LeadBall</ammoSet>
		</AmmoUser>

		<FireModes>
			<aiUseBurstMode>FALSE</aiUseBurstMode>
			<aiAimMode>AimedShot</aiAimMode>
		</FireModes>

		<weaponTags>
			<li>MedievalShields_ValidSidearm</li>
			<li>SergalRifle</li>
		</weaponTags>

		<AllowWithRunAndGun>false</AllowWithRunAndGun>
	</Operation>

	<!-- ========== Sergal Early Rifle (CE implementation based on Lee Enfield N°4 MkI) ========== -->

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>SergalFrostCannon</defName>
		<statBases>
			<Mass>4.11</Mass>
			<RangedWeapon_Cooldown>1.17</RangedWeapon_Cooldown>
			<SightsEfficiency>1.00</SightsEfficiency>
			<ShotSpread>0.04</ShotSpread>
			<SwayFactor>1.54</SwayFactor>
			<Bulk>11.29</Bulk>
			<WorkToMake>11500</WorkToMake>
		</statBases>
		<costList>
			<WoodLog>15</WoodLog>
			<Steel>50</Steel>
			<ComponentIndustrial>1</ComponentIndustrial>
		</costList>
		<Properties>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_303British_FMJ</defaultProjectile>
			<warmupTime>1.1</warmupTime>
			<range>55</range>
			<soundCast>Sergalgun</soundCast>
			<soundCastTail>GunTail_Heavy</soundCastTail>
			<muzzleFlashScale>12</muzzleFlashScale>
		</Properties>

		<AmmoUser>
			<magazineSize>10</magazineSize>
			<reloadTime>4.3</reloadTime>
			<ammoSet>AmmoSet_303British</ammoSet>
		</AmmoUser>

		<FireModes>
			<aiUseBurstMode>FALSE</aiUseBurstMode>
			<aiAimMode>AimedShot</aiAimMode>
		</FireModes>

		<weaponTags>
			<li>MedievalShields_ValidSidearm</li>
			<li>SergalRifle</li>
		</weaponTags>

		<AllowWithRunAndGun>false</AllowWithRunAndGun>
	</Operation>

	<!-- == Shared patches for firearm melee tools == -->

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[
			defName="SergalBurnCannon" or
			defName="SergalFrostCannon"
			]/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>
</Patch>