<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<el:level xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://enigma-game.org/schema/level/1 level.xsd" xmlns:el="http://enigma-game.org/schema/level/1">
  <el:protected>
    <el:info el:type="level">
      <el:identity el:title="Two in One" el:subtitle="" el:id="devnull48"/>
      <el:version el:score="1" el:release="1" el:revision="5" el:status="released"/>
      <el:author  el:name="/dev/null" el:email="" el:homepage=""/>
      <el:copyright>Copyright © 2009 /dev/null</el:copyright>
      <el:license el:type="GPL v2.0 or above" el:open="true"/>
      <el:compatibility el:enigma="1.10"/>
      <el:modes el:easy="false" el:single="true" el:network="false"/>
      <el:comments>
        <el:credits el:showinfo="true" el:showstart="false">Thanks to daydreamer for valuable feedback.</el:credits>
      </el:comments>
      <el:score el:easy="-" el:difficult="5:43"/>
    </el:info>
    <el:luamain><![CDATA[
wo["AutoRespawn"] = true
wo["AllowSuicide"] = false
-- wo["ProvideExtralifes"] = false

ti[" "] = {"fl_dark"}
ti["."] = {"fl_abyss"}
ti["#"] = {"st_granite"}
ti["X"] = {"st_grate"}
ti["x"] = ti["."] .. {"st_grate"}
ti["+"] = {"st_rawglass_movable"}
ti["Y"] = ti({"st_granite_movable"}) .. {"it_yinyang"}
ti["bridges"] = {"fl_bridge_gc", "bridges%%#"}
ti["doors"] = {"st_door_a", "doors%%#"}
ti["scalesB"] = {"fl_scales", flavor="darkgray", target = "bridges%%#*", min = 0.9}
ti["scalesD"] = {"fl_scales", flavor="darkgray", target = "doors%%#*", min = 0.9}
ti["4"] = {"st_oxyd_a", oxydcolor = OXYD_WHITE}
ti["6"] = {"st_oxyd_a", oxydcolor = OXYD_BLACK}
ti["mediDents"] = ti({"it_meditation_dent"}) .. {"fl_bridge_gc", state = CLOSED}
ti["dentDoors"] = ti["mediDents"] .. {"st_door_a", "dentDoors#"}
ti["i"] = {"fl_scales", "scaleI", flavor="darkgray", target = "tio"}
ti["I"] = {"fl_bridge_gc", "bridgeI"}
ti["R"] = ti["mediDents"] .. {"st_door_a", "doorR"}
ti["j"] = {"fl_scales", "scaleJ", flavor="darkgray", target = "tio"}
ti["J"] = {"fl_bridge_gc", "bridgeJ"}
ti["S"] = ti["mediDents"] .. {"st_door_a", "doorS"}
ti["z"] = ti["mediDents"] .. {"st_door_a", "dentDoors#"}
ti["Z"] = {"st_door_a", "gates#", state = OPEN}
ti["1"] = {"fl_scales", "oxydPart", flavor="darkgray", target = "gates#*"}
ti["2"] = {"fl_scales", "mediPart", flavor="darkgray", target = {"gates#*", "dentDoors#*", "mediFloorChange"}}
ti["*"] = {"#ac_pearl_black", owner = YANG, controllers = CTRL_YANG, essential = INDISPENSABLE}
ti["@"] = {"#ac_marble_white", owner = YIN, controllers = CTRL_YIN}
ti["="] = ti["*"] .. ti({"fl_adhesionless", "fixed#"}).. ti({"st_granite_movable"})

wo(res.autotile(ti, {"A", "H", "doors"}, {"a", "h", "scalesD"}, {"K", "Q", "bridges"}, {"k", "q", "scalesB"}), " ", {
    "#################################",
    "#       ........Z Y1x............",
    "# b dn pAKCMEOAKC..4MI##..g......",
    "#   +X  Q............   #..####..",
    "####X##    .........RX+  .   HO6.",
    "#lfX+      ..........jF  #  + .x.",
    "#@  ++###q..........zN=#*#*#=Nz..",
    "#keX+      ........x. +  #  Fi...",
    "####X##    ........4MG   .  +XS..",
    "#   +X  Q...........####..#   ...",
    "# a cm oBLDNFPBLD.......h..##JO6.",
    "#       ........Z Y2x............",
    "#################################" 
})

function mediFloorChange(val, src)
    if no["mediPart"].state == ON then
        wo[no["fixed#*"]] = ti[" "]
    end
end

function tio(val, src)
    if no["oxydPart"].state == ON then
        if src == no["scaleI"] then
            if val == true then
                no["bridgeI"]:close()
            else
                no["bridgeI"]:open()
            end
        end
        if src == no["scaleJ"] then
            if val == true then
                no["bridgeJ"]:close()
            else
                no["bridgeJ"]:open()
            end
        end
    end
    if no["mediPart"].state == ON then
        if src == no["scaleI"] then
            if val == false then
                no["doorR"]:close()
            else
                no["doorR"]:open()
            end
        end
        if src == no["scaleJ"] then
            if val == false then
                no["doorS"]:close()
            else
                no["doorS"]:open()
            end
        end
    end
end
    ]]></el:luamain>
    <el:i18n>
      <el:string el:key="title">
        <el:english el:translate="false"/>
      </el:string>
    </el:i18n>
  </el:protected>
</el:level>
