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

	<!--========== Smokeleaf Joint Patches ==========-->
		
	<Operation Class="PatchOperationSequence">
	    <success>Always</success>
		<operations>
	    	<li Class="ModCheck.FindFile">
                <modName>Core</modName>
                <file>Smokeleaf.xml</file>
            </li>
			<li Class="PatchOperationReplace">
				<xpath>Defs/ThingDef[defName = "SmokeleafJoint"]/description</xpath>
				<value>
					<description>Smokeleaf buds broken up and rolled into a joint. The drug improves mood, but also increases appetite, reduces focus and slows movement. While not physically addictive, users may still develop a psychological dependence.</description>
				</value>
			</li>
			<li Class="PatchOperationReplace">
				<xpath>Defs/ThingDef[defName = "SmokeleafJoint"]/statBases/MarketValue</xpath>
				<value>
					<MarketValue>7</MarketValue>
				</value>
			</li>
			<li Class="PatchOperationReplace">
				<xpath>Defs/ThingDef[defName = "SmokeleafJoint"]/costList</xpath>
				<value>
					<costList>
						<SmokeleafBuds>4</SmokeleafBuds>
					</costList>
				</value>
			</li>
			<li Class="PatchOperationReplace">
				<xpath>Defs/ThingDef[defName = "SmokeleafJoint"]/recipeMaker/recipeUsers</xpath>
				<value>
					<recipeUsers>
						<li>DrugLab</li>
					</recipeUsers>
				</value>
			</li>
			<li Class="PatchOperationAdd">
				<xpath>Defs/ThingDef[defName = "SmokeleafJoint"]/recipeMaker</xpath>
					<value>
						<researchPrerequisite>DrugProduction</researchPrerequisite>
					</value>
			</li>
			<li Class="PatchOperationAdd">
				<xpath>Defs/ThingDef[defName = "SmokeleafJoint"]</xpath>
					<value>
					    <thingCategories>
					      	<li>SmokeleafIndCatDrugs</li>
					    </thingCategories>
					</value>
			</li>
			<li Class="PatchOperationAdd">
				<xpath>Defs/HediffDef[defName = "SmokeleafHigh"]/comps</xpath>
				<value>
      				<li Class="HediffCompProperties_Effecter">
        				<stateEffecter>High</stateEffecter>
        				<severityIndices>
          					<min>1</min>
          					<max>5</max>
        				</severityIndices>
      				</li>
				</value>
			</li>
			<li Class="PatchOperationReplace">
				<xpath>Defs/HediffDef[defName = "SmokeleafHigh"]/comps/li[@Class="HediffCompProperties_SeverityPerDay"]/severityPerDay</xpath>
				<value>
					<severityPerDay>-2.0</severityPerDay>
				</value>
			</li>
			<li Class="PatchOperationReplace">
				<xpath>Defs/HediffDef[defName = "SmokeleafHigh"]/stages/li/painOffset</xpath>
				<value>
					<painOffset>-0.1</painOffset>
				</value>
			</li>
			<li Class="PatchOperationReplace">
				<xpath>Defs/HediffDef[defName = "SmokeleafHigh"]/stages/li/capMods/li[1]/offset</xpath>
				<value>
					<offset>-0.15</offset>
				</value>
			</li>
			<li Class="PatchOperationReplace">
				<xpath>Defs/HediffDef[defName = "SmokeleafHigh"]/stages/li/capMods/li[2]/offset</xpath>
				<value>
					<offset>-0.05</offset>
				</value>
			</li>
			<li Class="PatchOperationReplace">
				<xpath>Defs/HediffDef[defName = "SmokeleafTolerance"]/comps/li[@Class="HediffCompProperties_SeverityPerDay"]/severityPerDay</xpath>
				<value>
					<severityPerDay>-0.0666</severityPerDay>
				</value>
			</li>
		</operations>
	</Operation>
	
	<!--========== Misc Patches ==========-->
	
	<Operation Class="PatchOperationSequence">
	    <success>Always</success>
	    <operations>
	    	<li Class="ModCheck.FindFile">
                <modName>Core</modName>
                <file>Buildings_Production.xml</file>
            </li>
		    <li Class="PatchOperationTest">
		        <xpath>Defs/ThingDef[defName = "DrugLab"]/comps/li[@Class="CompProperties_AffectedByFacilities"]/linkableFacilities</xpath>
		    </li>
	    	<li Class="PatchOperationAdd">
				<xpath>Defs/ThingDef[defName = "DrugLab"]/comps/li[@Class="CompProperties_AffectedByFacilities"]/linkableFacilities</xpath>
				<value>
					<li>TrimmingTools</li>
				</value>
			</li>
		</operations>
	</Operation>

	<Operation Class="PatchOperationSequence">
	    <success>Always</success>
	    <operations>
	    	<li Class="ModCheck.FindFile">
                <modName>Core</modName>
                <file>Plants_Cultivated_Farm.xml</file>
            </li>
			<li Class="PatchOperationReplace">
				<xpath>Defs/ThingDef[defName = "PlantSmokeleaf"]/graphicData/texPath</xpath>
				<value>
					<texPath>Things/Plants/MSI_Smokeleaf</texPath>
				</value>
			</li>
			<li Class="PatchOperationAdd">
				<xpath>Defs/ThingDef[defName = "PlantSmokeleaf"]/plant</xpath>
				<value>
					<immatureGraphicPath>Things/ImmaturePlants/MSI_Smokeleaf</immatureGraphicPath>
				</value>
			</li>
		</operations>
	</Operation>

	<Operation Class="PatchOperationSequence">
	    <success>Always</success>
	    <operations>
	    	<li Class="ModCheck.FindFile">
                <modName>Core</modName>
                <file>Plants_Cultivated_Farm.xml</file>
            </li>
			<li Class="PatchOperationReplace">
				<xpath>Defs/ThingDef[defName = "PlantSmokeleaf"]/description</xpath>
				<value>
					<description>A leafy plant cultivated for its psychological effects. Smokeleaf plants can be seperated into a few base ingredients.  These ingredients can make food, medicine, and powerful drugs.</description>
				</value>
			</li>
			<li Class="PatchOperationReplace">
				<xpath>Defs/ThingDef[defName = "PlantSmokeleaf"]/graphicData/texPath</xpath>
				<value>
					<texPath>Things/Plants/MSI_Smokeleaf</texPath>
				</value>
			</li>
			<li Class="PatchOperationAdd">
				<xpath>Defs/ThingDef[defName = "PlantSmokeleaf"]/plant</xpath>
				<value>
					<immatureGraphicPath>Things/ImmaturePlants/MSI_Smokeleaf</immatureGraphicPath>
				</value>
			</li>
		</operations>
	</Operation>
	
</Patch>
