summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2012-04-02 22:10:00 +0200
committerBardur Arantsson <bardur@scientician.net>2012-04-07 15:28:25 +0200
commit9ed872694d590996117dd936318e917f55ff6da0 (patch)
tree18222f88340d69a767f6aaa34d345931ab5f463f /lib
parent3215bb6521aca21af4d48f0598e1322ef8d8773c (diff)
Lua: Move "Library" quest monster placement code to C
Diffstat (limited to 'lib')
-rw-r--r--lib/mods/theme/scpt/library.lua74
-rw-r--r--lib/scpt/library.lua74
2 files changed, 4 insertions, 144 deletions
diff --git a/lib/mods/theme/scpt/library.lua b/lib/mods/theme/scpt/library.lua
index a16d37ef..4a8b03c4 100644
--- a/lib/mods/theme/scpt/library.lua
+++ b/lib/mods/theme/scpt/library.lua
@@ -4,13 +4,6 @@
library_quest = {}
--- Map helper
-library_quest.place_random = function(minY, minX, maxY, maxX, monster)
- y = randint(maxY - minY + 1) + minY
- x = randint(maxX - minX + 1) + minX
- return place_monster_one(y, x, monster, 0, TRUE, MSTATUS_ENEMY)
-end
-
-- Book creation helpers
library_quest.bookable_spells =
{
@@ -278,71 +271,8 @@ add_quest
load_map("library.map", 2, 2)
level_flags2 = DF2_NO_GENO
- -- generate the Liches 518
- liches = damroll(4, 2) -- plus one on the map
- while(liches > 0) do
- if 0 < library_quest.place_random(4, 4, 14, 37, 518) then
- liches = liches - 1
- end
- end
-
- -- generate the Monastic liches 611
- liches = damroll(1, 2)
- while(liches > 0) do
- if 0 < library_quest.place_random(14, 34, 37, 67, 611) then
- liches = liches - 1
- end
- end
-
- -- generate more Monastic liches 611
- liches = damroll(1, 2) - 1
- while(liches > 0) do
- if 0 < library_quest.place_random(4, 34, 14, 67, 611) then
- liches = liches - 1
- end
- end
-
- -- generate even more Monastic liches 611
- liches = damroll(1, 2) - 1
- while(liches > 0) do
- if 0 < library_quest.place_random(14, 4, 37, 34, 611) then
- liches = liches - 1
- end
- end
-
- -- Flesh golem 256
- golems = 2
- while(golems > 0) do
- if 0 < library_quest.place_random(10, 10, 37, 67, 256) then
- golems = golems - 1
- end
- end
-
- -- Clay golem 261
- golems = 2
- while(golems > 0) do
- if 0 < library_quest.place_random(10, 10, 37, 67, 261) then
- golems = golems - 1
- end
- end
-
- -- Iron golem 367
- golems = 2
- while(golems > 0) do
- if 0 < library_quest.place_random(10, 10, 37, 67, 367) then
- golems = golems - 1
- end
- end
-
- -- Mithril Golem 464
- golems = 1
- while(golems > 0) do
- if 0 < library_quest.place_random(10, 10, 37, 67, 464) then
- golems = golems - 1
- end
- end
-
- -- one Master lich is on the map
+ -- generate monsters
+ quest_library_gen_hook()
return TRUE
end,
diff --git a/lib/scpt/library.lua b/lib/scpt/library.lua
index 1433e47f..58e36556 100644
--- a/lib/scpt/library.lua
+++ b/lib/scpt/library.lua
@@ -4,13 +4,6 @@
library_quest = {}
--- Map helper
-library_quest.place_random = function(minY, minX, maxY, maxX, monster)
- y = randint(maxY - minY + 1) + minY
- x = randint(maxX - minX + 1) + minX
- return place_monster_one(y, x, monster, 0, TRUE, MSTATUS_ENEMY)
-end
-
-- Book creation helpers
library_quest.bookable_spells =
{
@@ -275,71 +268,8 @@ add_quest
load_map("library.map", 2, 2)
level_flags2 = DF2_NO_GENO
- -- generate the Liches 518
- liches = damroll(4, 2) -- plus one on the map
- while(liches > 0) do
- if 0 < library_quest.place_random(4, 4, 14, 37, 518) then
- liches = liches - 1
- end
- end
-
- -- generate the Monastic liches 611
- liches = damroll(1, 2)
- while(liches > 0) do
- if 0 < library_quest.place_random(14, 34, 37, 67, 611) then
- liches = liches - 1
- end
- end
-
- -- generate more Monastic liches 611
- liches = damroll(1, 2) - 1
- while(liches > 0) do
- if 0 < library_quest.place_random(4, 34, 14, 67, 611) then
- liches = liches - 1
- end
- end
-
- -- generate even more Monastic liches 611
- liches = damroll(1, 2) - 1
- while(liches > 0) do
- if 0 < library_quest.place_random(14, 4, 37, 34, 611) then
- liches = liches - 1
- end
- end
-
- -- Flesh golem 256
- golems = 2
- while(golems > 0) do
- if 0 < library_quest.place_random(10, 10, 37, 67, 256) then
- golems = golems - 1
- end
- end
-
- -- Clay golem 261
- golems = 2
- while(golems > 0) do
- if 0 < library_quest.place_random(10, 10, 37, 67, 261) then
- golems = golems - 1
- end
- end
-
- -- Iron golem 367
- golems = 2
- while(golems > 0) do
- if 0 < library_quest.place_random(10, 10, 37, 67, 367) then
- golems = golems - 1
- end
- end
-
- -- Mithril Golem 464
- golems = 1
- while(golems > 0) do
- if 0 < library_quest.place_random(10, 10, 37, 67, 464) then
- golems = golems - 1
- end
- end
-
- -- one Master lich is on the map
+ -- generate monsters
+ quest_library_gen_hook()
return TRUE
end,