<?xml version="1.0" ?>

<Scene name="MinigamePotionMaking">

	<Audio source="chapter4"/>

	<!-- Scene layers & anims -->	
	<if t="$potion_making_state == 0"> <Object type="ImageBox" image="scene_teleport_potion_liquid" alpha="26" x="460" y="344" /> </if>	
	<if t="$potion_making_state == 2"> <Object type="ImageBox" image="scene_teleport_potion_liquid" alpha="51" x="460" y="344" /> </if>
    <if t="$potion_making_state == 1">
		<Object type="ImageBox" image="scene_teleport_potion_liquid" x="460" y="344">
			<Animator type="AlphaChanger" offset="26" amplitude="26" speed="1"/>
		</Object>
		<Action type="SetVar" var="potion_making_state" value="2" reset="0"/>
	</if>
	<if t="$potion_making_state == 4"> <Object type="ImageBox" image="scene_teleport_potion_liquid" alpha="102" x="460" y="344" /> </if>
    <if t="$potion_making_state == 3">
		<Object type="ImageBox" image="scene_teleport_potion_liquid" x="460" y="344">
			<Animator type="AlphaChanger" offset="51" amplitude="51" speed="1"/>
		</Object>
		<Action type="SetVar" var="potion_making_state" value="4" reset="0"/>
	</if>
	<if t="$potion_making_state == 6"> <Object type="ImageBox" image="scene_teleport_potion_liquid" alpha="154" x="460" y="344" /> </if>
    <if t="$potion_making_state == 5">
		<Object type="ImageBox" image="scene_teleport_potion_liquid" x="460" y="344">
			<Animator type="AlphaChanger" offset="102" amplitude="51" speed="1"/>
		</Object>
		<Action type="SetVar" var="potion_making_state" value="6" reset="0"/>
	</if>
	<if t="$potion_making_state == 8"> <Object type="ImageBox" image="scene_teleport_potion_liquid" alpha="205" x="460" y="344" /> </if>
    <if t="$potion_making_state == 7">
		<Object type="ImageBox" image="scene_teleport_potion_liquid" x="460" y="344">
			<Animator type="AlphaChanger" offset="154" amplitude="51" speed="1"/>
		</Object>
		<Action type="SetVar" var="potion_making_state" value="8" reset="0"/>
	</if>
	<if t="$potion_making_state == 10"> <Object type="ImageBox" image="scene_teleport_potion_liquid" alpha="255" x="460" y="344" /> </if>
    <if t="$potion_making_state == 9">
		<Object type="ImageBox" image="scene_teleport_potion_liquid" x="460" y="344">
			<Animator type="AlphaChanger" offset="205" amplitude="51" speed="1"/>
		</Object>
		<Action type="SetVar" var="potion_making_state" value="10" reset="0"/>
	</if>
	
	<if t="$potion_daisy_in == -1">
		<Object type="ImageBox" image="scene_flower_daisy" x="513" y="379">
			<Animator type="AlphaChanger" periods="0.25" function="sine" amplitude="-255" speed="0.1"/>
			<Animator type="Rotator" periods="-1" speed="10"/>
		</Object>
		<Action type="SetVar" var="potion_daisy_in" value="1" reset="0"/>
	</if>
    
	<if t="$potion_red_iris_in == -1">
		<Object type="ImageBox" image="scene_flower_red_iris" x="534" y="403">
			<Animator type="AlphaChanger" periods="0.25" function="sine" amplitude="-255" speed="0.1"/>
			<Animator type="Rotator" periods="-1" speed="10"/>
		</Object>
		<Action type="SetVar" var="potion_red_iris_in" value="1" reset="0"/>
	</if>
	
	<if t="$potion_yellow_valeriana_in == -1">
		<Object type="ImageBox" image="scene_flower_yellow_valeriana" x="491" y="392">
			<Animator type="AlphaChanger" periods="0.25" function="sine" amplitude="-255" speed="0.1"/>			
		</Object>
		<Action type="SetVar" var="potion_yellow_valeriana_in" value="1" reset="0"/>
	</if>
	
	<if t="$potion_wolf_paw_in == -1">
		<Object type="ImageBox" image="scene_wolf_paw_in_potion" x="468" y="306">
			<Animator type="AlphaChanger" periods="0.25" function="sine" amplitude="-255" speed="0.1"/>
			<Animator type="MoverX" periods="-1" speed="10"/>
			<Animator type="MoverY" periods="-1" speed="20"/>
			<Animator type="ScalerX" amplitude="-1" speed="0.01"/>
			<Animator type="ScalerY" amplitude="-1" speed="0.05"/>
		</Object>
		<Action type="SetVar" var="potion_wolf_paw_in" value="1" reset="0"/>
	</if>
	
	<if t="$potion_liquid_glass_in == -1">
		<Object type="ImageBox" image="scene_liquid_glass" x="480" y="384">
			<Animator type="AlphaChanger" periods="0.25" function="sine" amplitude="-255" speed="0.1"/>
			<Animator type="ScalerX" amplitude="-1" speed="0.01"/>
			<Animator type="ScalerY" amplitude="-1" speed="0.01"/>
			<Animator type="Rotator" periods="-1" speed="10"/>
		</Object>
		<Action type="SetVar" var="potion_liquid_glass_in" value="1" reset="0"/>
	</if>
 
	<if t="$potion_pestle == 1">
		<Object type="ImageBox" image="scene_pestle" x="440" y="427" center_x="125" center_y="20">
			<Animator type="Rotator" periods="2" function="sine" amplitude="360" speed="0.5"/>
			<Animator type="MoverY" periods="10" function="sine" amplitude="50" speed="2.5"/>
			<Animator type="MoverX" periods="10" function="sine" amplitude="50" speed="2.5"/>
		</Object>
	<else>
		<Object type="ImageBox" image="scene_pestle" x="440" y="427"/>
	</else>
	</if>
	
	<if t="$potion_making_state == 10 and $potion_pestle == 0">
		<Action type="LockScene"/>
		<Animator type="DelayedAction" time="2">
			<Action type="PlaySound" sound="mixing_potion"/>
			<Action type="SetVar" var="potion_pestle" value="1" reset="1"/>
		</Animator>
	</if>
	
	<if t="$potion_pestle == 1">
		<Object type="ImageBox" image="add_potion_sparkle" alpha="0" clickthrough="1" x="526" y="408">
			<Animator type="AlphaChanger" offset="0" amplitude="255" speed="0.7"/>
			<Animator type="MoverY" periods="-1" speed="-200"/>
			<Animator type="MoverX" periods="-1" function="sine" amplitude="20" speed="0.7"/>
			<Animator type="AlphaChanger" offset="255" amplitude="-255" speed="0.7" delay="2"/>
		</Object>
		<Object type="ImageBox" image="add_potion_sparkle" alpha="0" clickthrough="1" x="550" y="400">
			<Animator type="AlphaChanger" offset="0" amplitude="255" speed="0.9"/>
			<Animator type="MoverY" periods="-1" speed="-250"/>
			<Animator type="MoverX" periods="-1" function="sine" amplitude="20" speed="0.6"/>
			<Animator type="AlphaChanger" offset="255" amplitude="-255" speed="0.9" delay="2"/>
		</Object>
		<Object type="ImageBox" image="add_potion_sparkle" alpha="0" clickthrough="1" x="450" y="408">
			<Animator type="AlphaChanger" offset="0" amplitude="255" speed="1"/>
			<Animator type="MoverY" periods="-1" speed="-300"/>
			<Animator type="MoverX" periods="-1" function="sine" amplitude="20" speed="0.5"/>
			<Animator type="AlphaChanger" offset="255" amplitude="-255" speed="1" delay="2"/>
		</Object>
		<Object type="ImageBox" image="add_potion_sparkle" alpha="0" clickthrough="1" x="490" y="418">
			<Animator type="AlphaChanger" offset="0" amplitude="255" speed="0.8"/>
			<Animator type="MoverY" periods="-1" speed="-220"/>
			<Animator type="MoverX" periods="-1" function="sine" amplitude="20" speed="0.4"/>
			<Animator type="AlphaChanger" offset="255" amplitude="-255" speed="0.8" delay="2"/>
		</Object>
		<Object type="ImageBox" image="add_potion_sparkle" alpha="0" clickthrough="1" x="500" y="448">
			<Animator type="AlphaChanger" offset="0" amplitude="255" speed="0.5"/>
			<Animator type="MoverY" periods="-1" speed="-100"/>
			<Animator type="MoverX" periods="-1" function="sine" amplitude="20" speed="0.3"/>
			<Animator type="AlphaChanger" offset="255" amplitude="-255" speed="0.5" delay="2"/>
		</Object>
		<Object type="ImageBox" image="add_potion_sparkle" alpha="0" clickthrough="1" x="600" y="458">
			<Animator type="AlphaChanger" offset="0" amplitude="255" speed="1.5"/>
			<Animator type="MoverY" periods="-1" speed="-350"/>
			<Animator type="MoverX" periods="-1" function="sine" amplitude="20" speed="0.2"/>
			<Animator type="AlphaChanger" offset="255" amplitude="-255" speed="1.5" delay="2"/>
		</Object>
		<Object type="ImageBox" image="add_potion_sparkle" alpha="0" clickthrough="1" x="570" y="408">
			<Animator type="AlphaChanger" offset="0" amplitude="255" speed="0.4"/>
			<Animator type="MoverY" periods="-1" speed="-80"/>
			<Animator type="MoverX" periods="-1" function="sine" amplitude="20" speed="0.1"/>
			<Animator type="AlphaChanger" offset="255" amplitude="-255" speed="0.4" delay="2"/>
		</Object>
		<Animator type="DelayedAction" time="4">
			<Action type="RemoveItem" item="new_teleport_recipe" reset="0"/>
			<Action type="PlaySound" sound="potion_done"/>
			<Action type="Say" key="POTION_DONE"/>
			<Action type="SetVar" var="potion_pestle" value="2" reset="0"/>
			<Action type="UnlockScene"/>
		</Animator>
	</if>
	
	<!-- Actions -->
	<Action color="FFFF00" type="Composite">
		<Action type="PlaySound" sound="steps"/>
		<Action type="SwitchScene" scene="AlchemyLab02"/>
	</Action>	
	<Object type="ActionArrowMarker" x="538" y="640" color="FFFF00" image="ui.gui/ss_marker" angle="-90" clickthrough="1"/>
	
	<if t="not $got_teleport_potion">
		<if t="$solved_teleport_recipe">
			<Action color="FF33FF" type="ItemAction" cursor="question">
				<Action itemaction="noitem" condition="$potion_pestle == 0" type="Say" key="POTION_MAKING_LOOK"/>
				<Action itemaction="noitem" condition="$potion_pestle == 2" type="Say" key="POTION_MAKING_DONE_LOOK"/>
				<Action itemaction="white_daisy" condition="not $ho_white_daisy_1_visible and not $ho_white_daisy_2_visible and not $ho_white_daisy_3_visible and not $ho_white_daisy_4_visible" type="Composite">
					<Action type="RemoveItem" item="white_daisy" reset="0"/> <!-- 1 -->
					<Action type="RemoveItem" item="white_daisy" reset="0"/> <!-- 2 -->
					<Action type="RemoveItem" item="white_daisy" reset="0"/> <!-- 3 -->
					<Action type="RemoveItem" item="white_daisy" reset="0"/> <!-- 4 -->
					<Action type="PlaySound" sound="generic_item_use_put_taken"/>
					<Action type="IncVar" var="potion_making_state" value="1" reset="0"/>
					<Action type="SetVar" var="potion_daisy_in" value="-1" reset="1"/>
				</Action>
				<Action itemaction="white_daisy" condition="$ho_white_daisy_1_visible or $ho_white_daisy_2_visible or $ho_white_daisy_3_visible or $ho_white_daisy_4_visible" type="Say" key="INSUFFICIENT_DAISY"/>
				<Action itemaction="red_iris" condition="not $ho_red_iris_1_visible and not $ho_red_iris_2_visible and not $ho_red_iris_3_visible" type="Composite">
					<Action type="RemoveItem" item="red_iris" reset="0"/> <!-- 1 -->
					<Action type="RemoveItem" item="red_iris" reset="0"/> <!-- 2 -->
					<Action type="RemoveItem" item="red_iris" reset="0"/> <!-- 3 -->
					<Action type="PlaySound" sound="generic_item_use_put_taken"/>
					<Action type="IncVar" var="potion_making_state" value="1" reset="0"/>
					<Action type="SetVar" var="potion_red_iris_in" value="-1" reset="1"/>
				</Action>
				<Action itemaction="red_iris" condition="$ho_red_iris_1_visible or $ho_red_iris_2_visible or $ho_red_iris_3_visible" type="Say" key="INSUFFICIENT_IRIS"/>
				<Action itemaction="yellow_valeriana" condition="not $ho_yellow_valeriana_1_visible and not $ho_yellow_valeriana_2_visible and not $ho_yellow_valeriana_3_visible and not $ho_yellow_valeriana_4_visible" type="Composite">
					<Action type="RemoveItem" item="yellow_valeriana" reset="0"/> <!-- 1 -->
					<Action type="RemoveItem" item="yellow_valeriana" reset="0"/> <!-- 2 -->
					<Action type="RemoveItem" item="yellow_valeriana" reset="0"/> <!-- 3 -->
					<Action type="RemoveItem" item="yellow_valeriana" reset="0"/> <!-- 4 -->
					<Action type="PlaySound" sound="generic_item_use_put_taken"/>
					<Action type="IncVar" var="potion_making_state" value="1" reset="0"/>
					<Action type="SetVar" var="potion_yellow_valeriana_in" value="-1" reset="1"/>
				</Action>
				<Action itemaction="yellow_valeriana" condition="$ho_yellow_valeriana_1_visible or $ho_yellow_valeriana_2_visible or $ho_yellow_valeriana_3_visible or $ho_yellow_valeriana_4_visible" type="Say" key="INSUFFICIENT_VALERIANA"/>
				<Action itemaction="pestle_liquid_glass" type="Composite">
					<Action type="RemoveItem" item="pestle_liquid_glass" reset="0"/>
					<Action type="PlaySound" sound="generic_item_use_put_taken"/>
					<Action type="IncVar" var="potion_making_state" value="1" reset="0"/>
					<Action type="SetVar" var="potion_liquid_glass_in" value="-1" reset="1"/>
				</Action>
				<Action itemaction="werewolf_paw" type="Composite">
					<Action type="RemoveItem" item="werewolf_paw" reset="0"/>
					<Action type="PlaySound" sound="generic_item_use_put_taken"/>
					<Action type="IncVar" var="potion_making_state" value="1" reset="0"/>
					<Action type="SetVar" var="potion_wolf_paw_in" value="-1" reset="1"/>
				</Action>
				<Action itemaction="flask" condition="$potion_pestle == 2" type="Composite">
					<Action type="RemoveItem" item="flask" reset="0"/>
					<Action type="PlaySound" sound="generic_item_use_put_taken"/>
					<Action type="SetVar" var="task119_lab_teleport" value="2" reset="0"/>
					<Action type="AddItem" item="alchemy_potion" reset="0"/>
					<Action type="SetVar" var="got_teleport_potion" value="1" reset="1"/>
				</Action>
				<Action itemaction="flask" condition="not $potion_pestle == 2" type="Say" key="POTION_NOT_READY"/>
			</Action>
		<else>
			<Action condition="not $got_teleport_potion" color="FF33FF" type="ItemAction" cursor="question">
				<Action itemaction="noitem" type="Say" key="POTION_UNKNOWN"/>
				<Action itemaction="flask" condition="not $potion_pestle == 2" type="Say" key="POTION_NOT_READY"/>
			</Action>
			<!-- extra -->
			<Action color="FF33FF" type="ItemAction" cursor="question">
				<Action itemaction="noitem" type="Say" key="POTION_UNKNOWN"/>
				<Action itemaction="white_daisy" type="Say" key="POTION_UNKNOWN"/>
				<Action itemaction="red_iris" type="Say" key="POTION_UNKNOWN"/>
				<Action itemaction="yellow_valeriana" type="Say" key="POTION_UNKNOWN"/>
				<Action itemaction="pestle_liquid_glass" type="Say" key="POTION_UNKNOWN"/>
				<Action itemaction="werewolf_paw" type="Say" key="POTION_UNKNOWN"/>
			</Action>
		</else>
		</if>
	</if>
	
	
	
</Scene>