diff options
-rw-r--r-- | lib/mods/theme/scpt/library.lua | 74 | ||||
-rw-r--r-- | lib/scpt/library.lua | 74 | ||||
-rw-r--r-- | src/plots.c | 3 | ||||
-rw-r--r-- | src/plots.h | 3 | ||||
-rw-r--r-- | src/q_library.c | 53 | ||||
-rw-r--r-- | src/util.pkg | 2 |
6 files changed, 65 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, diff --git a/src/plots.c b/src/plots.c index 2fb1cbb1..b26d1e20 100644 --- a/src/plots.c +++ b/src/plots.c @@ -474,3 +474,6 @@ bool_ quest_null_hook(int q) /*************************** Bounty Quest *************************/ #include "q_bounty.c" + +/************************** Library Quest *************************/ +#include "q_library.c" diff --git a/src/plots.h b/src/plots.h index 903ffcef..2d78ee02 100644 --- a/src/plots.h +++ b/src/plots.h @@ -52,3 +52,6 @@ extern bool_ quest_bounty_init_hook(int q_idx); extern bool_ quest_bounty_drop_item(); extern bool_ quest_bounty_get_item(); extern bool_ quest_bounty_describe(FILE *fff); + +/******* Plot Library Quest *******/ +extern void quest_library_gen_hook(); diff --git a/src/q_library.c b/src/q_library.c new file mode 100644 index 00000000..edb1698f --- /dev/null +++ b/src/q_library.c @@ -0,0 +1,53 @@ +#undef cquest + +#define MONSTER_LICH 518 +#define MONSTER_MONASTIC_LICH 611 +#define MONSTER_FLESH_GOLEM 256 +#define MONSTER_CLAY_GOLEM 261 +#define MONSTER_IRON_GOLEM 367 +#define MONSTER_MITHRIL_GOLEM 464 + +static s16b library_quest_place_random(int minY, int minX, int maxY, int maxX, int r_idx) +{ + int y = randint(maxY - minY + 1) + minY; + int x = randint(maxX - minX + 1) + minX; + return place_monster_one(y, x, r_idx, 0, TRUE, MSTATUS_ENEMY); +} + +static void library_quest_place_nrandom(int minY, int minX, int maxY, int maxX, int r_idx, int n) +{ + while(n > 0) + { + if (0 < library_quest_place_random(minY, minX, maxY, maxX, r_idx)) + { + n--; + } + } +} + +void quest_library_gen_hook() +{ + library_quest_place_nrandom( + 4, 4, 14, 37, MONSTER_LICH, damroll(4,2)); + + library_quest_place_nrandom( + 14, 34, 37, 67, MONSTER_MONASTIC_LICH, damroll(1, 2)); + + library_quest_place_nrandom( + 4, 34, 14, 67, MONSTER_MONASTIC_LICH, damroll(1, 2) - 1); + + library_quest_place_nrandom( + 14, 4, 37, 34, MONSTER_MONASTIC_LICH, damroll(1, 2) - 1); + + library_quest_place_nrandom( + 10, 10, 37, 67, MONSTER_FLESH_GOLEM, 2); + + library_quest_place_nrandom( + 10, 10, 37, 67, MONSTER_CLAY_GOLEM, 2); + + library_quest_place_nrandom( + 10, 10, 37, 67, MONSTER_IRON_GOLEM, 2); + + library_quest_place_nrandom( + 10, 10, 37, 67, MONSTER_MITHRIL_GOLEM, 1); +} diff --git a/src/util.pkg b/src/util.pkg index 39f70b40..d13f74e6 100644 --- a/src/util.pkg +++ b/src/util.pkg @@ -2681,3 +2681,5 @@ extern void lite_spot(int y, int x); extern bool drop_text_left(byte c, cptr s, int y, int o); extern bool drop_text_right(byte c, cptr s, int y, int o); + +extern void quest_library_gen_hook(); |