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

	<!-- ========== Longgun Melee Tools =========== -->
	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[
			defName="Roren_OldShotgun" or
			defName="Roren_OldRifle" or
			defName="Roren_OldMarksmanRifle"
			]/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="Roren_OldPistol"]/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>

	<!-- === Pistol === -->
	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>Roren_OldPistol</defName>
		<statBases>
			<WorkToMake>12500</WorkToMake>
			<Mass>2</Mass>
			<Bulk>2.50</Bulk>
			<SwayFactor>1.50</SwayFactor>
			<ShotSpread>0.16</ShotSpread>
			<SightsEfficiency>0.7</SightsEfficiency>
			<RangedWeapon_Cooldown>0.37</RangedWeapon_Cooldown>
		</statBases>
		<costList>
			<Steel>30</Steel>
			<ComponentIndustrial>5</ComponentIndustrial>
			<Roren_Holy_Water>1</Roren_Holy_Water>
		</costList>
		<Properties>
			<recoilAmount>2.21</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>True</hasStandardCommand>
			<defaultProjectile>Bullet_9x19mmPara_FMJ</defaultProjectile>
			<warmupTime>0.6</warmupTime>
			<range>18</range>
			<burstShotCount>6</burstShotCount>
			<ticksBetweenBurstShots>6</ticksBetweenBurstShots>
			<soundCast>Roren_Pistol_Sound</soundCast>
			<soundCastTail>GunTail_Heavy</soundCastTail>
			<muzzleFlashScale>9</muzzleFlashScale>
		</Properties>
		<AmmoUser>
			<magazineSize>20</magazineSize>
			<reloadTime>4</reloadTime>
			<ammoSet>AmmoSet_9x19mmPara</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiUseBurstMode>FALSE</aiUseBurstMode>
			<aiAimMode>Snapshot</aiAimMode>
			<aimedBurstShotCount>3</aimedBurstShotCount>
		</FireModes>
		<weaponTags>
			<li>CE_OneHandedWeapon</li>
		</weaponTags>
	</Operation>

	<!-- === Shotgun === -->

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>Roren_OldShotgun</defName>
		<statBases>
			<WorkToMake>8500</WorkToMake>
			<ShotSpread>0.10</ShotSpread>
			<SwayFactor>1.50</SwayFactor>
			<SightsEfficiency>1</SightsEfficiency>
			<RangedWeapon_Cooldown>1.10</RangedWeapon_Cooldown>
		</statBases>
		<costList>
			<Steel>40</Steel>
			<WoodLog>5</WoodLog>
			<ComponentIndustrial>1</ComponentIndustrial>
			<Roren_Holy_Water>1</Roren_Holy_Water>
		</costList>
		<Properties>
			<recoilAmount>3.75</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<defaultProjectile>Bullet_10Gauge_Buck</defaultProjectile>
			<warmupTime>0.6</warmupTime>
			<range>16</range>
			<soundCast>Roren_Shotgun_Sound</soundCast>
			<soundCastTail>GunTail_Heavy</soundCastTail>
			<muzzleFlashScale>9</muzzleFlashScale>
		</Properties>
		<AmmoUser>
			<magazineSize>6</magazineSize>
			<reloadOneAtATime>true</reloadOneAtATime>
			<reloadTime>0.85</reloadTime>
			<ammoSet>AmmoSet_10Gauge</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiAimMode>Snapshot</aiAimMode>
		</FireModes>
	</Operation>

	<!-- === Rifle === -->

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>Roren_OldRifle</defName>
		<statBases>
			<WorkToMake>28000</WorkToMake>
			<Mass>4.00</Mass>
			<Bulk>10.50</Bulk>
			<SwayFactor>1.45</SwayFactor>
			<ShotSpread>0.06</ShotSpread>
			<SightsEfficiency>1</SightsEfficiency>
			<RangedWeapon_Cooldown>0.37</RangedWeapon_Cooldown>
		</statBases>
		<costList>
			<Steel>55</Steel>
			<WoodLog>10</WoodLog>
			<ComponentIndustrial>5</ComponentIndustrial>
			<Roren_Holy_Water>1</Roren_Holy_Water>
		</costList>
		<Properties>
			<recoilAmount>2.19</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>True</hasStandardCommand>
			<defaultProjectile>Bullet_792x57mmMauser_FMJ</defaultProjectile>
			<warmupTime>1.1</warmupTime>
			<range>55</range>
			<soundCast>Roren_HeavyGun_Sound</soundCast>
			<soundCastTail>GunTail_Heavy</soundCastTail>
			<muzzleFlashScale>9</muzzleFlashScale>
		</Properties>
		<AmmoUser>
			<magazineSize>20</magazineSize>
			<reloadTime>4</reloadTime>
			<ammoSet>AmmoSet_792x57mmMauser</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiAimMode>AimedShot</aiAimMode>
		</FireModes>
	</Operation>

	<!-- === Marksman Rifle === -->

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>Roren_OldMarksmanRifle</defName>
		<statBases>
			<WorkToMake>28000</WorkToMake>
			<Mass>9.80</Mass>
			<Bulk>13.00</Bulk>
			<SwayFactor>1.45</SwayFactor>
			<ShotSpread>0.05</ShotSpread>
			<SightsEfficiency>2.30</SightsEfficiency>
			<RangedWeapon_Cooldown>0.59</RangedWeapon_Cooldown>
		</statBases>
		<costList>
			<Steel>80</Steel>
			<WoodLog>10</WoodLog>
			<ComponentIndustrial>5</ComponentIndustrial>
			<Roren_Holy_Water>1</Roren_Holy_Water>
		</costList>
		<Properties>
			<recoilAmount>2.85</recoilAmount>
			<verbClass>CombatExtended.Verb_ShootCE</verbClass>
			<hasStandardCommand>True</hasStandardCommand>
			<defaultProjectile>Bullet_132x92mmSRTuF_FMJ</defaultProjectile>
			<warmupTime>3.05</warmupTime>
			<range>75</range>
			<soundCast>Roren_HeavyGun_Sound</soundCast>
			<soundCastTail>GunTail_Heavy</soundCastTail>
			<muzzleFlashScale>7</muzzleFlashScale>
		</Properties>
		<AmmoUser>
			<magazineSize>6</magazineSize>
			<reloadTime>4</reloadTime>
			<ammoSet>AmmoSet_132x92mmSRTuF</ammoSet>
		</AmmoUser>
		<FireModes>
			<aiAimMode>AimedShot</aiAimMode>
		</FireModes>
		<weaponTags>
			<li>Bipod_DMR</li>
		</weaponTags>
		<AllowWithRunAndGun>false</AllowWithRunAndGun>
	</Operation>

	<!-- ========== Grenade ========== -->

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

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="Roren_Hand_Grenade"]</xpath>
		<value>
			<equippedAngleOffset>-90</equippedAngleOffset>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="Roren_Hand_Grenade"]/smeltable</xpath>
		<value>
			<smeltable>false</smeltable>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="Roren_Hand_Grenade"]</xpath>
		<value>
			<thingClass>CombatExtended.AmmoThing</thingClass>
			<stackLimit>75</stackLimit>
			<resourceReadoutPriority>First</resourceReadoutPriority>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="Roren_Hand_Grenade"]/graphicData/texPath</xpath>
		<value>
			<texPath>Roren_Things/Weapons/Bullet/Roren_HandGrenade</texPath>
		</value>
	</Operation>

	<Operation Class="PatchOperationAttributeSet">
		<xpath>Defs/ThingDef[defName="Roren_Hand_Grenade"]</xpath>
		<attribute>Class</attribute>
		<value>CombatExtended.AmmoDef</value>
	</Operation>

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

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="Roren_Hand_Grenade"]/comps</xpath>
		<value>
			<li Class="CombatExtended.CompProperties_ExplosiveCE">
				<damageAmountBase>60</damageAmountBase>
				<explosiveDamageType>Bomb</explosiveDamageType>
				<explosiveRadius>2</explosiveRadius>
			</li>
		</value>
	</Operation>

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>Roren_Hand_Grenade</defName>
		<statBases>
			<Mass>0.82</Mass>
			<Bulk>0.36</Bulk>
			<RangedWeapon_Cooldown>1</RangedWeapon_Cooldown>
			<SightsEfficiency>1.0</SightsEfficiency>
		</statBases>
		<Properties>
			<label>throw frag grenade</label>
			<verbClass>CombatExtended.Verb_ShootCEOneUse</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<range>13.0</range>
			<minRange>2</minRange>
			<warmupTime>0.8</warmupTime>
			<noiseRadius>4</noiseRadius>
			<ai_IsBuildingDestroyer>true</ai_IsBuildingDestroyer>
			<soundCast>ThrowGrenade</soundCast>
			<targetParams>
				<canTargetLocations>true</canTargetLocations>
			</targetParams>
			<defaultProjectile>Roren_Proj_GrenadeFrag</defaultProjectile>
			<onlyManualCast>true</onlyManualCast>
			<ignorePartialLoSBlocker>true</ignorePartialLoSBlocker>
		</Properties>
		<weaponTags>
			<li>CE_AI_Grenade</li>
			<li>CE_OneHandedWeapon</li>
		</weaponTags>
	</Operation>

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

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[defName="Roren_Hand_Grenade"]/costList</xpath>
	</Operation>

	<!-- Projectile -->

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

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="Roren_Proj_GrenadeFrag"]/projectile</xpath>
		<value>
			<projectile Class="CombatExtended.ProjectilePropertiesCE">
				<explosionRadius>2</explosionRadius>
				<damageDef>Bomb</damageDef>
				<damageAmountBase>56</damageAmountBase>
				<explosionDelay>60</explosionDelay>
				<dropsCasings>false</dropsCasings>
				<applyDamageToExplosionCellsNeighbors>true</applyDamageToExplosionCellsNeighbors>
				<speed>19</speed>
			</projectile>
		</value>
	</Operation>

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

</Patch>