<?xml version="1.0" ?>

<Scene name="CryptOutside">

	<Audio source="Chapter4"/>

	<Action type="SetVar" var="task22_find_tomb" value="2" reset="0"/>

	<!-- Scene layers & anims -->
    <if t="$dragon_placed == 1">
		<Object type="ImageBox" image="scene_dragon_in_place" x="191" y="372" />
	<else>
		<if t="$dragon_placed == -1">
			<Object type="ImageBox" image="scene_dragon_in_place" alpha="0" x="191" y="372">
				<Animator type="AlphaChanger" amplitude="255" speed="1"/>
			</Object>
			<Animator type="DelayedAction" time="2">
				<Action type="SetVar" var="dragon_placed" value="1" reset="0"/>
				<Action type="UnlockScene"/>
				<Action type="SetVar" var="dragon_blowing_smoke" value="1" reset="1"/>
			</Animator>
		</if>
	</else>
	</if>

	<!-- ROSE -->
	<if t="$rose_19_state == 0">
		<Object type="ImageBox" image="scene_rose_19" x="490" y="73"/>
		<Action color="FFFFFF" type="SetVar" var="rose_19_state" value="-1" sparkle="0"/>
	</if>
	<if t="$rose_19_state == -1">
		<Object type="ImageBox" image="scene_rose_19" x="490" y="73">
			<Animator type="AlphaChanger" amplitude="-255" speed="1"/>
		</Object>
		<Object type="ImageBox" image="ui.items/rose" alpha="255" x="474" y="57"> <!-- with xy offset -->
			<Animator type="AlphaChanger" function="sine" offset="0" amplitude="255" speed="0.25"/>
			<Animator type="ScalerX" periods="0.25" function="sine" offset="0.6" amplitude="1" speed="0.1"/>
			<Animator type="ScalerY" periods="0.25" function="sine" offset="0.6" amplitude="1" speed="0.1"/>
			<Animator type="Rotator" periods="0.25" function="sine" amplitude="-45" speed="0.1"/>
		</Object>

		<Action type="IncVar" var="roses_count" value="1" reset="0"/>
		<Action type="SetVar" var="rose_19_state" value="1" reset="0"/>
	</if>
	<!-- / -->

    <if t="$crypt_door_opened == 1">
		<Object type="ImageBox" image="scene_crypt_door_open" alpha="255" x="448" y="315" />
	<else>
		<if t="$crypt_door_opened == -1">
			<Object type="ImageBox" image="scene_crypt_door_open" alpha="0" x="448" y="315">
				<Animator type="AlphaChanger" amplitude="255" speed="1"/>
			</Object>
			<Action type="SetVar" var="crypt_door_opened" value="1" reset="0"/>
		</if>
	</else>
	</if>

	<if t="$dragon_blowing_smoke">
		<Animator type="DelayedAction" time="5">
			<Action type="ResetScene"/>
		</Animator>
	</if>

	<if t="$dragon_blowing_fire">
		<Action type="PlaySound" sound="dragon_fire"/>
		<Object type="ImageBox" image="add_crypt_smoke" alpha="0" x="355" y="445" center_x="0">
			<Animator type="MoverX" periods="-1" speed="5" />
			<Animator type="MoverY" periods="-1" speed="2.5"/>
			<Animator type="ScalerX" periods="-1" speed="0.125"/>
			<Animator type="AlphaChanger" function="sine" offset="0" amplitude="155" speed="0.125"/>
		</Object>

		<Object type="ImageBox" image="add_crypt_smoke" alpha="0" x="355" y="445" center_x="0">
			<Animator type="MoverX" periods="-1" speed="10"/>
			<Animator type="MoverY" periods="-1" speed="5"/>
			<Animator type="ScalerX" periods="-1" speed="0.25"/>
			<Animator type="AlphaChanger" function="sine" offset="0" amplitude="155" speed="0.25"/>
		</Object>

		<Object type="ImageBox" image="add_crypt_fire" alpha="0" x="340" y="430" center_x="0">
			<Animator type="MoverX" periods="-1" speed="5" />
			<Animator type="MoverY" periods="-1" speed="2.5"/>
			<Animator type="ScalerX" periods="-1" speed="0.125"/>
			<Animator type="AlphaChanger" function="sine" offset="0" amplitude="155" speed="0.125"/>
		</Object>

		<Object type="ImageBox" image="add_crypt_fire" alpha="0" x="355" y="438"> <!-- static -->
			<Animator type="AlphaChanger" function="sine" offset="0" amplitude="200" speed="0.125"/>
			<Animator type="MoverX" periods="-1" speed="5"/>
			<Animator type="MoverY" periods="-1" speed="-2.5"/>
		</Object>

		<Object type="ImageBox" image="add_crypt_fire" alpha="0" x="340" y="430" center_x="0">
			<Animator type="MoverX" periods="-1" speed="10"/>
			<Animator type="MoverY" periods="-1" speed="5"/>
			<Animator type="ScalerX" periods="-1" speed="0.25"/>
			<Animator type="AlphaChanger" function="sine" offset="0" amplitude="155" speed="0.25"/>
		</Object>


		<Animator type="DelayedAction" time="4">
			<Action type="SetVar" var="crypt_door_opened" value="-1" reset="1"/>
			<Action type="UnlockScene"/>
		</Animator>

		<Action type="SetVar" var="dragon_blowing_fire" value="0" reset="0"/>
	</if>

	<if t="$dragon_blowing_smoke">
		<Object type="ImageBox" image="add_crypt_smoke" alpha="0" x="340" y="430" center_x="0">
			<Animator type="MoverX" periods="-1" speed="5" />
			<Animator type="MoverY" periods="-1" speed="2.5"/>
			<Animator type="ScalerX" periods="-1" speed="0.125"/>
			<Animator type="AlphaChanger" function="sine" offset="0" amplitude="155" speed="0.125"/>
		</Object>

		<Object type="ImageBox" image="add_crypt_smoke" alpha="0" x="355" y="438"> <!-- static -->
			<Animator type="AlphaChanger" function="sine" offset="0" amplitude="200" speed="0.125"/>
			<Animator type="MoverX" periods="-1" speed="5"/>
			<Animator type="MoverY" periods="-1" speed="-2.5"/>
		</Object>

		<Object type="ImageBox" image="add_crypt_smoke" alpha="0" x="340" y="430" center_x="0">
			<Animator type="MoverX" periods="-1" speed="10"/>
			<Animator type="MoverY" periods="-1" speed="5"/>
			<Animator type="ScalerX" periods="-1" speed="0.25"/>
			<Animator type="AlphaChanger" function="sine" offset="0" amplitude="155" speed="0.25"/>
		</Object>

	</if>

	<if t="not $crypt_fog_disabled">
		<Object type="ImageBox" image="scene_crypt_fog" x="-140" y="560">
			<Animator type="MoverX" periods="-1" speed="20"/>
			<Animator type="AlphaChanger" amplitude="-255" speed="0.05"/>
		</Object>
		<Object type="ImageBox" image="scene_crypt_fog" x="60" y="560">
			<Animator type="MoverX" periods="-1" speed="15"/>
			<Animator type="AlphaChanger" amplitude="-255" speed="0.05"/>
		</Object>
		<Object type="ImageBox" image="scene_crypt_fog" x="100" y="560">
			<Animator type="MoverX" periods="-1" speed="10"/>
			<Animator type="AlphaChanger" amplitude="-255" speed="0.05"/>
		</Object>

		<Action type="SetVar" var="crypt_fog_disabled" value="1" reset="0"/>
	</if>

	<!-- Actions -->
	<if t="not $crypt_door_opened">
		<Action color="FF0000" type="Say" key="CRYPT_DOOR_CLOSED" cursor="look"/>
	<else>
		<Action color="FF0000" type="SwitchScene" scene="cemetery.CryptInside" fade_time="2" cursor="walk"/>
	</else>
	</if>

	<Action color="FFFF00" type="SwitchScene" scene="GraveyardCrossroad" cursor="walk" fade_time="2"/>

	<if t="not $got_dragon_figure">
		<Action color="00FF00" type="SwitchScene" scene="cemetery.DragonKnobs" cursor="look"/>
	<else>
		<if t="not $dragon_placed">
			<Action color="00FF00" type="ItemAction" cursor="look">
				<Action itemaction="noitem" type="Say" key="NO_DRAGON"/>
				<Action itemaction="dragon" type="Composite">
					<Action type="LockScene"/>
					<Action type="RemoveItem" item="dragon" reset="0"/>
					<Action type="SetVar" var="dragon_placed" value="-1" reset="1"/>
				</Action>
			</Action>
		<else> <!-- dragon placed -->
			<if t="$dragon_blowing_smoke">
				<Action color="00FF00" type="Reference" ref="M::smoking_dragon" cursor="look"/>
				<Action color="00A651" type="Reference" ref="M::smoking_dragon" cursor="look"/>

				<Action name="M::smoking_dragon" type="ItemAction">
					<Action itemaction="noitem" type="Say" key="SMOKING_DRAGON"/>
					<Action itemaction="lit_torch" type="Composite">
						<Action type="SetVar" var="dragon_blowing_smoke" value="0" reset="0"/>
						<Action type="LockScene"/>
						<Action type="RemoveItem" item="lit_torch" reset="0"/>
						<Action type="SetVar" var="dragon_blowing_fire" value="1" reset="1"/>
					</Action>
				</Action>
			</if>
		</else>
		</if>
	</else>
	</if>

	<Action color="00FFFF" type="Say" key="LOOK_DESIGNATION" cursor="look"/>

	<!-- Other -->
	<if t="not $lucy_crypt_commented">
		<!-- <Action type="RemoveItem" item="template" reset="0"/> -->
		<Action type="Say" key="LUCY_CRYPT_COMMENT"/>
		<Action type="SetVar" var="lucy_crypt_commented" value="1" reset="0"/>
	</if>

</Scene>