monster(); */ monster("wood nymph"); */ monster("D"); */ monster("giant eel",11,06); */ monster("hill giant", {08,06}); */ monster({ id = "giant mimic", appear_as = "obj:boulder" }); */ monster({ class = "H", peaceful = 0 }); */
| 3211 | /* monster({ id = "giant mimic", appear_as = "obj:boulder" }); */ |
| 3212 | /* monster({ class = "H", peaceful = 0 }); */ |
| 3213 | int |
| 3214 | lspo_monster(lua_State *L) |
| 3215 | { |
| 3216 | int argc = lua_gettop(L); |
| 3217 | monster tmpmons; |
| 3218 | lua_Integer mx = -1, my = -1; |
| 3219 | int mgend = NEUTRAL; |
| 3220 | char *mappear = NULL; |
| 3221 | |
| 3222 | create_des_coder(); |
| 3223 | |
| 3224 | tmpmons.peaceful = -1; |
| 3225 | tmpmons.asleep = -1; |
| 3226 | tmpmons.name.str = NULL; |
| 3227 | tmpmons.appear = 0; |
| 3228 | tmpmons.appear_as.str = (char *) 0; |
| 3229 | tmpmons.sp_amask = AM_SPLEV_RANDOM; |
| 3230 | tmpmons.female = 0; |
| 3231 | tmpmons.invis = 0; |
| 3232 | tmpmons.cancelled = 0; |
| 3233 | tmpmons.revived = 0; |
| 3234 | tmpmons.avenge = 0; |
| 3235 | tmpmons.fleeing = 0; |
| 3236 | tmpmons.blinded = 0; |
| 3237 | tmpmons.paralyzed = 0; |
| 3238 | tmpmons.stunned = 0; |
| 3239 | tmpmons.confused = 0; |
| 3240 | tmpmons.seentraps = 0; |
| 3241 | tmpmons.has_invent = DEFAULT_INVENT; |
| 3242 | tmpmons.waiting = 0; |
| 3243 | tmpmons.mm_flags = NO_MM_FLAGS; |
| 3244 | tmpmons.m_lev_adj = 0; |
| 3245 | |
| 3246 | if (argc == 1 && lua_type(L, 1) == LUA_TSTRING) { |
| 3247 | const char *paramstr = luaL_checkstring(L, 1); |
| 3248 | |
| 3249 | if (strlen(paramstr) == 1) { |
| 3250 | tmpmons.class = *paramstr; |
| 3251 | tmpmons.id = NON_PM; |
| 3252 | } else { |
| 3253 | tmpmons.class = -1; |
| 3254 | tmpmons.id = find_montype(L, paramstr, &mgend); |
| 3255 | tmpmons.female = (mgend == FEMALE) ? FEMALE |
| 3256 | : (mgend == MALE) ? MALE : rn2(2); |
| 3257 | } |
| 3258 | } else if (argc == 2 && lua_type(L, 1) == LUA_TSTRING |
| 3259 | && lua_type(L, 2) == LUA_TTABLE) { |
| 3260 | const char *paramstr = luaL_checkstring(L, 1); |
| 3261 | |
| 3262 | (void) get_coord(L, 2, &mx, &my); |
| 3263 | |
| 3264 | if (strlen(paramstr) == 1) { |
| 3265 | tmpmons.class = *paramstr; |
| 3266 | tmpmons.id = NON_PM; |
| 3267 | } else { |
| 3268 | tmpmons.class = -1; |
| 3269 | tmpmons.id = find_montype(L, paramstr, &mgend); |
| 3270 | tmpmons.female = (mgend == FEMALE) ? FEMALE |
nothing calls this directly
no test coverage detected