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

	<ThingCategoryDef>
		<defName>AmmoCrossbowBolts</defName>
		<label>crossbow bolts</label>
		<parent>AmmoNeolithic</parent>
		<iconPath>UI/Icons/ThingCategories/CaliberArrow</iconPath>
	</ThingCategoryDef>

	<!-- ==================== AmmoSet ========================== -->

	<CombatExtended.AmmoSetDef>
		<defName>AmmoSet_CrossbowBolt</defName>
		<label>crossbow bolts</label>
		<ammoTypes>
			<Ammo_CrossbowBolt_Stone>Projectile_CrossbowBolt_Stone</Ammo_CrossbowBolt_Stone>
			<Ammo_CrossbowBolt_Steel>Projectile_CrossbowBolt_Steel</Ammo_CrossbowBolt_Steel>
			<Ammo_CrossbowBolt_Plasteel>Projectile_CrossbowBolt_Plasteel</Ammo_CrossbowBolt_Plasteel>
			<Ammo_CrossbowBolt_Venom>Projectile_CrossbowBolt_Venom</Ammo_CrossbowBolt_Venom>
			<Ammo_CrossbowBolt_Flame>Projectile_CrossbowBolt_Flame</Ammo_CrossbowBolt_Flame>
		</ammoTypes>
	</CombatExtended.AmmoSetDef>

	<!-- ==================== Ammo ========================== -->

	<ThingDef Class="CombatExtended.AmmoDef" Name="AmmoCrossbowBoltBase" ParentName="NeolithicAmmoBase" Abstract="True">
		<description>A crossbow bolt.</description>
		<statBases>
			<Mass>0.09</Mass>
			<Bulk>0.24</Bulk>
			<Flammability>1</Flammability>
		</statBases>
		<thingCategories>
			<li>AmmoCrossbowBolts</li>
		</thingCategories>
		<stackLimit>4000</stackLimit>
		<tradeTags>
			<li>CE_PreIndustrialAmmo</li>
			<li>CE_AutoEnableTrade</li>
			<li>CE_AutoEnableCrafting_FueledSmithy</li>
			<li>CE_AutoEnableCrafting_ElectricSmithy</li>
		</tradeTags>
	</ThingDef>

	<ThingDef Class="CombatExtended.AmmoDef" ParentName="AmmoCrossbowBoltBase">
		<defName>Ammo_CrossbowBolt_Stone</defName>
		<label>crossbow bolt (stone)</label>
		<graphicData>
			<texPath>Things/Ammo/Medieval/Bolt/Stone</texPath>
			<graphicClass>Graphic_StackCount</graphicClass>
		</graphicData>
		<statBases>
			<Mass>0.06</Mass>
		</statBases>
		<ammoClass>StoneCrossbowBolt</ammoClass>
		<tradeTags>
			<li>CE_AutoEnableCrafting_CraftingSpot</li>
		</tradeTags>
	</ThingDef>

	<ThingDef Class="CombatExtended.AmmoDef" ParentName="AmmoCrossbowBoltBase">
		<defName>Ammo_CrossbowBolt_Steel</defName>
		<label>crossbow bolt (steel)</label>
		<graphicData>
			<texPath>Things/Ammo/Medieval/Bolt/Steel</texPath>
			<graphicClass>Graphic_StackCount</graphicClass>
		</graphicData>
		<ammoClass>SteelCrossbowBolt</ammoClass>
	</ThingDef>

	<ThingDef Class="CombatExtended.AmmoDef" ParentName="AmmoCrossbowBoltBase">
		<defName>Ammo_CrossbowBolt_Plasteel</defName>
		<label>crossbow bolt (plasteel)</label>
		<graphicData>
			<texPath>Things/Ammo/Medieval/Bolt/Plasteel</texPath>
			<graphicClass>Graphic_StackCount</graphicClass>
		</graphicData>
		<statBases>
			<Mass>0.07</Mass>
		</statBases>
		<ammoClass>PlasteelCrossbowBolt</ammoClass>
		<generateAllowChance>0.2</generateAllowChance>
	</ThingDef>

	<ThingDef Class="CombatExtended.AmmoDef" ParentName="AmmoCrossbowBoltBase">
		<defName>Ammo_CrossbowBolt_Venom</defName>
		<label>crossbow bolt (venom)</label>
		<graphicData>
			<texPath>Things/Ammo/Medieval/Bolt/Venom</texPath>
			<graphicClass>Graphic_StackCount</graphicClass>
		</graphicData>
		<ammoClass>VenomCrossbowBolt</ammoClass>
		<generateAllowChance>0.1</generateAllowChance>
	</ThingDef>

	<ThingDef Class="CombatExtended.AmmoDef" ParentName="AmmoCrossbowBoltBase">
		<defName>Ammo_CrossbowBolt_Flame</defName>
		<label>crossbow bolt (flame)</label>
		<graphicData>
			<texPath>Things/Ammo/Medieval/Bolt/Flame</texPath>
			<graphicClass>Graphic_StackCount</graphicClass>
		</graphicData>
		<statBases>
			<Mass>0.07</Mass>
		</statBases>
		<ammoClass>FlameCrossbowBolt</ammoClass>
		<generateAllowChance>0.2</generateAllowChance>
	</ThingDef>

	<!-- ================== Projectiles ================== -->

	<ThingDef Name="BaseCrossbowBoltProjectile" ParentName="BaseBulletCE" Abstract="true">
		<graphicData>
			<texPath>Things/Projectile/Arrow_Small</texPath>
			<graphicClass>Graphic_Single</graphicClass>
		</graphicData>
		<projectile Class="CombatExtended.ProjectilePropertiesCE">
			<damageDef>Arrow</damageDef>
			<speed>28</speed>
		</projectile>
	</ThingDef>

	<!-- The amount of arrows usable over the ammo lifetime for each resource cost is equal to
		[r / (1 - x)];
			x = preExplosionSpawnChance,
			r = resource cost. -->

	<ThingDef ParentName="BaseCrossbowBoltProjectile">
		<defName>Projectile_CrossbowBolt_Stone</defName>
		<label>crossbow bolt (stone)</label>
		<graphicData>
			<texPath>Things/Projectile/Arrows/Arrow_Stone</texPath>
			<graphicClass>Graphic_Single</graphicClass>
		</graphicData>
		<projectile Class="CombatExtended.ProjectilePropertiesCE">
			<speed>25</speed>
			<damageAmountBase>10</damageAmountBase>
			<armorPenetrationBlunt>2.94</armorPenetrationBlunt>
			<armorPenetrationSharp>1.5</armorPenetrationSharp>
			<preExplosionSpawnChance>0.1</preExplosionSpawnChance><!-- 11.11 bolts per resource -->
			<preExplosionSpawnThingDef>Ammo_CrossbowBolt_Stone</preExplosionSpawnThingDef>
		</projectile>
		<modExtensions>
			<li Class="ProjectileImpactFX.EffectProjectileExtension">
				<AutoAssign>false</AutoAssign>
				<CreateTerrainEffects>true</CreateTerrainEffects>
				<StuckProjectileFleckDef>Fleck_CELandedArrow_Stone</StuckProjectileFleckDef>
				<StuckProjectileFleckSize>0.55</StuckProjectileFleckSize>
			</li>
		</modExtensions>
	</ThingDef>

	<ThingDef ParentName="BaseCrossbowBoltProjectile">
		<defName>Projectile_CrossbowBolt_Steel</defName>
		<label>crossbow bolt (steel)</label>
		<graphicData>
			<texPath>Things/Projectile/Arrows/Arrow_Steel</texPath>
			<graphicClass>Graphic_Single</graphicClass>
		</graphicData>
		<projectile Class="CombatExtended.ProjectilePropertiesCE">
			<damageAmountBase>11</damageAmountBase>
			<armorPenetrationBlunt>6.5</armorPenetrationBlunt>
			<armorPenetrationSharp>2.5</armorPenetrationSharp>
			<preExplosionSpawnChance>0.333</preExplosionSpawnChance><!-- 14.99 bolts per resource -->
			<preExplosionSpawnThingDef>Ammo_CrossbowBolt_Steel</preExplosionSpawnThingDef>
		</projectile>
		<modExtensions>
			<li Class="ProjectileImpactFX.EffectProjectileExtension">
				<AutoAssign>false</AutoAssign>
				<CreateTerrainEffects>true</CreateTerrainEffects>
				<StuckProjectileFleckDef>Fleck_CELandedArrow_Steel</StuckProjectileFleckDef>
				<StuckProjectileFleckSize>0.55</StuckProjectileFleckSize>
			</li>
		</modExtensions>
	</ThingDef>

	<ThingDef ParentName="BaseCrossbowBoltProjectile">
		<defName>Projectile_CrossbowBolt_Plasteel</defName>
		<label>crossbow bolt (plasteel)</label>
		<graphicData>
			<texPath>Things/Projectile/Arrows/Arrow_Plasteel</texPath>
			<graphicClass>Graphic_Single</graphicClass>
		</graphicData>
		<projectile Class="CombatExtended.ProjectilePropertiesCE">
			<speed>31</speed>
			<damageAmountBase>9</damageAmountBase>
			<armorPenetrationBlunt>6.32</armorPenetrationBlunt>
			<armorPenetrationSharp>3.5</armorPenetrationSharp>
			<preExplosionSpawnChance>0.6</preExplosionSpawnChance><!-- 25 bolts per resource -->
			<preExplosionSpawnThingDef>Ammo_CrossbowBolt_Plasteel</preExplosionSpawnThingDef>
		</projectile>
		<modExtensions>
			<li Class="ProjectileImpactFX.EffectProjectileExtension">
				<AutoAssign>false</AutoAssign>
				<CreateTerrainEffects>true</CreateTerrainEffects>
				<StuckProjectileFleckDef>Fleck_CELandedArrow_Plasteel</StuckProjectileFleckDef>
				<StuckProjectileFleckSize>0.55</StuckProjectileFleckSize>
			</li>
		</modExtensions>
	</ThingDef>

	<ThingDef ParentName="BaseCrossbowBoltProjectile">
		<defName>Projectile_CrossbowBolt_Venom</defName>
		<label>crossbow bolt (venom)</label>
		<graphicData>
			<texPath>Things/Projectile/Arrows/Arrow_Venom</texPath>
			<graphicClass>Graphic_Single</graphicClass>
		</graphicData>
		<projectile Class="CombatExtended.ProjectilePropertiesCE">
			<damageDef>ArrowVenom</damageDef>
			<damageAmountBase>11</damageAmountBase>
			<armorPenetrationBlunt>6.5</armorPenetrationBlunt>
			<armorPenetrationSharp>2.5</armorPenetrationSharp>
			<preExplosionSpawnChance>0.6</preExplosionSpawnChance><!-- 25 arrows per resource -->
			<preExplosionSpawnThingDef>Ammo_CrossbowBolt_Steel</preExplosionSpawnThingDef>
		</projectile>
		<modExtensions>
			<li Class="ProjectileImpactFX.EffectProjectileExtension">
				<AutoAssign>false</AutoAssign>
				<CreateTerrainEffects>true</CreateTerrainEffects>
				<StuckProjectileFleckDef>Fleck_CELandedArrow_Venom</StuckProjectileFleckDef>
				<StuckProjectileFleckSize>0.55</StuckProjectileFleckSize>
			</li>
		</modExtensions>
	</ThingDef>

	<ThingDef ParentName="BaseCrossbowBoltProjectile">
		<defName>Projectile_CrossbowBolt_Flame</defName>
		<label>crossbow bolt (flame)</label>
		<thingClass>CombatExtended.ProjectileCE_Explosive</thingClass>
		<graphicData>
			<texPath>Things/Projectile/Arrows/Arrow_Flame</texPath>
			<graphicClass>Graphic_Single</graphicClass>
		</graphicData>
		<projectile Class="CombatExtended.ProjectilePropertiesCE">
			<explosionRadius>0.2</explosionRadius>
			<damageDef>ArrowFire</damageDef>
			<damageAmountBase>5</damageAmountBase>
			<preExplosionSpawnThingDef>Filth_Fuel</preExplosionSpawnThingDef>
			<preExplosionSpawnChance>0.16</preExplosionSpawnChance>
			<targetParams>
        		<canTargetLocations>true</canTargetLocations>
      		</targetParams>
		</projectile>
		<modExtensions>
			<li Class="ProjectileImpactFX.EffectProjectileExtension">
				<AutoAssign>false</AutoAssign>
				<CreateTerrainEffects>true</CreateTerrainEffects>
				<StuckProjectileFleckDef>Fleck_CELandedArrow_Flame</StuckProjectileFleckDef>
				<StuckProjectileFleckSize>0.75</StuckProjectileFleckSize>
			</li>
		</modExtensions>
	</ThingDef>

	<!-- ==================== Recipes ========================== -->

	<RecipeDef ParentName="AmmoRecipeNeolithicBase">
		<defName>MakeAmmo_CrossbowBolt_Stone</defName>
		<label>make stone crossbow bolts x10</label>
		<description>Craft 10 stone crossbow bolts.</description>
		<jobString>Making stone crossbow bolts.</jobString>
		<ingredients>
			<li>
				<filter>
					<thingDefs>
						<li>WoodLog</li>
					</thingDefs>
				</filter>
				<count>3</count>
			</li>
		</ingredients>
		<fixedIngredientFilter>
			<thingDefs>
				<li>WoodLog</li>
			</thingDefs>
		</fixedIngredientFilter>
		<products>
			<Ammo_CrossbowBolt_Stone>10</Ammo_CrossbowBolt_Stone>
		</products>
		<workAmount>300</workAmount>
	</RecipeDef>

	<RecipeDef ParentName="AmmoRecipeNeolithicBase">
		<defName>MakeAmmo_CrossbowBolt_Steel</defName>
		<label>make steel crossbow bolts x10</label>
		<description>Craft 10 steel crossbow bolts.</description>
		<jobString>Making steel crossbow bolts.</jobString>
		<ingredients>
			<li>
				<filter>
					<thingDefs>
						<li>WoodLog</li>
					</thingDefs>
				</filter>
				<count>2</count>
			</li>
			<li>
				<filter>
					<thingDefs>
						<li>Steel</li>
					</thingDefs>
				</filter>
				<count>2</count>
			</li>
		</ingredients>
		<fixedIngredientFilter>
			<thingDefs>
				<li>WoodLog</li>
				<li>Steel</li>
			</thingDefs>
		</fixedIngredientFilter>
		<products>
			<Ammo_CrossbowBolt_Steel>10</Ammo_CrossbowBolt_Steel>
		</products>
		<workAmount>400</workAmount>
	</RecipeDef>

	<RecipeDef ParentName="AmmoRecipeNeolithicBase">
		<defName>MakeAmmo_CrossbowBolt_Plasteel</defName>
		<label>make plasteel crossbow bolts x10</label>
		<description>Craft 10 plasteel crossbow bolts.</description>
		<jobString>Making plasteel crossbow bolts.</jobString>
		<ingredients>
			<li>
				<filter>
					<thingDefs>
						<li>WoodLog</li>
					</thingDefs>
				</filter>
				<count>2</count>
			</li>
			<li>
				<filter>
					<thingDefs>
						<li>Plasteel</li>
					</thingDefs>
				</filter>
				<count>3</count>
			</li>
		</ingredients>
		<fixedIngredientFilter>
			<thingDefs>
				<li>WoodLog</li>
				<li>Plasteel</li>
			</thingDefs>
		</fixedIngredientFilter>
		<products>
			<Ammo_CrossbowBolt_Plasteel>10</Ammo_CrossbowBolt_Plasteel>
		</products>
		<workAmount>1400</workAmount>
	</RecipeDef>

	<RecipeDef ParentName="AmmoRecipeNeolithicBase">
		<defName>MakeAmmo_CrossbowBolt_Venom</defName>
		<label>make venom crossbow bolts x10</label>
		<description>Craft 10 venom crossbow bolts.</description>
		<jobString>Making venom crossbow bolts.</jobString>
		<workAmount>1000</workAmount>
		<ingredients>
			<li>
				<filter>
					<thingDefs>
						<li>WoodLog</li>
					</thingDefs>
				</filter>
				<count>2</count>
			</li>
			<li>
				<filter>
					<thingDefs>
						<li>Steel</li>
					</thingDefs>
				</filter>
				<count>2</count>
			</li>
			<li>
				<filter>
					<thingDefs>
						<li>MedicineHerbal</li>
					</thingDefs>
				</filter>
				<count>2</count>
			</li>
		</ingredients>
		<fixedIngredientFilter>
			<thingDefs>
				<li>WoodLog</li>
				<li>Steel</li>
				<li>MedicineHerbal</li>
			</thingDefs>
		</fixedIngredientFilter>
		<products>
			<Ammo_CrossbowBolt_Venom>10</Ammo_CrossbowBolt_Venom>
		</products>
	</RecipeDef>

	<RecipeDef ParentName="AmmoRecipeNeolithicBase">
		<defName>MakeAmmo_CrossbowBolt_Flame</defName>
		<label>make flame crossbow bolts x10</label>
		<description>Craft 10 flame crossbow bolts.</description>
		<jobString>Making flame crossbow bolts.</jobString>
		<workAmount>800</workAmount>
		<ingredients>
			<li>
				<filter>
					<thingDefs>
						<li>WoodLog</li>
					</thingDefs>
				</filter>
				<count>2</count>
			</li>
			<li>
				<filter>
					<thingDefs>
						<li>Steel</li>
					</thingDefs>
				</filter>
				<count>2</count>
			</li>
			<li>
				<filter>
					<thingDefs>
						<li>Prometheum</li>
					</thingDefs>
				</filter>
				<count>1</count>
			</li>
		</ingredients>
		<fixedIngredientFilter>
			<thingDefs>
				<li>WoodLog</li>
				<li>Steel</li>
				<li>Prometheum</li>
			</thingDefs>
		</fixedIngredientFilter>
		<products>
			<Ammo_CrossbowBolt_Flame>10</Ammo_CrossbowBolt_Flame>
		</products>
	</RecipeDef>

</Defs>