Talk:Traproom
Jump to navigation
Jump to search
I was reading through Sporkhack code and stumbled across this new special room
+mktraproom()
+{
+ struct mkroom *sroom;
+ struct rm *lev;
+ int area, ttyp, ntraps;
+ int idx = (level_difficulty() + ((long)u.ubirthday)) % 9;
+
+ if(!(sroom = pick_room(TRUE))) return;
+
+ sroom->rtype = TRAPROOM;
+ if (!rn2(10)) idx = rn2(10); /* occasionally give anything if called twice on same level */
+
+ area = ((sroom->hx - sroom->lx + 1) * (sroom->hy - sroom->ly + 1));
+ ntraps = rn2(area/3) + (area/4);
+
+ while (ntraps-- > 0) {
+ switch (idx) {
+ default: ttyp = LANDMINE; break;
+ case 0: ttyp = ROLLING_BOULDER_TRAP; ntraps--; break;
+ case 1: ttyp = rn2(2) ? PIT : SPIKED_PIT; break;
+ case 2: ttyp = WEB; break;
+ case 3: ttyp = rn2(3) ? ROCKTRAP : COLLAPSE_TRAP; break;
+ case 4: ttyp = FIRE_TRAP; break;
+ case 5: ttyp = rn2(5) ? TRAPDOOR : HOLE; break;
+ case 6: ttyp = STATUE_TRAP; break;
+ case 7: ttyp = rn2(2) ? DART_TRAP : ARROW_TRAP; break;
+ }
+ mktrap(ttyp, 0, sroom, NULL);
+ }
+
+}
Generation:
case 10:
+ if (u_depth > 4 && !rn2(24)) { mkroom(TRAPROOM); break; }
--Ozymandias (talk) 01:51, 24 July 2013 (UTC) if someone could write this article, that would be great.