~ubuntu-branches/ubuntu/saucy/enigma/saucy

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?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="Sacrifice" el:subtitle="" el:id="duffy49"/>
      <el:version el:score="1" el:release="1" el:revision="1" el:status="released"/>
      <el:author  el:name="Jacob Scott" el:email="" el:homepage=""/>
      <el:copyright>Copyright © 2003 Jacob Scott</el:copyright>
      <el:license el:type="GPL v2.0 or above" el:open="true"/>
      <el:compatibility el:enigma="0.92">
      </el:compatibility>
      <el:modes el:easy="false" el:single="true" el:network="false"/>
      <el:comments>
        <el:code>Lua 5.1 and XML converted by Leveladministrators</el:code>
      </el:comments>
      <el:score el:easy="-" el:difficult="-"/>
    </el:info>
    <el:luamain><![CDATA[
rooms_wide=3
rooms_high=1

levelw=1+(19*rooms_wide) +1
levelh=1+(12*rooms_high)

create_world( levelw, levelh)
enigma.ConserveLevel = 0

fill_floor("fl-leaves")

function renderLine( line, pattern)
    for i=1, strlen(pattern) do
        local c = strsub( pattern, i, i)
        if c =="#" then
            set_stone( "st-greenbrown", i-1, line)
        elseif c == "o" then
            oxyd( i-1, line)
        elseif c == "w" then
            set_stone( "st-glass", i-1, line)
        elseif c == "!" then
            abyss(i-1,line)
            fill_floor("fl-water", i-1,line, 1,1)
        elseif c=="z" then
            set_actor("ac-blackball", i-.5,line+.5)
        elseif c=="+" then
            set_stone( "st-wood",i-1,line)
        elseif c=="=" then
            fill_floor("fl-space", i-1,line, 1,1)
        elseif c=="B" then
            set_stone("st-bombs", i-1,line)
        elseif c=="d" then
            set_stone("st-oneway-s", i-1,line)
        elseif c=="l" then
            set_stone("st-oneway-w", i-1,line)
        elseif c=="s" then
            set_stone("st-stoneimpulse",i-1,line)
        elseif c=="S" then
            set_stone( "st-stoneimpulse-hollow", i-1,line)
        elseif c=="M" then
            mirrorp(i-1,line,FALSE,TRUE, 4)
        elseif c=="N" then
            mirrorp(i-1,line,TRUE,FALSE, 3)
        elseif c=="L" then
            set_attrib(laser(i-1,line, TRUE, EAST), "name", "laser")
        elseif c == "R" then
            set_stone("st-bolder-e", i-1,line)
        elseif c == "a" then
            set_stone( "st-switch", i-1, line, {target="start_ferry", action="callback"})
        end
    end
end
-- Floor:  " "
-- Border: "#"
-- Oxyd:   "o"

renderLine(00,"####################################################ooo###")
renderLine(01,"#a         w  w        ====== = = =   w   w  w   w w   wo#")
renderLine(02,"#      w   w   ww ww   ======= = = =  w w  w   w w w   ww#")
renderLine(03,"#      ww ww w     w   ====== = = =      w   w w   w     o")
renderLine(04,"#z           ww  w     ======= = = =  w    w   w w w     o")
renderLine(05,"#     w   w      w w   ====== = = =   w w w  w   w N     o")
renderLine(06,"#         w  ww  w     ======= = = =  w    w   w w w     o")
renderLine(07,"#               w  w   ====== = = =      w   w w   w     o")
renderLine(08,"#      ww    w    ww   ======= = = =  w w  w   w w w     o")
renderLine(09,"#       w    w     w   ====== = = =   w   w  w   w w     o")
renderLine(10,"#wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww###o #")
renderLine(11,"#L  MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMw #")
renderLine(12,"##########################################################")

oxyd_shuffle()

ferry_started = nil
ferry_x = 2
ferry_y = 10
ferry_width = 1
ferry_end = 54

function move_ferry()
    set_stone("st-greenbrown",ferry_x+ferry_width-2,ferry_y)
    set_stone("st-greenbrown",ferry_x+ferry_width-1,ferry_y)
    set_stone("st-greenbrown",ferry_x+ferry_width,ferry_y)
    if ferry_x>2 then
        set_stone("st-glass",ferry_x+ferry_width-3, ferry_y)
    end
    ferry_x = ferry_x + 1
end

function timer_callback()
    if ferry_x==ferry_end then
        ferry_x=2
    end
    if ferry_started and ferry_x < ferry_end then
        move_ferry()
    end
end

function start_ferry()
    if not ferry_started then
        move_ferry()
        ferry_started = 1
    end
end

set_stone( "st-timer", 58,0 ,{target="timer_callback", action="callback",name="timer", interval=.6})
    ]]></el:luamain>
    <el:i18n>
      <el:string el:key="title">
        <el:english el:translate="false"/>
      </el:string>
    </el:i18n>
  </el:protected>
</el:level>