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

	<Operation Class="PatchOperationFindMod">
		<mods>
			<li>Vanilla Expanded Framework</li>
		</mods>
		<match Class="PatchOperationSequence">
			<operations>

				<!--Replace ThingClass-->
				<li Class="PatchOperationReplace">
					<xpath>Defs/ThingDef[defName="BotchJob_ProfanedShield"]/thingClass</xpath>
					<value>
						<thingClass>CombatExtended.Apparel_Shield</thingClass>
					</value>
				</li>

				<!--Replace Parent-->
				<li Class="PatchOperationAttributeSet">
					<xpath>Defs/ThingDef[defName="BotchJob_ProfanedShield"]</xpath>
					<attribute>ParentName</attribute>
					<value>ArmorSmithableBase</value>
				</li>

				<!--Replace Apparel Layer & BodyPart Group-->
				<li Class="PatchOperationReplace">
					<xpath>Defs/ThingDef[defName="BotchJob_ProfanedShield"]/apparel/layers</xpath>
					<value>
						<layers>
							<li>Shield</li>
						</layers>
					</value>
				</li>

				<li Class="PatchOperationReplace">
					<xpath>Defs/ThingDef[defName="BotchJob_ProfanedShield"]/apparel/bodyPartGroups</xpath>
					<value>
						<bodyPartGroups>
							<li>LeftShoulder</li>
						</bodyPartGroups>
					</value>
				</li>

				<!--Remove VFE Shield Stuff-->
				<li Class="PatchOperationRemove">
					<xpath>Defs/ThingDef[defName="BotchJob_ProfanedShield"]/tools</xpath>
				</li>

				<li Class="PatchOperationRemove">
					<xpath>Defs/ThingDef[defName="BotchJob_ProfanedShield"]/comps/li[@Class="VEF.Apparels.CompProperties_Shield"]</xpath>
				</li>

				<!--Add CE Shield Stuff-->
				<li Class="PatchOperationAddModExtension">
					<xpath>Defs/ThingDef[defName="BotchJob_ProfanedShield"]</xpath>
					<value>
						<li Class="CombatExtended.ShieldDefExtension">
							<shieldCoverage>
								<li>Hands</li>
								<li>Arms</li>
								<li>Shoulders</li>
								<li>Torso</li>
								<li>Neck</li>
							</shieldCoverage>
						</li>
					</value>
				</li>

				<!--Add Bulk-->
				<li Class="PatchOperationAdd">
					<xpath>Defs/ThingDef[defName="BotchJob_ProfanedShield"]/statBases</xpath>
					<value>
						<Bulk>8</Bulk>
						<WornBulk>5</WornBulk>
					</value>
				</li>

				<!--Replace Stat Offsets-->
				<li Class="PatchOperationReplace">
					<xpath>Defs/ThingDef[defName="BotchJob_ProfanedShield"]/equippedStatOffsets</xpath>
					<value>
						<equippedStatOffsets>
							<ReloadSpeed>-0.2</ReloadSpeed>
							<MeleeHitChance>-1</MeleeHitChance>
							<ShootingAccuracyPawn>-0.15</ShootingAccuracyPawn>
							<AimingAccuracy>-0.08</AimingAccuracy>
							<Suppressability>-0.25</Suppressability>
							<MeleeCritChance>-0.05</MeleeCritChance>
							<MeleeParryChance>1.0</MeleeParryChance>
						</equippedStatOffsets>
					</value>
				</li>

				<!--Replace Stuff Thickness-->
				<li Class="PatchOperationReplace">
					<xpath>Defs/ThingDef[defName="BotchJob_ProfanedShield"]/statBases/StuffEffectMultiplierArmor</xpath>
					<value>
						<StuffEffectMultiplierArmor>2.85</StuffEffectMultiplierArmor>
					</value>
				</li>
				
				<li Class="PatchOperationAdd">
					<xpath>Defs/ThingDef[defName="BotchJob_ProfanedShield"]/apparel</xpath>
					<value>
						<renderNodeProperties>
							<li>
							<nodeClass>CombatExtended.PawnRenderNode_Apparel</nodeClass>
							<workerClass>CombatExtended.PawnRenderNodeWorker_Drafted</workerClass>
							<texPath>Things/Pawn/Humanlike/Apparel/Misc/ProfanedShield</texPath>
							<shaderTypeDef>CutoutComplex</shaderTypeDef>
							<parentTagDef>ApparelBody</parentTagDef>
							<drawData>
								<scale>0.65</scale>
								<defaultData>
									<layer>85</layer>
								</defaultData>
								<dataEast>
									<layer>-5</layer>
									<offset>(0, 0, -0.2)</offset>
									<rotationOffset>30</rotationOffset>
								</dataEast>
								<dataWest>
									<rotationOffset>-30</rotationOffset>
								</dataWest>						
								<dataNorth>
									<layer>-5</layer>
									<offset>(0.2, 0, -0.2)</offset>
								</dataNorth>
								<dataSouth>
									<offset>(0.2, 0, -0.2)</offset>
								</dataSouth>
							</drawData>
							</li>
						</renderNodeProperties>			
					</value>
				</li>

			</operations>
		</match>
	</Operation>

</Patch>