<?xml version="1.0" encoding="utf-8"?>
<Patch>
	<!-- === Repose Plasma Grenade === -->
	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="Proj_Repose"]</xpath>
		<value>
			<thingClass>CombatExtended.ProjectileCE_Explosive</thingClass>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="Proj_Repose"]/graphicData/texPath</xpath>
		<value>
			<texPath>Things/Projectile/Repose</texPath>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="Proj_Repose"]/projectile</xpath>
		<value>
			<projectile Class="CombatExtended.ProjectilePropertiesCE">
				<explosionRadius>1</explosionRadius>
				<damageDef>Plasma</damageDef>
				<damageAmountBase>65</damageAmountBase>
				<explosionDelay>100</explosionDelay>
				<applyDamageToExplosionCellsNeighbors>true</applyDamageToExplosionCellsNeighbors>
			</projectile>
		</value>
	</Operation>

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

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="Proj_Repose"]/comps</xpath>
		<value>
			<li Class="CombatExtended.CompProperties_ExplosiveCE">
			</li>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="AD_FedPlasmaGrenades"]/label</xpath>
		<value>
			<label>plasma grenade</label>
		</value>
	</Operation>

	<!-- Change TickerType.-->
	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="AD_FedPlasmaGrenades"]</xpath>
		<value>
			<tickerType>Normal</tickerType>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="AD_FedPlasmaGrenades"]/graphicData</xpath>
		<value>
			<graphicData>
				<texPath>Things/Projectile/Repose</texPath>
				<graphicClass>Graphic_Single</graphicClass>
				<onGroundRandomRotateAngle>0</onGroundRandomRotateAngle>
			</graphicData>
		</value>
	</Operation>

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

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

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="AD_FedPlasmaGrenades"]/comps</xpath>
		<value>
			<li Class="CombatExtended.CompProperties_ExplosiveCE">
				<damageAmountBase>40</damageAmountBase>
				<explosiveDamageType>Plasma</explosiveDamageType>
				<explosiveRadius>1</explosiveRadius>
			</li>
		</value>
	</Operation>

	<Operation Class="CombatExtended.PatchOperationMakeGunCECompatible">
		<defName>AD_FedPlasmaGrenades</defName>
		<statBases>
			<Mass>0.45</Mass>
			<RangedWeapon_Cooldown>1</RangedWeapon_Cooldown>
			<SightsEfficiency>1</SightsEfficiency>
		</statBases>
		<Properties>
			<label>throw plasma grenade</label>
			<verbClass>CombatExtended.Verb_ShootCEOneUse</verbClass>
			<hasStandardCommand>true</hasStandardCommand>
			<range>12.0</range>
			<minRange>3</minRange>
			<warmupTime>0.8</warmupTime>
			<noiseRadius>4</noiseRadius>
			<ai_IsBuildingDestroyer>true</ai_IsBuildingDestroyer>
			<soundCast>ThrowGrenade</soundCast>
			<targetParams>
				<canTargetLocations>true</canTargetLocations>
			</targetParams>
			<defaultProjectile>Proj_Repose</defaultProjectile>
			<onlyManualCast>true</onlyManualCast>
			<ignorePartialLoSBlocker>true</ignorePartialLoSBlocker>
		</Properties>
		<weaponTags>
			<li>FedGrenade</li>
			<li>CE_AI_Grenade</li>
			<li>CE_OneHandedWeapon</li>
		</weaponTags>
	</Operation>

	<!-- === Plasma Bomb Vest === -->
	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="Bullet_PBomb"]</xpath>
		<value>
			<ThingDef ParentName="BaseGrenadeProjectile">
				<defName>Bullet_PBomb</defName>
				<label>fusion device</label>
				<graphicData>
					<texPath>Things/A16/MechPlasma</texPath>
					<graphicClass>Graphic_Single</graphicClass>
				</graphicData>
				<projectile Class="CombatExtended.ProjectilePropertiesCE">
					<explosionRadius>12</explosionRadius>
					<damageDef>Plasma</damageDef>
					<explosionDamageFalloff>true</explosionDamageFalloff>
					<damageAmountBase>100</damageAmountBase>
					<explosionDelay>0</explosionDelay>
					<soundExplode>Explosion_GiantBomb</soundExplode>
					<dropsCasings>false</dropsCasings>
				</projectile>
			</ThingDef>
		</value>
	</Operation>

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="AD_PBomb"]</xpath>
		<value>
			<equippedStatOffsets>
				<Suppressability>-10.00</Suppressability>
			</equippedStatOffsets>
		</value>
	</Operation>

	<Operation Class="PatchOperationReplace">
		<xpath>Defs/ThingDef[defName="AD_PBomb"]</xpath>
		<value>
			<ThingDef Class="CombatExtended.AmmoDef" ParentName="BaseGrenadeEquipment">
				<defName>AD_PBomb</defName>
				<equipmentType>Primary</equipmentType>
				<label>plasma bomb</label>
				<techLevel>Spacer</techLevel>
				<description>A portable plasma reactor converted to suicide bombing.</description>
				<graphicData>
					<texPath>Things/A16/PBomb</texPath>
					<graphicClass>Graphic_Single</graphicClass>
				</graphicData>
				<soundInteract>Interact_Grenade</soundInteract>
				<statBases>
					<MarketValue>400</MarketValue>
					<SightsEfficiency>1</SightsEfficiency>
					<RangedWeapon_Cooldown>0.1</RangedWeapon_Cooldown>
				</statBases>
				<weaponTags>
					<li>FedBomb</li>
				</weaponTags>
				<thingCategories>
					<li>Grenades</li>
				</thingCategories>
				<verbs>
					<li Class="CombatExtended.VerbPropertiesCE">
						<label>detonate suicide vest</label>
						<verbClass>CombatExtended.Verb_ShootCEOneUse</verbClass>
						<hasStandardCommand>true</hasStandardCommand>
						<range>2</range>
						<warmupTime>0.1</warmupTime>
						<noiseRadius>4</noiseRadius>
						<ai_IsBuildingDestroyer>false</ai_IsBuildingDestroyer>
						<soundCast>ThrowGrenade</soundCast>
						<targetParams>
							<canTargetLocations>true</canTargetLocations>
						</targetParams>
						<defaultProjectile>Bullet_PBomb</defaultProjectile>
						<onlyManualCast>true</onlyManualCast>
						<ignorePartialLoSBlocker>false</ignorePartialLoSBlocker>
					</li>
				</verbs>
				<comps>
					<li Class="CombatExtended.CompProperties_ExplosiveCE">
						<damageAmountBase>400</damageAmountBase>
						<explosiveDamageType>Plasma</explosiveDamageType>
						<explosiveRadius>12</explosiveRadius>
						<explosionSound>Explosion_GiantBomb</explosionSound>
					</li>
				</comps>
			</ThingDef>
		</value>
	</Operation>

	<!-- ========== Tools + Tradetag ========== -->

	<Operation Class="PatchOperationAdd">
		<xpath>Defs/ThingDef[defName="AD_FedPlasmaGrenades" or defName="AD_PBomb"]</xpath>
		<value>
			<tools>
				<li Class="CombatExtended.ToolCE">
					<label>Body</label>
					<capacities>
						<li>Blunt</li>
					</capacities>
					<power>2</power>
					<cooldownTime>1.75</cooldownTime>
					<armorPenetrationBlunt>1.0</armorPenetrationBlunt>
					<linkedBodyPartsGroup>Base</linkedBodyPartsGroup>
				</li>
			</tools>
			<tradeTags Inherit="False">
				<li>CE_MediumAmmo</li>
			</tradeTags>
			<allowedArchonexusCount>5</allowedArchonexusCount>
		</value>
	</Operation>
</Patch>