-- Drawbridges; northern one opens from the south (portcullis) to further
-- north (lowered span), southern one from the north to further south
des.drawbridge({ x=17, y=02, dir="south", state="random" })
-if math.random(0, 99) < 75 then
+if percent(75) then
des.drawbridge({ x=17, y=14, dir="north", state="open" })
else
des.drawbridge({ x=17, y=14, dir="north", state="random" })
-- 3.6.2: 60% twice == 36% chance that both sides open up, 24% left side
-- only, 24% right side only, 16% that neither side opens up
local hall;
- if math.random(0, 99) < 60 then
+ if percent(60) then
if i == 1 then
des.terrain(selection.area(17,14, 30,18),".")
des.wallify()
-- extra monsters; was [6 + 3d4] when both wings were opened up at once
for i=1,3 + math.random(2 - 1,2*3) do
des.monster({ id="Angel", coord = { hall:rndcoord(1) }, align="noalign", peaceful=0 })
- if math.random(0,99) < 50 then
+ if percent(50) then
des.monster({ coord = { hall:rndcoord(1) }, peaceful=0 })
end
end
des.mazewalk(00,06,"west")
des.stair("down", 44,06)
des.door("locked",00,06)
-if math.random(0, 99) < 50 then
+if percent(50) then
des.terrain(34,08,'-')
des.terrain(34,04,'S')
des.terrain(29,05,'|')
]]);
-if math.random(0,99) < 75 then
+if percent(75) then
local terrains = { "-", "F", "L", "T", "C" };
local tidx = math.random(1, #terrains);
local choice = math.random(0, 4);
.......................................................................
]]);
-if math.random(0,99) < 40 then
+if percent(40) then
-- occasionally it's not a fog maze
local terrain = { "L", "}", "T", "-", "F" };
local tidx = math.random(1, #terrain);
----------------------------------------------
]]);
-if math.random(0,99) < 40 then
+if percent(40) then
local terrain = { "L", "}", "T", ".", "-", "C" };
local tidx = math.random(1, #terrain);
des.replace_terrain({ region={00,00, 74,17}, fromterrain="F", toterrain=terrain[tidx] });
-- Throne room, with Croesus on the throne
des.region({ x1=37,y1=08,x2=46,y2=11, lit=1, type="throne", prefilled=0 })
-- 50% chance each to move throne and/or fort's entry secret door up one row
-if math.random(0, 99) < 50 then
+if percent(50) then
des.monster({ id = "Croesus", x=43, y=10, peaceful = 0 })
else
des.monster({ id = "Croesus", x=43, y=09, peaceful = 0 })
des.terrain(43,09, "\\")
des.terrain(43,10, ".")
end
-if math.random(0, 99) < 50 then
+if percent(50) then
des.terrain(47,09, "S")
des.terrain(47,10, "|")
end
treasury:iterate(treasure_spot);
-- Vault entrance also varies
-if math.random(0, 99) < 50 then
+if percent(50) then
des.terrain(36,09, "|")
des.terrain(36,10, "S")
end
des.object({ id = "statue", x=36,y=10, buc="uncursed",
montype="knight", historic=1, male = 1, name="Perseus",
contents = function()
- if math.random(0,99) < 75 then
+ if percent(75) then
des.object({ id = "shield of reflection", buc="cursed", spe=0 })
end
- if math.random(0,99) < 25 then
+ if percent(25) then
des.object({ id = "levitation boots", spe=0 })
end
- if math.random(0,99) < 50 then
+ if percent(50) then
des.object({ id = "scimitar", buc="blessed", spe=2 })
end
- if math.random(0,99) < 50 then
+ if percent(50) then
des.object("sack")
end
end
des.object({ id = "statue", x=68,y=10,buc="uncursed",
montype="knight", historic=1, male=1,name="Perseus",
contents = function()
- if math.random(0,99) < 25 then
+ if percent(25) then
des.object({ id = "shield of reflection", buc="cursed", spe=0 })
end
- if math.random(0,99) < 75 then
+ if percent(75) then
des.object({ id = "levitation boots", spe=0 })
end
- if math.random(0,99) < 50 then
+ if percent(50) then
des.object({ id = "scimitar", buc="blessed", spe=2 })
end
- if math.random(0,99) < 50 then
+ if percent(50) then
des.object("sack")
end
end
des.object({ id="statue",x=px, y=py, buc="uncursed",
montype="knight", historic=1, male=1,name="Perseus",
contents = function()
- if math.random(0,99) < 75 then
+ if percent(75) then
des.object({ id = "shield of reflection", buc="cursed", spe=0 })
end
- if math.random(0,99) < 25 then
+ if percent(25) then
des.object({ id = "levitation boots", spe=0 })
end
- if math.random(0,99) < 50 then
+ if percent(50) then
des.object({ id = "scimitar", buc="blessed", spe=2 })
end
- if math.random(0,99) < 50 then
+ if percent(50) then
des.object("sack")
end
end
des.object({ id="statue",x=px, y=py, buc="uncursed",
montype="knight", historic=1, male=1,name="Perseus",
contents = function()
- if math.random(0,99) < 75 then
+ if percent(75) then
des.object({ id = "shield of reflection", buc="cursed", spe=0 })
end
- if math.random(0,99) < 25 then
+ if percent(25) then
des.object({ id = "levitation boots", spe=0 })
end
- if math.random(0,99) < 50 then
+ if percent(50) then
des.object({ id = "scimitar", buc="blessed", spe=2 })
end
- if math.random(0,99) < 50 then
+ if percent(50) then
des.object("sack")
end
end
--
-- the nesting dragon
des.monster({ id = "yellow dragon", x=05, y=04, asleep=1 })
-if math.random(0,99) < 50 then
+if percent(50) then
des.monster({ id = "baby yellow dragon", x=04,y=04, asleep=1 })
end
-if math.random(0,99) < 25 then
+if percent(25) then
des.monster({ id = "baby yellow dragon", x=04, y=05, asleep=1 })
end
des.object({ id = "egg", x=05, y=04, montype="yellow dragon" });
-if math.random(0,99) < 50 then
+if percent(50) then
des.object({ id = "egg", x=05, y=04, montype="yellow dragon" });
end
-if math.random(0,99) < 25 then
+if percent(25) then
des.object({ id = "egg", x=05, y=04, montype="yellow dragon" });
end
--
---------------------------------------------------------------------------
]]);
-if math.random(0, 99) < 50 then
+if percent(50) then
des.terrain({55,14},"-")
des.terrain({56,14},"-")
des.terrain({61,15},"|")
des.terrain({52,5}, "S")
des.door("locked", 52,5)
end
-if math.random(0, 99) < 50 then
+if percent(50) then
des.terrain({18,1}, "|")
des.terrain(selection.area(7,12, 8,13), ".")
end
-if math.random(0, 99) < 50 then
+if percent(50) then
des.terrain({49,4}, "|")
des.terrain({21,5}, ".")
end
-if math.random(0, 99) < 50 then
- if math.random(0, 99) < 50 then
+if percent(50) then
+ if percent(50) then
des.terrain({22,1}, "|")
else
des.terrain({50,7}, "-")
-- Rubble!
for i=1,9 + math.random(2 - 1,2*5) do
- if math.random(0,99) < 90 then
+ if percent(90) then
des.object("boulder")
end
des.object("rock")
local near_temple = selection.area(17,8, 23,14) & inside
for i=1,5 + math.random(1 - 1,1*10) do
- if math.random(0, 99) < 50 then
+ if percent(50) then
des.monster({ id = "orc-captain", coord = { inside:rndcoord(1) }, peaceful=0 });
else
- if math.random(0, 99) < 80 then
+ if percent(80) then
des.monster({ id = "Uruk-hai", coord = { inside:rndcoord(1) }, peaceful=0 })
else
des.monster({ id = "Mordor orc", coord = { inside:rndcoord(1) }, peaceful=0 })
-- these are not such a big deal
-- to run into outside the bars
for i=1,9 + math.random(2 - 1,2*5) do
- if math.random(0, 99) < 90 then
+ if percent(90) then
des.monster({ id = "hill orc", peaceful = 0 })
else
des.monster({ id = "goblin", peaceful = 0 })
des.feature("fountain", 17, 5)
des.feature("fountain", 13, 8)
- if math.random(0,99) < 75 then
+ if percent(75) then
des.room({ type = "ordinary", x=2,y=0, w=2,h=2,
contents = function()
des.door({ state="closed", wall="west" })
})
end
- if math.random(0,99) < 75 then
+ if percent(75) then
des.room({ type = "ordinary", lit=0, x=5,y=0, w=2,h=2,
contents = function()
des.door({ state="closed", wall="south" })
})
end
- if math.random(0,99) < 75 then
+ if percent(75) then
des.room({ type = "ordinary", x=8,y=0, w=2,h=2,
contents = function()
des.door({ state="closed", wall="east" })
})
end
- if math.random(0,99) < 75 then
+ if percent(75) then
des.room({ type = "ordinary", lit=1, x=16,y=0, w=2,h=2,
contents = function()
des.door({ state="closed", wall="west" })
})
end
- if math.random(0,99) < 75 then
+ if percent(75) then
des.room({ type = "ordinary", lit=0, x=19,y=0, w=2,h=2,
contents = function()
des.door({ state="closed", wall="south" })
})
end
- if math.random(0,99) < 75 then
+ if percent(75) then
des.room({ type = "ordinary", x=22,y=0, w=2,h=2,
contents = function()
des.door({ state="closed", wall="south" })
})
end
- if math.random(0,99) < 75 then
+ if percent(75) then
des.room({ type = "ordinary", lit=0, x=25,y=0, w=2,h=2,
contents = function()
des.door({ state="closed", wall="east" })
})
end
- if math.random(0,99) < 75 then
+ if percent(75) then
des.room({ type = "ordinary", lit=1, x=2,y=5, w=2,h=2,
contents = function()
des.door({ state="closed", wall="north" })
})
end
- if math.random(0,99) < 75 then
+ if percent(75) then
des.room({ type = "ordinary", lit=1, x=5,y=5, w=2,h=2,
contents = function()
des.door({ state="closed", wall="south" })
})
end
- if math.random(0,99) < 75 then
+ if percent(75) then
des.room({ type = "ordinary", x=8,y=5, w=2,h=2,
contents = function()
des.door({ state="locked", wall="north" })
end
});
- if math.random(0,99) < 75 then
+ if percent(75) then
des.room({ type = "ordinary", lit=0, x=7,y=10, w=3,h=3,
contents = function()
des.door({ state="locked", wall="north" })
end
});
- if math.random(0,99) < 75 then
+ if percent(75) then
des.room({ type = "ordinary", lit=1, x=18,y=10, w=4,h=3,
contents = function()
des.door({ state="locked", wall="west" })
----- ------ ------- ---------------
]]);
-if math.random(0, 99) < 75 then
- if math.random(0, 99) < 50 then
+if percent(75) then
+ if percent(50) then
des.terrain(selection.line(25,8, 25,9), "|")
else
des.terrain(selection.line(16,13, 17,13), "-")
end
end
-if math.random(0, 99) < 75 then
- if math.random(0, 99) < 50 then
+if percent(75) then
+ if percent(50) then
des.terrain(selection.line(36,10, 36,11), "|")
else
des.terrain(selection.line(32,15, 33,15), "-")
end
end
-if math.random(0, 99) < 50 then
+if percent(50) then
des.terrain(selection.area(21,4, 22,5), ".")
des.terrain(selection.line(14,9, 14,10), "|")
end
-if math.random(0, 99) < 50 then
+if percent(50) then
des.terrain({46,13}, "|")
des.terrain(selection.line(43,5, 47,5), "-")
des.terrain(selection.line(42,6, 46,6), ".")
des.terrain(selection.line(46,7, 47,7), ".")
end
-if math.random(0,99) < 50 then
+if percent(50) then
des.terrain(selection.area(69,11, 71,11), "-")
end
des.feature("fountain", 12, 07)
des.feature("fountain", 11, 13)
- if math.random(0,99) < 75 then
+ if percent(75) then
des.room({ type="ordinary", x=2,y=2, w=4,h=2,
contents = function()
des.door({ state = "closed", wall="south" })
})
end
- if math.random(0,99) < 75 then
+ if percent(75) then
des.room({ type="ordinary", x=7,y=2, w=2,h=2,
contents = function()
des.door({ state = "closed", wall="north" })
})
end
- if math.random(0,99) < 75 then
+ if percent(75) then
des.room({ type="ordinary", x=7,y=5, w=2,h=2,
contents = function()
des.door({ state = "closed", wall="south" })
})
end
- if math.random(0,99) < 75 then
+ if percent(75) then
des.room({ type="ordinary", lit=1, x=10,y=2, w=3,h=4,
contents = function()
des.monster("gnome")
})
end
- if math.random(0,99) < 75 then
+ if percent(75) then
des.room({ type="ordinary", x=14,y=2, w=4,h=2,
contents = function()
des.door({ state = "closed", wall="south", pos=0 })
})
end
- if math.random(0,99) < 75 then
+ if percent(75) then
des.room({ type="ordinary", x=16,y=5, w=2,h=2,
contents = function()
des.door({ state = "closed", wall="south" })
})
end
- if math.random(0,99) < 75 then
+ if percent(75) then
des.room({ type="ordinary", lit=0, x=19,y=2, w=2,h=2,
contents = function()
des.door({ state = "locked", wall="east" })
end
})
- if math.random(0,99) < 75 then
+ if percent(75) then
des.room({ type="ordinary", x=2,y=7, w=2,h=2,
contents = function()
des.door({ state = "closed", wall="east" })
end
})
- if math.random(0,99) < 75 then
+ if percent(75) then
des.room({ type="ordinary", x=11,y=10, w=2,h=2,
contents = function()
des.door({ state = "locked", wall="west" })
end
})
- if math.random(0,99) < 75 then
+ if percent(75) then
des.room({ type="ordinary", x=17,y=11, w=4,h=2,
contents = function()
des.door({ state = "closed", wall="north" })
})
end
- if math.random(0,99) < 75 then
+ if percent(75) then
des.room({ type="ordinary", x=22,y=11, w=2,h=2,
contents = function()
des.door({ state = "closed", wall="south" })
-- percent(20) returns true 20% of the time
function percent(threshold)
- return math.random(0,99) < threshold
+ return math.random(0, 99) < threshold
end
prefilled = 0, irregular = 1 });
px, py = selection.rndcoord(place);
-if math.random(0, 99) < 75 then
+if percent(75) then
des.object({ id="bag of holding", x=px, y=py,
buc="not-cursed", achievement=1 });
else
prefilled = 0, irregular = 1 });
px, py = selection.rndcoord(place);
-if math.random(0, 99) < 25 then
+if percent(25) then
des.object({ id="bag of holding", x=px, y=py,
buc="not-cursed", achievement=1 });
else
-- Make the path somewhat unpredictable
-- If you get "lucky", you may have to go through all three graveyards.
-if math.random(0, 99) < 50 then
+if percent(50) then
des.terrain(selection.line(50,8, 53,8), '-')
des.terrain(selection.line(40,8, 43,8), 'B')
end
-if math.random(0, 99) < 50 then
+if percent(50) then
des.terrain({ x=27, y=12, typ='|' })
des.terrain(selection.line(27,3, 29,3), 'B')
des.terrain({ x=28, y=2, typ='-' })
end
-if math.random(0, 99) < 50 then
+if percent(50) then
des.terrain(selection.line(16,10, 16,11), '|')
des.terrain(selection.line(9,13, 14,13), 'B')
end
des.region({ region={20,06,26,11},lit=0,type="ordinary",prefilled=1,
contents = function()
local w = "north";
- if math.random(0,99) < 50 then w = "west" end
+ if percent(50) then w = "west" end
des.door({ state="secret", wall=w })
end
});