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

	<Operation Class="PatchOperationAddModExtension">
		<xpath>Defs/ThingDef[
			defName="RH2Mech_KV2Walker" or
			defName="RH2Mech_TeslaDrone" or
			defName="RH2Mech_PlasmaDrone"
			]</xpath>
		<value>
			<li Class="CombatExtended.RacePropertiesExtensionCE">
				<bodyShape>Humanoid</bodyShape>
			</li>
		</value>
	</Operation>

	<!--KV2-->
	<!--Overall the KV2 is rescaled to be much more durable, with much higher combatPower. The fragments from their main weapon are an unreasonable source of lag if too many spawn-->
	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="RH2Mech_KV2Walker"]/statBases</xpath>
		<value>
			<CarryWeight>125</CarryWeight>
			<CarryBulk>125</CarryBulk>
			<AimingAccuracy>1.0</AimingAccuracy>
			<ShootingAccuracyPawn>1.0</ShootingAccuracyPawn>
			<MeleeCritChance>0.25</MeleeCritChance>
			<MaxHitPoints>500</MaxHitPoints>
		</value>
	</Operation>

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

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="RH2Mech_KV2Walker"]/statBases/ArmorRating_Sharp</xpath>
		<value>
			<ArmorRating_Sharp>30</ArmorRating_Sharp>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="RH2Mech_KV2Walker"]/comps</xpath>
		<value>
			<li Class="CombatExtended.CompProperties_ArmorDurability">
				<Durability>2500</Durability>
				<Regenerates>false</Regenerates>
				<MinArmorPct>0.5</MinArmorPct>
				<Repairable>true</Repairable>
				<RepairIngredients>
					<Steel>5</Steel>
				</RepairIngredients>
				<RepairTime>200</RepairTime>
				<RepairValue>250</RepairValue>
				<MinArmorValueSharp>15</MinArmorValueSharp>
				<MinArmorValueBlunt>37</MinArmorValueBlunt>
			</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="RH2Mech_KV2Walker"]/butcherProducts</xpath>
		<value>
			<Ammo_127x108mm_FMJ>100</Ammo_127x108mm_FMJ>
		</value>
	</Operation>

	<Operation Class="PatchOperationAddModExtension">
		<xpath>Defs/ThingDef[defName="RH2Mech_KV2Walker"]</xpath>
		<value>
			<li Class="CombatExtended.PartialArmorExt">
				<stats>
					<li>
						<ArmorRating_Sharp>0.25</ArmorRating_Sharp>
						<parts>
							<li>SightSensor</li>
						</parts>
					</li>
					<li>
						<ArmorRating_Blunt>0.25</ArmorRating_Blunt>
						<parts>
							<li>SightSensor</li>
						</parts>
					</li>
					<li>
						<ArmorRating_Sharp>0.25</ArmorRating_Sharp>
						<parts>
							<li>HearingSensor</li>
						</parts>
					</li>
					<li>
						<ArmorRating_Blunt>0.25</ArmorRating_Blunt>
						<parts>
							<li>HearingSensor</li>
						</parts>
					</li>
					<li>
						<ArmorRating_Sharp>0.6</ArmorRating_Sharp>
						<parts>
							<li>MechanicalLeg</li>
						</parts>
					</li>
					<li>
						<ArmorRating_Blunt>0.5</ArmorRating_Blunt>
						<parts>
							<li>MechanicalLeg</li>
						</parts>
					</li>
				</stats>
			</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationRemove">
		<xpath>Defs/ThingDef[defName="RH2Mech_KV2Walker"]/comps/li[@Class="CompProperties_TurretGun" and turretDef="RNGun_KV2_KrohaLauncher"]</xpath>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="RH2Mech_KV2Walker"]/tools</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<label>bi-pedal foot</label>
					<capacities>
						<li>Blunt</li>
					</capacities>
					<power>85</power>
					<cooldownTime>3</cooldownTime>
					<linkedBodyPartsGroup>FrontLeftLeg</linkedBodyPartsGroup>
					<ensureLinkedBodyPartsGroupAlwaysUsable>true</ensureLinkedBodyPartsGroupAlwaysUsable>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>bi-pedal foot</label>
					<capacities>
						<li>Blunt</li>
					</capacities>
					<power>85</power>
					<cooldownTime>3</cooldownTime>
					<linkedBodyPartsGroup>FrontRightLeg</linkedBodyPartsGroup>
					<ensureLinkedBodyPartsGroupAlwaysUsable>true</ensureLinkedBodyPartsGroupAlwaysUsable>
				</li>
			</tools>
		</value>
	</Operation>

	<Operation Class="PatchOperationAddModExtension">
		<xpath>Defs/PawnKindDef[defName="RH2Mech_KV2Walker"]</xpath>
		<value>
			<li Class="CombatExtended.LoadoutPropertiesExtension">
				<primaryMagazineCount>
					<min>10</min>
					<max>20</max>
				</primaryMagazineCount>
				<forcedAmmoCategory>GrenadeHE</forcedAmmoCategory>
			</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="RH2Mech_KV2Walker"]/race/baseHealthScale</xpath>
		<value>
			<baseHealthScale>8</baseHealthScale>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/PawnKindDef[defName="RH2Mech_KV2Walker"]/combatPower</xpath>
		<value>
			<combatPower>1400</combatPower>
		</value>
	</Operation>

	<!--Soviet Drones are functionally identical to each other except for the weapon-->
	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="RH2Mech_TeslaDrone" or defName="RH2Mech_PlasmaDrone"]/statBases</xpath>
		<value>
			<CarryWeight>80</CarryWeight>
			<CarryBulk>20</CarryBulk>
			<AimingAccuracy>1.0</AimingAccuracy>
			<ShootingAccuracyPawn>1.0</ShootingAccuracyPawn>
			<MeleeCritChance>0.25</MeleeCritChance>
			<MaxHitPoints>300</MaxHitPoints>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="RH2Mech_TeslaDrone" or defName="RH2Mech_PlasmaDrone"]/statBases/ArmorRating_Blunt</xpath>
		<value>
			<ArmorRating_Blunt>50</ArmorRating_Blunt>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="RH2Mech_TeslaDrone" or defName="RH2Mech_PlasmaDrone"]/statBases/ArmorRating_Sharp</xpath>
		<value>
			<ArmorRating_Sharp>20</ArmorRating_Sharp>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="RH2Mech_TeslaDrone" or defName="RH2Mech_PlasmaDrone"]/comps</xpath>
		<value>
			<li Class="CombatExtended.CompProperties_ArmorDurability">
				<Durability>1500</Durability>
				<Regenerates>false</Regenerates>
				<MinArmorPct>0.5</MinArmorPct>
				<Repairable>true</Repairable>
				<RepairIngredients>
					<Steel>3</Steel>
				</RepairIngredients>
				<RepairTime>140</RepairTime>
				<RepairValue>150</RepairValue>
				<MinArmorValueSharp>10</MinArmorValueSharp>
				<MinArmorValueBlunt>25</MinArmorValueBlunt>
			</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="RH2Mech_TeslaDrone" or defName="RH2Mech_PlasmaDrone"]/race/baseHealthScale</xpath>
		<value>
			<baseHealthScale>4</baseHealthScale>
		</value>
	</Operation>

	<Operation Class="PatchOperationAddModExtension">
		<xpath>Defs/ThingDef[defName="RH2Mech_TeslaDrone" or defName="RH2Mech_PlasmaDrone"]</xpath>
		<value>
			<li Class="CombatExtended.PartialArmorExt">
				<stats>
					<li>
						<ArmorRating_Sharp>0.1</ArmorRating_Sharp>
						<parts>
							<li>SightSensor</li>
						</parts>
					</li>
					<li>
						<ArmorRating_Blunt>0.1</ArmorRating_Blunt>
						<parts>
							<li>SightSensor</li>
						</parts>
					</li>
					<li>
						<ArmorRating_Sharp>0.1</ArmorRating_Sharp>
						<parts>
							<li>HearingSensor</li>
						</parts>
					</li>
					<li>
						<ArmorRating_Blunt>0.1</ArmorRating_Blunt>
						<parts>
							<li>HearingSensor</li>
						</parts>
					</li>
					<li>
						<ArmorRating_Sharp>1.5</ArmorRating_Sharp>
						<parts>
							<li>MechanicalShoulder</li>
						</parts>
					</li>
					<li>
						<ArmorRating_Blunt>1.5</ArmorRating_Blunt>
						<parts>
							<li>MechanicalShoulder</li>
						</parts>
					</li>
				</stats>
			</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="RH2Mech_TeslaDrone" or defName="RH2Mech_PlasmaDrone"]/tools</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<label>left power fist</label>
					<capacities>
						<li>Blunt</li>
					</capacities>
					<power>22</power>
					<cooldownTime>2</cooldownTime>
					<linkedBodyPartsGroup>LeftHand</linkedBodyPartsGroup>
					<alwaysTreatAsWeapon>true</alwaysTreatAsWeapon>
				</li>
				<li Class="CombatExtended.ToolCE">
					<label>right power fist</label>
					<capacities>
						<li>Blunt</li>
					</capacities>
					<power>25</power>
					<cooldownTime>2</cooldownTime>
					<linkedBodyPartsGroup>RightHand</linkedBodyPartsGroup>
					<alwaysTreatAsWeapon>true</alwaysTreatAsWeapon>
					<ensureLinkedBodyPartsGroupAlwaysUsable>true</ensureLinkedBodyPartsGroupAlwaysUsable>
				</li>
			</tools>
		</value>
	</Operation>

	<Operation Class="PatchOperationAddModExtension">
		<xpath>Defs/PawnKindDef[defName="RH2Mech_TeslaDrone"]</xpath>
		<value>
			<li Class="CombatExtended.LoadoutPropertiesExtension">
				<primaryMagazineCount>
					<min>20</min>
					<max>30</max>
				</primaryMagazineCount>
			</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/PawnKindDef[defName="RH2Mech_TeslaDrone"]/combatPower</xpath>
		<value>
			<combatPower>400</combatPower>
		</value>
	</Operation>

	<Operation Class="PatchOperationAddModExtension">
		<xpath>Defs/PawnKindDef[defName="RH2Mech_PlasmaDrone"]</xpath>
		<value>
			<li Class="CombatExtended.LoadoutPropertiesExtension">
				<primaryMagazineCount>
					<min>20</min>
					<max>25</max>
				</primaryMagazineCount>
			</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/PawnKindDef[defName="RH2Mech_PlasmaDrone"]/combatPower</xpath>
		<value>
			<combatPower>450</combatPower>
		</value>
	</Operation>

</Patch>