<?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="Remote Meditation" el:id="dpl02"/>
      <el:version el:score="1" el:release="2" el:revision="2" el:status="released"/>
      <el:author  el:name="Dominik Leipold"/>
      <el:copyright>Copyright © 2007 Dominik Leipold</el:copyright>
      <el:license el:type="GPL v2.0 or above" el:open="true"/>
      <el:compatibility el:enigma="1.10"/>
      <el:modes el:easy="true" el:single="true" el:network="false"/>
      <el:score el:easy="2:19" el:difficult="3:10"/>
    </el:info>
    <el:luamain><![CDATA[
wo["MagnetStrength"] = 7.0
wo["MagnetRange"] = 5.0

ti[" "] = {"fl_space"}
ti["."] = {"fl_abyss"}
ti["="] = {"fl_dark"}
ti["#"] = {"st_granite"}
ti["%"] = {"st_lightglass"}
ti["<"] = {"st_oneway_w"}
ti[">"] = {"st_oneway_e"}
ti["a"] = {"it_magnet", name="a"}
ti["b"] = {"it_magnet", name="b"}
ti["A"] = {"st_switch_black", instant=true, target="a"}
ti["B"] = {"st_switch_black", instant=true, target="b"}
ti["1"] = {"st_monoflop", interval=0.1, target="move_magnet", _magnet="a", _direction=W}
ti["2"] = {"st_monoflop", interval=0.1, target="move_magnet", _magnet="a", _direction=E}
ti["3"] = {"st_monoflop", interval=0.1, target="move_magnet", _magnet="b", _direction=W}
ti["4"] = {"st_monoflop", interval=0.1, target="move_magnet", _magnet="b", _direction=E}

if wo["IsDifficult"] then
    ti["o"] = ti({"fl_aquamarine"}) .. {"it_meditation_dent"}
else
    ti["o"] = ti({"fl_red"}) .. {"it_meditation_dent"}
end

ti["*"] = {"#ac_pearl_white", controllers=CTRL_NONE}
ti["@"] = ti["="] .. {"ac_marble_black"}

wo(ti, " ", {
    "####################",
    "#*       >        *#",
    "#        %    %%%%%#",
    "#a %%% % %%%% %    #",
    "# %%o% %o%%o% %o%% #",
    "#    % %%%% % %%% b#",
    "#%%%%%    %        #",
    "#*        <       *#",
    "####################",
    ".........A#.........",
    "........1==2........",
    "........3=@4........",
    ".........#B........."})

function move_magnet(value, sender)
    if value == true then
        magnet = no[sender._magnet]
        destination = magnet + sender._direction
        if destination.x >= 1 and destination.x <= 18 then
            wo[destination] = {"it_magnet", name=magnet["name"], state=magnet["state"]}
            wo[magnet] = {"it_nil"}
        end
    end
end
 ]]></el:luamain>
    <el:i18n>
      <el:string el:key="title">
        <el:english el:translate="true"/>
        <el:translation el:lang="de">Fernmeditation</el:translation>
      </el:string>
    </el:i18n>
  </el:protected>
</el:level>
