diff options
author | Bardur Arantsson <bardur@scientician.net> | 2012-06-11 19:06:24 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2012-06-19 18:36:19 +0200 |
commit | 7833f2577399f212be5c107611f291be1b47ce8f (patch) | |
tree | 9b722b62f7e067024a98fc2fb442d151b400dbfc /src/joke.c | |
parent | c44efd43a83a5e6b2b696471fd46277cfd860518 (diff) |
Lua: Move joke monster code to C
Diffstat (limited to 'src/joke.c')
-rw-r--r-- | src/joke.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/joke.c b/src/joke.c new file mode 100644 index 00000000..0ff01557 --- /dev/null +++ b/src/joke.c @@ -0,0 +1,34 @@ +#include "angband.h" + +static void gen_joke_place_monster(r_idx) +{ + int try; + + for (try = 0; try < 1000; try++) + { + int x = randint(cur_hgt - 4) + 2; + int y = randint(cur_wid - 4) + 2; + + if (place_monster_one(y, x, r_idx, 0, FALSE, MSTATUS_ENEMY)) + { + return; + } + } +} + +bool_ gen_joke_monsters(void *data, void *in, void *out) +{ + if (joke_monsters) + { + if ((dungeon_type == 20) && + (dun_level == 72)) + { + int r_idx = test_monster_name("Neil, the Sorceror"); + m_allow_special[r_idx + 1] = TRUE; + gen_joke_place_monster(r_idx); + m_allow_special[r_idx + 1] = FALSE; + } + } + + return FALSE; +} |