1 /* SCCS Id: @(#)sp_lev.c 3.4 2001/09/06 */
2 /* Copyright (c) 1989 by Jean-Christophe Collet */
3 /* NetHack may be freely redistributed. See license for details. */
6 * This file contains the various functions that are related to the special
8 * It contains also the special level loader.
14 /* #define DEBUG */ /* uncomment to enable code debugging */
18 #define debugpline if (wizard) pline
20 #define debugpline pline
27 extern void mkmap(lev_init
*);
29 STATIC_DCL
void get_room_loc(schar
*, schar
*, struct mkroom
*);
30 STATIC_DCL
void get_free_room_loc(schar
*, schar
*, struct mkroom
*);
31 STATIC_DCL
void create_trap(trap
*, struct mkroom
*);
32 STATIC_DCL
int noncoalignment(ALIGNTYP_P
);
33 STATIC_DCL
void create_monster(monster
*, struct mkroom
*);
34 STATIC_DCL
void create_object(object
*, struct mkroom
*);
35 STATIC_DCL
void create_engraving(engraving
*,struct mkroom
*);
36 STATIC_DCL
void create_stairs(stair
*, struct mkroom
*);
37 STATIC_DCL
void create_altar(altar
*, struct mkroom
*);
38 STATIC_DCL
void create_gold(gold
*, struct mkroom
*);
39 STATIC_DCL
void create_feature(int,int,struct mkroom
*,int);
40 STATIC_DCL boolean
search_door(struct mkroom
*, xchar
*, xchar
*, XCHAR_P
, int);
41 STATIC_DCL
void fix_stair_rooms(void);
42 STATIC_DCL
void create_corridor(corridor
*);
44 STATIC_DCL boolean
create_subroom(struct mkroom
*, XCHAR_P
, XCHAR_P
, XCHAR_P
, XCHAR_P
, XCHAR_P
, XCHAR_P
);
57 #define sq(x) ((x)*(x))
62 #define Fread (void)dlb_fread
63 #define Fgetc (schar)dlb_fgetc
64 #define New(type) (type *) alloc(sizeof(type))
65 #define NewTab(type, size) (type **) alloc(sizeof(type *) * (unsigned)size)
67 static NEARDATA walk walklist
[50];
68 extern int min_rx
, max_rx
, min_ry
, max_ry
; /* from mkmap.c */
70 static char Map
[COLNO
][ROWNO
];
71 static char robjects
[10], rloc_x
[10][10], rloc_y
[10][10], rmonst
[10];
72 static aligntyp ralign
[3] = { AM_CHAOTIC
, AM_NEUTRAL
, AM_LAWFUL
};
73 static NEARDATA xchar xstart
, ystart
;
74 static NEARDATA
char xsize
, ysize
;
75 static lev_region rarea
[10];
77 STATIC_DCL
void set_wall_property(XCHAR_P
,XCHAR_P
,XCHAR_P
,XCHAR_P
,int);
78 STATIC_DCL
int rnddoor(void);
79 STATIC_DCL boolean
get_location(schar
*,schar
*,int);
80 STATIC_DCL
void sp_lev_shuffle(char *,char *,int);
81 STATIC_DCL
void light_region(region
*);
82 STATIC_DCL
void load_common_data(dlb
*,int);
83 STATIC_DCL
void load_one_monster(dlb
*,monster
*);
84 STATIC_DCL
void load_one_object(dlb
*,object
*);
85 STATIC_DCL
void load_one_engraving(dlb
*,engraving
*);
86 STATIC_DCL boolean
load_rooms(dlb
*);
87 STATIC_DCL
void maze1xy(coord
*,int);
88 STATIC_DCL boolean
load_maze(dlb
*);
89 STATIC_DCL
void create_door(room_door
*, struct mkroom
*);
90 STATIC_DCL
void free_rooms(room
**, int);
91 STATIC_DCL
void build_room(room
*, room
*);
93 char *lev_message
= 0;
94 lev_region
*lregions
= 0;
98 /* Make a random dungeon feature --Amy */
106 register int tryct
= 0;
107 register struct obj
*otmp
;
109 if (occupied(x
, y
)) return;
120 levl
[x
][y
].typ
= FOUNTAIN
; level
.flags
.nfountains
++; break;
146 levl
[x
][y
].typ
= CLOUD
; break;
168 levl
[x
][y
].typ
= ICE
; break;
190 levl
[x
][y
].typ
= POOL
; break;
202 levl
[x
][y
].typ
= LAVAPOOL
; break;
214 levl
[x
][y
].typ
= IRONBARS
; break;
236 levl
[x
][y
].typ
= TREE
; break;
258 make_grave(x
, y
, (char *) 0);
259 /* Possibly fill it with objects */
260 if (!rn2(5)) (void) mkgold(0L, x
, y
);
261 for (tryct
= rn2(2 + rn2(4)); tryct
; tryct
--) {
262 if (timebasedlowerchance()) {
263 otmp
= mkobj(rn2(3) ? COIN_CLASS
: RANDOM_CLASS
, TRUE
, FALSE
);
278 levl
[x
][y
].typ
= TOILET
; break;
285 levl
[x
][y
].typ
= SINK
; level
.flags
.nsinks
++; break;
288 levl
[x
][y
].typ
= THRONE
; break;
291 levl
[x
][y
].typ
= ALTAR
;
292 al
= rn2((int)A_LAWFUL
+2) - 1;
293 if (!rn2(10)) levl
[x
][y
].altarmask
= Align2amask( al
);
294 else levl
[x
][y
].altarmask
= Align2amask( A_NONE
);
297 register struct obj
*altarwater
;
298 altarwater
= mksobj_at(POT_WATER
, x
, y
, FALSE
, FALSE
, FALSE
);
301 if (Amask2align(levl
[x
][y
].altarmask
) == A_NONE
&& !rn2(5)) curse(altarwater
);
302 else bless(altarwater
);
309 levl
[x
][y
].typ
= PENTAGRAM
; break;
312 levl
[x
][y
].typ
= WELL
; break;
315 levl
[x
][y
].typ
= POISONEDWELL
; break;
318 levl
[x
][y
].typ
= WAGON
; break;
321 levl
[x
][y
].typ
= BURNINGWAGON
; break;
325 levl
[x
][y
].typ
= WOODENTABLE
; break;
328 levl
[x
][y
].typ
= CARVEDBED
; break;
335 levl
[x
][y
].typ
= STRAWMATTRESS
; break;
347 levl
[x
][y
].typ
= GRAVEWALL
; break;
354 levl
[x
][y
].typ
= TUNNELWALL
; break;
361 levl
[x
][y
].typ
= FARMLAND
; break;
366 levl
[x
][y
].typ
= MOUNTAIN
; break;
369 levl
[x
][y
].typ
= WATERTUNNEL
; break;
381 levl
[x
][y
].typ
= CRYSTALWATER
; break;
387 levl
[x
][y
].typ
= MOORLAND
; break;
391 levl
[x
][y
].typ
= URINELAKE
; break;
396 levl
[x
][y
].typ
= SHIFTINGSAND
; break;
401 levl
[x
][y
].typ
= STYXRIVER
; break;
418 levl
[x
][y
].typ
= SNOW
; break;
430 levl
[x
][y
].typ
= ASH
; break;
452 levl
[x
][y
].typ
= SAND
; break;
459 levl
[x
][y
].typ
= PAVEDFLOOR
; break;
465 levl
[x
][y
].typ
= HIGHWAY
; break;
492 levl
[x
][y
].typ
= GRASSLAND
; break;
499 levl
[x
][y
].typ
= NETHERMIST
; break;
504 levl
[x
][y
].typ
= STALACTITE
; break;
514 levl
[x
][y
].typ
= CRYPTFLOOR
; break;
519 levl
[x
][y
].typ
= BUBBLES
; break;
528 levl
[x
][y
].typ
= RAINCLOUD
; break;
531 levl
[x
][y
].typ
= PENTAGRAM
; break;
534 levl
[x
][y
].typ
= STONE
; break;
540 * Make walls of the area (x1, y1, x2, y2) non diggable/non passwall-able
544 set_wall_property(x1
,y1
,x2
,y2
, prop
)
545 xchar x1
, y1
, x2
, y2
;
550 for(y
= y1
; y
<= y2
; y
++)
551 for(x
= x1
; x
<= x2
; x
++)
552 if(IS_STWALL(levl
[x
][y
].typ
) && !(IS_DIGGABLEWALL(levl
[x
][y
].typ
)) )
553 levl
[x
][y
].wall_info
|= prop
;
557 * Choose randomly the state (nodoor, open, closed or locked) for a door
567 static NEARDATA
struct {
569 int tchoices
[TRAPNUM
];
570 } rndtrap_state
= { -1, {0} };
573 * Select a random trap
582 if (rndtrap_state
.choice_count
< 0) { /* need to recalculate */
584 rndtrap_state
.choice_count
= 0;
585 rndtrap_state
.tchoices
[ARROW_TRAP
] = 0;
589 /* Amy: use a rndmonst-like function to select a random trap with weighted probabilities, keyword "newtraps" */
590 for (; tndx
< TRAPNUM
; tndx
++) {
594 pline("rndtrap: bad count [#%d: %d]", tndx
, ct
); ct
= 0;
596 if (ct
> 10000) { /* arbitrary --Amy */
597 pline("rndtrap: bad count [#%d: %d]", tndx
, ct
); ct
= 10000;
599 if (tndx
> NO_TRAP
&& tndx
< TRAPNUM
) ct
++;
600 if (tndx
== ARROW_TRAP
) ct
+= 8;
601 if (tndx
== DART_TRAP
) ct
+= 8;
602 if (tndx
== ROCKTRAP
) ct
+= 8;
603 if (tndx
== SQKY_BOARD
) ct
+= 8;
604 if (tndx
== BEAR_TRAP
) ct
+= 5;
605 if (tndx
== LANDMINE
) ct
+= 5;
606 if (tndx
== ROLLING_BOULDER_TRAP
) ct
+= 5;
607 if (tndx
== SLP_GAS_TRAP
) ct
+= 8;
608 if (tndx
== RUST_TRAP
) ct
+= 8;
609 if (tndx
== FIRE_TRAP
) ct
+= 5;
610 if (tndx
== PIT
) ct
+= 8;
611 if (tndx
== SPIKED_PIT
) ct
+= 4;
612 if (tndx
== HOLE
) ct
+= 5;
613 if (tndx
== TRAPDOOR
) ct
+= 5;
614 if (tndx
== TELEP_TRAP
) ct
+= 5;
615 if (tndx
== LEVEL_TELEP
) ct
+= 2;
616 if (tndx
== WEB
) ct
+= 8;
617 if (tndx
== STATUE_TRAP
) ct
+= 9;
618 if (tndx
== MAGIC_TRAP
) ct
+= 5;
619 if (tndx
== ANTI_MAGIC
) ct
+= 5;
620 if (tndx
== POLY_TRAP
) ct
+= 2;
621 if (tndx
== ICE_TRAP
) ct
+= 5;
622 if (tndx
== SPEAR_TRAP
) ct
+= 1;
623 if (tndx
== SHIT_TRAP
) ct
+= 4;
624 if (tndx
== GLYPH_OF_WARDING
) ct
+= 4;
625 if (tndx
== SCYTHING_BLADE
) ct
+= 5;
626 if (tndx
== BOLT_TRAP
) ct
+= 5;
627 if (tndx
== ACID_POOL
) ct
+= 4;
628 if (tndx
== WATER_POOL
) ct
+= 4;
629 if (tndx
== POISON_GAS_TRAP
) ct
+= 4;
630 if (tndx
== SLOW_GAS_TRAP
) ct
+= 2;
631 if (tndx
== SHOCK_TRAP
) ct
+= 3;
632 if (tndx
== UNKNOWN_TRAP
) ct
+= 1;
633 if (tndx
== THROWING_STAR_TRAP
) ct
+= 2;
634 if (tndx
== LOUDSPEAKER
) ct
+= 2;
635 if (tndx
== LASER_TRAP
) ct
+= 2;
636 if (tndx
== CONFUSE_TRAP
) ct
+= 1;
637 if (tndx
== STUN_TRAP
) ct
+= 1;
638 if (tndx
== HALLUCINATION_TRAP
) ct
+= 1;
639 if (tndx
== NUMBNESS_TRAP
) ct
+= 1;
640 if (tndx
== FREEZING_TRAP
) ct
+= 1;
641 if (tndx
== BURNING_TRAP
) ct
+= 1;
642 if (tndx
== FEAR_TRAP
) ct
+= 1;
643 if (tndx
== BLINDNESS_TRAP
) ct
+= 1;
644 if (tndx
== SPINED_BALL_TRAP
) ct
+= 1;
645 if (tndx
== BANANA_TRAP
) ct
+= 1;
646 if (tndx
== SLINGSHOT_TRAP
) ct
+= 2;
647 if (tndx
== TRIP_ONCE_TRAP
) ct
+= 2;
648 if (tndx
== WALL_TRAP
) ct
+= 1;
649 if (tndx
== MACE_TRAP
) ct
+= 1;
650 if (tndx
== DAGGER_TRAP
) ct
+= 4;
651 if (tndx
== SCORE_DRAIN_TRAP
) ct
+= 4;
652 if (tndx
== DEBUFF_TRAP
) ct
+= 4;
653 if (tndx
== PHASEPORTER
) ct
+= 1;
654 if (tndx
== STAT_DAMAGE_TRAP
) ct
+= 2;
656 rndtrap_state
.choice_count
+= ct
;
657 rndtrap_state
.tchoices
[tndx
] = ct
;
664 ct
= rnd(rndtrap_state
.choice_count
);
666 for (tndx
= ARROW_TRAP
; tndx
< TRAPNUM
; tndx
++) {
667 if ((ct
-= (int)rndtrap_state
.tchoices
[tndx
]) <= 0) break;
672 if (!Race_if(PM_DEVELOPER
) && !u
.arabellahack
&& issoviet
&& !rn2(2)) rtrap
= rnd(rn2(3) ? ANTI_MAGIC
: POLY_TRAP
);
674 /* nasty traps, and otherwise "difficult" traps, were way too common; we want to address that --Amy */
675 if (rn2(issoviet
? 4 : 3) && !is_common_trap(rtrap
)) goto selecttrap
;
678 case S_PRESSING_TRAP
:
683 if (In_sokoban(&u
.uz
) && rn2(100)) goto selecttrap
;
687 if (In_sokoban(&u
.uz
) && rn2(10)) goto selecttrap
;
688 if (!Can_dig_down(&u
.uz
) && !Is_stronghold(&u
.uz
) ) goto selecttrap
;
691 /* make these much less often than other traps */
692 if (rn2(7)) goto selecttrap
;
693 if (In_sokoban(&u
.uz
) && rn2(10)) goto selecttrap
;
694 if (!Can_dig_down(&u
.uz
) && !Is_stronghold(&u
.uz
) ) goto selecttrap
;
698 if (In_sokoban(&u
.uz
) && rn2(10)) goto selecttrap
;
699 if (!Can_dig_down(&u
.uz
) && !Is_stronghold(&u
.uz
) ) goto selecttrap
;
700 if (rn2(3)) goto selecttrap
;
708 if (In_sokoban(&u
.uz
) && rn2(10)) goto selecttrap
;
712 if (level
.flags
.noteleport
|| Race_if(PM_STABILISATOR
) || Is_knox(&u
.uz
) || Is_blackmarket(&u
.uz
) || Is_aligned_quest(&u
.uz
) || In_endgame(&u
.uz
) || In_sokoban(&u
.uz
) ) goto selecttrap
;
715 if (level
.flags
.noteleport
|| Race_if(PM_STABILISATOR
) || Is_knox(&u
.uz
) || Is_blackmarket(&u
.uz
) || Is_aligned_quest(&u
.uz
) || In_endgame(&u
.uz
) || In_sokoban(&u
.uz
) ) goto selecttrap
;
718 if (level
.flags
.noteleport
|| Race_if(PM_STABILISATOR
) || Is_knox(&u
.uz
) || Is_blackmarket(&u
.uz
) || Is_aligned_quest(&u
.uz
) || In_endgame(&u
.uz
) || In_sokoban(&u
.uz
) ) goto selecttrap
;
721 if (level
.flags
.noteleport
|| Race_if(PM_STABILISATOR
)) goto selecttrap
;
724 if (level
.flags
.noteleport
|| Race_if(PM_STABILISATOR
)) goto selecttrap
;
727 if (level
.flags
.noteleport
|| Race_if(PM_STABILISATOR
)) goto selecttrap
;
730 if (level
.flags
.noteleport
|| Race_if(PM_STABILISATOR
)) goto selecttrap
;
732 case ROLLING_BOULDER_TRAP
:
733 if (In_endgame(&u
.uz
)) goto selecttrap
;
737 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 4 : 8)) goto selecttrap
;
740 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 20 : 40)) goto selecttrap
;
742 case AUTOMATIC_SWITCHER
:
743 if (!Role_if(PM_CAMPERSTRIKER
) && rn2(ishaxor
? (Role_if(PM_GRADUATE
) ? 125 : Role_if(PM_SPACEWARS_FIGHTER
) ? 250 : Role_if(PM_GEEK
) ? 250 : 500) : (Role_if(PM_GRADUATE
) ? 250 : Role_if(PM_SPACEWARS_FIGHTER
) ? 500 : Role_if(PM_GEEK
) ? 500 : 1000) )) goto selecttrap
;
746 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& !Role_if(PM_SPACEWARS_FIGHTER
) && rn2(2)) goto selecttrap
;
749 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& !Role_if(PM_SPACEWARS_FIGHTER
) && rn2(2)) goto selecttrap
;
752 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 2 : 3)) goto selecttrap
;
754 case SPELL_LOSS_TRAP
:
755 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 2 : 4)) goto selecttrap
;
757 case YELLOW_SPELL_TRAP
:
758 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 3 : 5)) goto selecttrap
;
760 case AUTO_DESTRUCT_TRAP
:
761 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 5 : 10)) goto selecttrap
;
763 case MEAN_BURDEN_TRAP
:
764 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 5 : 10)) goto selecttrap
;
767 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 10 : 20)) goto selecttrap
;
770 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 10 : 20)) goto selecttrap
;
773 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 25 : 50)) goto selecttrap
;
775 case BLACK_NG_WALL_TRAP
:
776 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 50 : 100)) goto selecttrap
;
778 case SUPERSCROLLER_TRAP
:
779 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 100 : 200)) goto selecttrap
;
781 case ACTIVE_SUPERSCROLLER_TRAP
: goto selecttrap
;
784 case PERSISTENT_FART_TRAP
:
785 if (rn2(evilfriday
? 5 : 16) && !NastyTrapNation
) goto selecttrap
;
787 case ATTACKING_HEEL_TRAP
:
788 if (rn2(evilfriday
? 5 : 16) && !NastyTrapNation
) goto selecttrap
;
790 case ALIGNMENT_TRASH_TRAP
:
791 if (rn2(evilfriday
? 2 : 10) && !NastyTrapNation
) goto selecttrap
;
794 if (rn2(evilfriday
? 10 : 100) && !NastyTrapNation
) goto selecttrap
;
797 if (rn2(evilfriday
? 10 : 100) && !NastyTrapNation
) goto selecttrap
;
800 if (rn2(evilfriday
? 2 : 10) && !NastyTrapNation
) goto selecttrap
;
802 case MALEVOLENCE_TRAP
:
803 if (rn2(evilfriday
? 10 : 100) && !NastyTrapNation
) goto selecttrap
;
806 if (rn2(evilfriday
? 2 : 20) && !NastyTrapNation
) goto selecttrap
;
809 if (rn2(evilfriday
? 3 : 15) && !NastyTrapNation
) goto selecttrap
;
812 if (rn2(evilfriday
? 8 : 50) && !NastyTrapNation
) goto selecttrap
;
814 case RARE_SPAWN_TRAP
:
815 if (rn2(evilfriday
? 3 : 15) && !NastyTrapNation
) goto selecttrap
;
817 case YOU_ARE_AN_IDIOT_TRAP
:
818 if (rn2(evilfriday
? 50 : 200) && !NastyTrapNation
) goto selecttrap
;
820 case NASTYCURSE_TRAP
:
821 if (rn2(evilfriday
? 10 : 100) && !NastyTrapNation
) goto selecttrap
;
823 case ITEM_TELEP_TRAP
:
824 if (rn2(evilfriday
? 3 : 15) && !NastyTrapNation
) goto selecttrap
;
827 if (rn2(evilfriday
? 10 : 50) && !NastyTrapNation
) goto selecttrap
;
830 if (rn2(evilfriday
? 2 : 20) && !NastyTrapNation
) goto selecttrap
;
833 if ((rn2(3) && !evilfriday
) && !NastyTrapNation
) goto selecttrap
;
836 if (rn2(evilfriday
? 2 : 10) && !NastyTrapNation
) goto selecttrap
;
839 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 5 : 10 )) goto selecttrap
;
841 case DISINTEGRATION_TRAP
:
842 if (rn2(evilfriday
? 5 : 20) && !NastyTrapNation
) goto selecttrap
;
844 case UNIDENTIFY_TRAP
:
845 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 10 : 20 )) goto selecttrap
;
848 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 25 : 50 )) goto selecttrap
;
850 case SHADES_OF_GREY_TRAP
:
851 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 20 : 40 )) goto selecttrap
;
854 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 30 : 60 )) goto selecttrap
;
857 if (rn2(evilfriday
? 10 : 100) && !NastyTrapNation
) goto selecttrap
;
859 case STONE_TO_FLESH_TRAP
:
860 if (rn2(evilfriday
? 10 : 100) && !NastyTrapNation
) goto selecttrap
;
863 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 24 : 48 )) goto selecttrap
;
866 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 32 : 64 )) goto selecttrap
;
868 case DIFFICULTY_TRAP
:
869 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 12 : 24 )) goto selecttrap
;
872 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 7 : 14 )) goto selecttrap
;
875 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 6 : 12 )) goto selecttrap
;
878 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 3 : 6 )) goto selecttrap
;
880 case ROT_THIRTEEN_TRAP
:
881 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 15 : 30 )) goto selecttrap
;
884 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 28 : 56 )) goto selecttrap
;
887 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 40 : 80 )) goto selecttrap
;
890 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 35 : 70 )) goto selecttrap
;
893 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 4 : 8 )) goto selecttrap
;
896 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 4 : 9 )) goto selecttrap
;
899 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 3 : 7 )) goto selecttrap
;
902 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 5 : 11 )) goto selecttrap
;
904 case UNINFORMATION_TRAP
:
905 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 2 : 3 )) goto selecttrap
;
908 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 15 : 30 )) goto selecttrap
;
910 case SPELL_COOLDOWN_TRAP
:
911 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 10 : 20 )) goto selecttrap
;
914 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 5 : 10 )) goto selecttrap
;
917 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 20 : 40 )) goto selecttrap
;
920 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 20 : 40 )) goto selecttrap
;
923 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 23 : 46 )) goto selecttrap
;
925 case INACCURACY_TRAP
:
926 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 4 : 7 )) goto selecttrap
;
928 case MONSTER_MULTISHOT_TRAP
:
929 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 5 : 9 )) goto selecttrap
;
931 case DO_YOU_HAVE_A_PIN_TRAP
:
932 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 13 : 25 )) goto selecttrap
;
934 case COSTLY_FAILURE_TRAP
:
935 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 7 : 14 )) goto selecttrap
;
937 case INVENTORY_SIZE_TRAP
:
938 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 50 : 100 )) goto selecttrap
;
941 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 22 : 45 )) goto selecttrap
;
943 case FUCKFUCKFUCK_TRAP
:
944 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 10 : 20 )) goto selecttrap
;
947 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 10 : 20 )) goto selecttrap
;
950 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 20 : 40 )) goto selecttrap
;
953 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 5 : 10 )) goto selecttrap
;
955 case ONE_RAINBOW_TRAP
:
956 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 4 : 9 )) goto selecttrap
;
958 case COLORSHIFT_TRAP
:
959 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 4 : 9 )) goto selecttrap
;
962 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 3 : 6 )) goto selecttrap
;
965 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 4 : 8 )) goto selecttrap
;
967 case UN_KNOWLEDGE_TRAP
:
968 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 8 : 16 )) goto selecttrap
;
971 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 5 : 10 )) goto selecttrap
;
973 case DSCHUEUEUET_TRAP
:
974 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 5 : 10 )) goto selecttrap
;
977 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 11 : 22 )) goto selecttrap
;
980 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 12 : 25 )) goto selecttrap
;
982 case ESCAPE_PAST_TRAP
:
983 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 10 : 20 )) goto selecttrap
;
986 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 22 : 44 )) goto selecttrap
;
988 case PET_LASHOUT_TRAP
:
989 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 22 : 44 )) goto selecttrap
;
992 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 22 : 44 )) goto selecttrap
;
995 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 22 : 44 )) goto selecttrap
;
998 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 4 : 8 )) goto selecttrap
;
1001 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 15 : 30 )) goto selecttrap
;
1003 case PROOFLOSS_TRAP
:
1004 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 15 : 30 )) goto selecttrap
;
1006 case DETECTATION_TRAP
:
1007 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 18 : 35 )) goto selecttrap
;
1009 case REPEATING_NASTYCURSE_TRAP
:
1010 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 50 : 100 )) goto selecttrap
;
1012 case REALLY_BAD_TRAP
:
1013 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 20 : 40 )) goto selecttrap
;
1016 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 15 : 30 )) goto selecttrap
;
1018 case ARTIBLAST_TRAP
:
1019 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 5 : 9 )) goto selecttrap
;
1021 case GIANT_EXPLORER_TRAP
:
1022 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 40 : 80 )) goto selecttrap
;
1025 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 10 : 20 )) goto selecttrap
;
1028 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 7 : 15 )) goto selecttrap
;
1030 case CRADLE_OF_CHAOS_TRAP
:
1031 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 10 : 20 )) goto selecttrap
;
1033 case TEZCATLIPOCA_TRAP
:
1034 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 25 : 50 )) goto selecttrap
;
1036 case ENTHUMESIS_TRAP
:
1037 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 50 : 100 )) goto selecttrap
;
1039 case MIKRAANESIS_TRAP
:
1040 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 100 : 200 )) goto selecttrap
;
1042 case GOTS_TOO_GOOD_TRAP
:
1043 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 25 : 50 )) goto selecttrap
;
1045 case KILLER_ROOM_TRAP
:
1046 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 20 : 40 )) goto selecttrap
;
1048 case NO_FUN_WALLS_TRAP
:
1049 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 17 : 35 )) goto selecttrap
;
1051 case SANITY_TREBLE_TRAP
:
1052 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 25 : 51 )) goto selecttrap
;
1054 case STAT_DECREASE_TRAP
:
1055 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 10 : 20 )) goto selecttrap
;
1058 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 50 : 100 )) goto selecttrap
;
1061 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 10 : 20 )) goto selecttrap
;
1063 case COMPLETELY_BAD_PART_TRAP
:
1064 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 26 : 52 )) goto selecttrap
;
1066 case EVIL_VARIANT_TRAP
:
1067 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 500 : 1000 )) goto selecttrap
;
1070 case INTRINSIC_LOSS_TRAP
:
1071 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 6 : 12 )) goto selecttrap
;
1073 case BLOOD_LOSS_TRAP
:
1074 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 9 : 18 )) goto selecttrap
;
1076 case BAD_EFFECT_TRAP
:
1077 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 2 : 3 )) goto selecttrap
;
1080 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 8 : 17 )) goto selecttrap
;
1082 case AUTO_VULN_TRAP
:
1083 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 5 : 10 )) goto selecttrap
;
1085 case TELE_ITEMS_TRAP
:
1086 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 20 : 40 )) goto selecttrap
;
1088 case NASTINESS_TRAP
:
1089 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 250 : 500 )) goto selecttrap
;
1093 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 17 : 34 )) goto selecttrap
;
1096 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 10 : 20 )) goto selecttrap
;
1099 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 3 : 5 )) goto selecttrap
;
1102 case RECURRING_AMNESIA_TRAP
:
1103 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 35 : 70 )) goto selecttrap
;
1105 case BIGSCRIPT_TRAP
:
1106 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 2 : 3 )) goto selecttrap
;
1109 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 13 : 26 )) goto selecttrap
;
1112 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 30 : 60 )) goto selecttrap
;
1115 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 10 : 20 )) goto selecttrap
;
1118 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 20 : 40 )) goto selecttrap
;
1120 case DISENCHANT_TRAP
:
1121 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 30 : 60 )) goto selecttrap
;
1124 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 25 : 50 )) goto selecttrap
;
1127 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 17 : 33 )) goto selecttrap
;
1130 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 24 : 48 )) goto selecttrap
;
1133 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 22 : 44 )) goto selecttrap
;
1135 case ENGRAVING_TRAP
:
1136 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 9 : 17 )) goto selecttrap
;
1138 case MAGIC_DEVICE_TRAP
:
1139 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 14 : 28 )) goto selecttrap
;
1142 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 10 : 19 )) goto selecttrap
;
1145 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 8 : 15 )) goto selecttrap
;
1148 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 6 : 11 )) goto selecttrap
;
1151 case METABOLIC_TRAP
:
1152 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 10 : 20 )) goto selecttrap
;
1154 case TRAP_OF_NO_RETURN
:
1155 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 15 : 30 )) goto selecttrap
;
1158 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 7 : 15 )) goto selecttrap
;
1160 case FAST_FORWARD_TRAP
:
1161 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 20 : 40 )) goto selecttrap
;
1163 case TRAP_OF_ROTTENNESS
:
1164 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 8 : 17 )) goto selecttrap
;
1166 case UNSKILLED_TRAP
:
1167 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 5 : 10 )) goto selecttrap
;
1169 case LOW_STATS_TRAP
:
1170 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 6 : 13 )) goto selecttrap
;
1173 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 3 : 6 )) goto selecttrap
;
1176 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 2 : 4 )) goto selecttrap
;
1179 case LIMITATION_TRAP
:
1180 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 20 : 40 )) goto selecttrap
;
1182 case WEAK_SIGHT_TRAP
:
1183 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 8 : 16 )) goto selecttrap
;
1185 case RANDOM_MESSAGE_TRAP
:
1186 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 8 : 16 )) goto selecttrap
;
1189 case DESECRATION_TRAP
:
1190 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 20 : 40 )) goto selecttrap
;
1192 case STARVATION_TRAP
:
1193 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 5 : 10 )) goto selecttrap
;
1196 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 25 : 50 )) goto selecttrap
;
1198 case LOW_EFFECT_TRAP
:
1199 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 7 : 14 )) goto selecttrap
;
1201 case INVISIBLE_TRAP
:
1202 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 45 : 90 )) goto selecttrap
;
1204 case GHOST_WORLD_TRAP
:
1205 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 15 : 30 )) goto selecttrap
;
1207 case DEHYDRATION_TRAP
:
1208 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 8 : 15 )) goto selecttrap
;
1211 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 5 : 10 )) goto selecttrap
;
1214 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 150 : 300 )) goto selecttrap
;
1216 case NONINTRINSICAL_TRAP
:
1217 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 6 : 12 )) goto selecttrap
;
1219 case DROPCURSE_TRAP
:
1220 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 14 : 28 )) goto selecttrap
;
1222 case NAKEDNESS_TRAP
:
1223 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 25 : 50 )) goto selecttrap
;
1225 case ANTILEVEL_TRAP
:
1226 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 75 : 150 )) goto selecttrap
;
1229 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 2 : 4 )) goto selecttrap
;
1231 case REBELLION_TRAP
:
1232 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 2 : 5 )) goto selecttrap
;
1235 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 6 : 13 )) goto selecttrap
;
1238 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 7 : 13 )) goto selecttrap
;
1241 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 24 : 48 )) goto selecttrap
;
1244 case DISCONNECT_TRAP
:
1245 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 10 : 20 )) goto selecttrap
;
1247 case INTERFACE_SCREW_TRAP
:
1248 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 80 : 160 )) goto selecttrap
;
1250 case BOSSFIGHT_TRAP
:
1251 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 5 : 10 )) goto selecttrap
;
1253 case ENTIRE_LEVEL_TRAP
:
1254 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 8 : 17 )) goto selecttrap
;
1257 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 2 : 4 )) goto selecttrap
;
1259 case AUTOCURSE_TRAP
:
1260 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 24 : 49 )) goto selecttrap
;
1262 case HIGHLEVEL_TRAP
:
1263 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 7 : 13 )) goto selecttrap
;
1265 case SPELL_FORGETTING_TRAP
:
1266 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 21 : 42 )) goto selecttrap
;
1268 case SOUND_EFFECT_TRAP
:
1269 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 4 : 7 )) goto selecttrap
;
1273 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 9 : 18 )) goto selecttrap
;
1275 case MONSTER_SPEED_TRAP
:
1276 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 20 : 40 )) goto selecttrap
;
1279 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 15 : 30 )) goto selecttrap
;
1282 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 7 : 15 )) goto selecttrap
;
1284 case WHITE_SPELL_TRAP
:
1285 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 5 : 10 )) goto selecttrap
;
1287 case COMPLETE_GRAY_SPELL_TRAP
:
1288 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 6 : 12 )) goto selecttrap
;
1291 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 100 : 200 )) goto selecttrap
;
1294 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 4 : 8 )) goto selecttrap
;
1297 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 7 : 14 )) goto selecttrap
;
1299 case ARTIFICER_TRAP
:
1300 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 40 : 80 )) goto selecttrap
;
1303 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 25 : 50 )) goto selecttrap
;
1305 case NON_PRAYER_TRAP
:
1306 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 10 : 20 )) goto selecttrap
;
1308 case EVIL_PATCH_TRAP
:
1309 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 500 : 1000 )) goto selecttrap
;
1311 case HARD_MODE_TRAP
:
1312 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 45 : 90 )) goto selecttrap
;
1314 case SECRET_ATTACK_TRAP
:
1315 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 15 : 30 )) goto selecttrap
;
1318 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 10 : 20 )) goto selecttrap
;
1320 case COVETOUSNESS_TRAP
:
1321 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 3 : 7 )) goto selecttrap
;
1324 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 4 : 7 )) goto selecttrap
;
1326 case DARK_MODE_TRAP
:
1327 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 5 : 9 )) goto selecttrap
;
1329 case ANTISEARCH_TRAP
:
1330 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 6 : 12 )) goto selecttrap
;
1333 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 30 : 60 )) goto selecttrap
;
1335 case NASTY_NATION_TRAP
:
1336 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 70 : 140 )) goto selecttrap
;
1338 case WAKEUP_CALL_TRAP
:
1339 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 20 : 40 )) goto selecttrap
;
1342 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 17 : 34 )) goto selecttrap
;
1344 case GRAY_CENTER_TRAP
:
1345 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 18 : 37 )) goto selecttrap
;
1347 case CHECKERBOARD_TRAP
:
1348 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 20 : 40 )) goto selecttrap
;
1350 case CLOCKWISE_SPIN_TRAP
:
1351 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 350 : 700 )) goto selecttrap
;
1353 case COUNTERCLOCKWISE_SPIN_TRAP
:
1354 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 250 : 500 )) goto selecttrap
;
1357 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 90 : 180 )) goto selecttrap
;
1359 case BLESSCURSE_TRAP
:
1360 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 11 : 22 )) goto selecttrap
;
1363 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 3 : 6 )) goto selecttrap
;
1365 case DISCHARGE_TRAP
:
1366 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 3 : 5 )) goto selecttrap
;
1369 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 14 : 28 )) goto selecttrap
;
1371 case FILTERING_TRAP
:
1372 if (!Role_if(PM_CAMPERSTRIKER
) && !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 5 : 10 )) goto selecttrap
;
1374 case DEFORMATTING_TRAP
:
1375 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 3 : 6 )) goto selecttrap
;
1377 case FLICKER_STRIP_TRAP
:
1378 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 2 : 4 )) goto selecttrap
;
1380 case UNDRESSING_TRAP
:
1381 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 17 : 34 )) goto selecttrap
;
1383 case HYPERBLUEWALL_TRAP
:
1384 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 18 : 36 )) goto selecttrap
;
1387 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 6 : 12 )) goto selecttrap
;
1390 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 25 : 50 )) goto selecttrap
;
1392 case FLEECESCRIPT_TRAP
:
1393 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 4 : 7 )) goto selecttrap
;
1395 case INTERRUPT_TRAP
:
1396 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 12 : 25 )) goto selecttrap
;
1399 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 13 : 26 )) goto selecttrap
;
1401 case MANA_BATTERY_TRAP
:
1402 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 9 : 19 )) goto selecttrap
;
1404 case MONSTERFINGERS_TRAP
:
1405 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 10 : 19 )) goto selecttrap
;
1408 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 12 : 23 )) goto selecttrap
;
1410 case MESSAGE_SUPPRESSION_TRAP
:
1411 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 12 : 25 )) goto selecttrap
;
1413 case STUCK_ANNOUNCEMENT_TRAP
:
1414 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 7 : 15 )) goto selecttrap
;
1416 case BLOODTHIRSTY_TRAP
:
1417 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 18 : 35 )) goto selecttrap
;
1419 case MAXIMUM_DAMAGE_TRAP
:
1420 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 16 : 32 )) goto selecttrap
;
1423 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 30 : 60 )) goto selecttrap
;
1426 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 35 : 70 )) goto selecttrap
;
1428 case KNOWLEDGE_TRAP
:
1429 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 25 : 50 )) goto selecttrap
;
1431 case HIGHSCORE_TRAP
:
1432 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 40 : 80 )) goto selecttrap
;
1434 case PINK_SPELL_TRAP
:
1435 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 24 : 48 )) goto selecttrap
;
1437 case GREEN_SPELL_TRAP
:
1438 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 13 : 26 )) goto selecttrap
;
1441 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 4 : 8 )) goto selecttrap
;
1443 case UNDERLAYER_TRAP
:
1444 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 20 : 39 )) goto selecttrap
;
1446 case DAMAGE_METER_TRAP
:
1447 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 5 : 9 )) goto selecttrap
;
1449 case ARBITRARY_WEIGHT_TRAP
:
1450 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 4 : 8 )) goto selecttrap
;
1452 case FUCKED_INFO_TRAP
:
1453 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 6 : 12 )) goto selecttrap
;
1455 case BLACK_SPELL_TRAP
:
1456 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 16 : 32 )) goto selecttrap
;
1458 case CYAN_SPELL_TRAP
:
1459 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 20 : 40 )) goto selecttrap
;
1462 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 11 : 22 )) goto selecttrap
;
1464 case BLUE_SPELL_TRAP
:
1465 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 8 : 17 )) goto selecttrap
;
1468 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 26 : 53 )) goto selecttrap
;
1470 case RED_SPELL_TRAP
:
1471 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 15 : 30 )) goto selecttrap
;
1473 case TOO_HEAVY_TRAP
:
1474 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 14 : 28 )) goto selecttrap
;
1476 case ELONGATION_TRAP
:
1477 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 25 : 51 )) goto selecttrap
;
1480 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 36 : 72 )) goto selecttrap
;
1482 case DESTRUCTION_TRAP
:
1483 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 16 : 32 )) goto selecttrap
;
1485 case MELEE_PREFIX_TRAP
:
1486 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 40 : 80 )) goto selecttrap
;
1489 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 10 : 20 )) goto selecttrap
;
1491 case UNFAIR_ATTACK_TRAP
:
1492 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 35 : 70 )) goto selecttrap
;
1495 case ORANGE_SPELL_TRAP
:
1496 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 16 : 31 )) goto selecttrap
;
1499 case VIOLET_SPELL_TRAP
:
1500 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 4 : 8 )) goto selecttrap
;
1503 case TRAP_OF_LONGING
:
1504 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 10 : 20 )) goto selecttrap
;
1507 case CURSED_PART_TRAP
:
1508 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 6 : 11 )) goto selecttrap
;
1511 case QUAVERSAL_TRAP
:
1512 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 100 : 200 )) goto selecttrap
;
1515 case APPEARANCE_SHUFFLING_TRAP
:
1516 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 25 : 50 )) goto selecttrap
;
1519 case BROWN_SPELL_TRAP
:
1520 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 6 : 11 )) goto selecttrap
;
1523 case CHOICELESS_TRAP
:
1524 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 16 : 32 )) goto selecttrap
;
1527 case GOLDSPELL_TRAP
:
1528 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 20 : 40 )) goto selecttrap
;
1531 case DEPROVEMENT_TRAP
:
1532 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 45 : 90 )) goto selecttrap
;
1535 case INITIALIZATION_TRAP
:
1536 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 25 : 50 )) goto selecttrap
;
1540 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 12 : 24 )) goto selecttrap
;
1544 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 4 : 7 )) goto selecttrap
;
1547 case DANGEROUS_TERRAIN_TRAP
:
1548 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 13 : 26 )) goto selecttrap
;
1552 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 24 : 48 )) goto selecttrap
;
1556 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 14 : 28 )) goto selecttrap
;
1559 case GRAVATION_TRAP
:
1560 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 16 : 32 )) goto selecttrap
;
1564 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 9 : 17 )) goto selecttrap
;
1567 case EXPLODING_DICE_TRAP
:
1568 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 22 : 44 )) goto selecttrap
;
1571 case PERMACURSE_TRAP
:
1572 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 26 : 52 )) goto selecttrap
;
1575 case SHROUDED_IDENTITY_TRAP
:
1576 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 15 : 30 )) goto selecttrap
;
1579 case FEELER_GAUGES_TRAP
:
1580 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 6 : 12 )) goto selecttrap
;
1583 case LONG_SCREWUP_TRAP
:
1584 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 14 : 28 )) goto selecttrap
;
1587 case WING_YELLOW_CHANGER
:
1588 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 33 : 66 )) goto selecttrap
;
1591 case LIFE_SAVING_TRAP
:
1592 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 27 : 54 )) goto selecttrap
;
1596 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 14 : 27 )) goto selecttrap
;
1599 case CUT_NUTRITION_TRAP
:
1600 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 10 : 20 )) goto selecttrap
;
1603 case SKILL_LOSS_TRAP
:
1604 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 32 : 64 )) goto selecttrap
;
1607 case AUTOPILOT_TRAP
:
1608 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 100 : 200 )) goto selecttrap
;
1612 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 24 : 48 )) goto selecttrap
;
1615 case MONSTER_GLYPH_TRAP
:
1616 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 13 : 26 )) goto selecttrap
;
1619 case CHANGING_DIRECTIVE_TRAP
:
1620 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 20 : 40 )) goto selecttrap
;
1623 case CONTAINER_KABOOM_TRAP
:
1624 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 16 : 32 )) goto selecttrap
;
1627 case STEAL_DEGRADE_TRAP
:
1628 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 19 : 38 )) goto selecttrap
;
1631 case LEFT_INVENTORY_TRAP
:
1632 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 20 : 40 )) goto selecttrap
;
1635 case FLUCTUATING_SPEED_TRAP
:
1636 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 50 : 100 )) goto selecttrap
;
1639 case TARMUSTROKINGNORA_TRAP
:
1640 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 20 : 40 )) goto selecttrap
;
1644 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 10 : 20 )) goto selecttrap
;
1647 case BRIGHT_CYAN_SPELL_TRAP
:
1648 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 22 : 44 )) goto selecttrap
;
1651 case FREQUENTATION_SPAWN_TRAP
:
1652 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 7 : 14 )) goto selecttrap
;
1656 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 22 : 44 )) goto selecttrap
;
1660 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 5 : 10 )) goto selecttrap
;
1663 case REMEMBERANCE_TRAP
:
1664 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 9 : 19 )) goto selecttrap
;
1668 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 2 : 4 )) goto selecttrap
;
1671 case AUTOPICKUP_TRAP
:
1672 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 4 : 9 )) goto selecttrap
;
1676 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 11 : 22 )) goto selecttrap
;
1679 case SILVER_SPELL_TRAP
:
1680 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 14 : 28 )) goto selecttrap
;
1683 case METAL_SPELL_TRAP
:
1684 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 14 : 27 )) goto selecttrap
;
1687 case PLATINUM_SPELL_TRAP
:
1688 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 15 : 29 )) goto selecttrap
;
1692 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 36 : 72 )) goto selecttrap
;
1696 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 24 : 48 )) goto selecttrap
;
1699 case NOWNSIBLE_TRAP
:
1700 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 45 : 90 )) goto selecttrap
;
1703 case ELM_STREET_TRAP
:
1704 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 13 : 26 )) goto selecttrap
;
1708 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 4 : 8 )) goto selecttrap
;
1711 case RANG_CALL_TRAP
:
1712 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 9 : 18 )) goto selecttrap
;
1715 case RECURRING_SPELL_LOSS_TRAP
:
1716 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 10 : 20 )) goto selecttrap
;
1719 case ANTITRAINING_TRAP
:
1720 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 10 : 20 )) goto selecttrap
;
1724 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 10 : 20 )) goto selecttrap
;
1727 case STAT_DECAY_TRAP
:
1728 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 50 : 100 )) goto selecttrap
;
1732 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& rn2(Role_if(PM_SPACEWARS_FIGHTER
) ? 3 : 6 )) goto selecttrap
;
1735 case SPACEWARS_TRAP
:
1736 if (!Role_if(PM_CAMPERSTRIKER
) && !u
.arabellahack
&& !NastyTrapNation
&& !Role_if(PM_SPACEWARS_FIGHTER
) && rn2(15) ) goto selecttrap
;
1739 case FALLING_LOADSTONE_TRAP
:
1740 if ((rn2(3) && !evilfriday
) && !NastyTrapNation
) goto selecttrap
;
1742 case FALLING_NASTYSTONE_TRAP
:
1743 if (rn2(evilfriday
? 2 : 10) && !NastyTrapNation
) goto selecttrap
;
1745 case EVIL_ARTIFACT_TRAP
:
1746 if (rn2(evilfriday
? 2 : 10) && !NastyTrapNation
) goto selecttrap
;
1749 if (rn2(evilfriday
? 10 : 100) && !NastyTrapNation
) goto selecttrap
;
1753 if (rn2(500) && !NastyTrapNation
) goto selecttrap
;
1755 case SHAPECHANGE_TRAP
:
1756 if (rn2(evilfriday
? 2 : 10) && !NastyTrapNation
) goto selecttrap
;
1758 case INTRINSIC_STEAL_TRAP
:
1759 if (rn2(evilfriday
? 2 : 10) && !NastyTrapNation
) goto selecttrap
;
1761 case CATACLYSM_TRAP
:
1762 if (rn2(evilfriday
? 10 : 100) && !NastyTrapNation
) goto selecttrap
;
1764 case SCORE_AXE_TRAP
:
1765 if (rn2(evilfriday
? 10 : 50) && !NastyTrapNation
) goto selecttrap
;
1767 case KILL_SYMBIOTE_TRAP
:
1768 if (rn2(evilfriday
? 2 : 10) && !NastyTrapNation
) goto selecttrap
;
1770 case FEMINISM_STONE_TRAP
:
1771 if (rn2(evilfriday
? 2 : 10) && !NastyTrapNation
) goto selecttrap
;
1773 case BRANCH_TELEPORTER
:
1774 if (level
.flags
.noteleport
|| Race_if(PM_STABILISATOR
) || Is_knox(&u
.uz
) || Is_blackmarket(&u
.uz
) || Is_aligned_quest(&u
.uz
) || In_endgame(&u
.uz
) || In_sokoban(&u
.uz
) ) goto selecttrap
;
1775 if (rn2(evilfriday
? 2 : 5) && !NastyTrapNation
) goto selecttrap
;
1778 if (level
.flags
.noteleport
|| Race_if(PM_STABILISATOR
) || Is_knox(&u
.uz
) || Is_blackmarket(&u
.uz
) || Is_aligned_quest(&u
.uz
) || In_endgame(&u
.uz
) || In_sokoban(&u
.uz
) ) goto selecttrap
;
1779 if (rn2(evilfriday
? 2 : 12) && !NastyTrapNation
) goto selecttrap
;
1781 case TV_TROPES_TRAP
:
1782 if (rn2(evilfriday
? 2 : 10) && !NastyTrapNation
) goto selecttrap
;
1785 if (rn2(evilfriday
? 10 : 100) && !NastyTrapNation
) goto selecttrap
;
1788 if (rn2(evilfriday
? 10 : 100) && !NastyTrapNation
) goto selecttrap
;
1790 case SKILL_POINT_LOSS_TRAP
:
1791 if (rn2(evilfriday
? 20 : 200) && !NastyTrapNation
) goto selecttrap
;
1793 case DUMBIE_LIGHTSABER_TRAP
:
1794 if (rn2(evilfriday
? 2 : 5) && !NastyTrapNation
) goto selecttrap
;
1796 case SINGLE_UNIDENTIFY_TRAP
:
1797 if (rn2(evilfriday
? 2 : 5) && !NastyTrapNation
) goto selecttrap
;
1800 if (rn2(evilfriday
? 2 : 5) && !NastyTrapNation
) goto selecttrap
;
1802 case AMNESIA_SWITCH_TRAP
:
1803 if (rn2(evilfriday
? 2 : 10) && !NastyTrapNation
) goto selecttrap
;
1805 case HALF_MEMORY_TRAP
:
1806 if (rn2(evilfriday
? 2 : 10) && !NastyTrapNation
) goto selecttrap
;
1808 case HALF_TRAINING_TRAP
:
1809 if (rn2(evilfriday
? 5 : 20) && !NastyTrapNation
) goto selecttrap
;
1811 case MARTIAL_ARTS_TRAP
:
1812 if (rn2(evilfriday
? 5 : 20) && !NastyTrapNation
) goto selecttrap
;
1814 case DATA_DELETE_TRAP
:
1815 if (rn2(evilfriday
? 1000 : 10000)) goto selecttrap
;
1817 case ELDER_TENTACLING_TRAP
:
1818 if (rn2(evilfriday
? 100 : 1000)) goto selecttrap
;
1821 if (rn2(evilfriday
? 10 : 50) && !NastyTrapNation
) goto selecttrap
;
1824 case RECURSION_TRAP
:
1825 if (rn2(500) && !NastyTrapNation
) goto selecttrap
;
1827 case TEMPORARY_RECURSION_TRAP
:
1828 if (rn2(50) && !NastyTrapNation
) goto selecttrap
;
1831 if (rn2(evilfriday
? 10 : 50) && !NastyTrapNation
) goto selecttrap
;
1834 if (rn2(evilfriday
? 10 : 50) && !NastyTrapNation
) goto selecttrap
;
1837 if (rn2(evilfriday
? 10 : 50) && !NastyTrapNation
) goto selecttrap
;
1839 case MIND_WIPE_TRAP
:
1840 if (rn2(evilfriday
? 2 : 10) && !NastyTrapNation
) goto selecttrap
;
1843 if (rn2(evilfriday
? 2 : 10) && !NastyTrapNation
) goto selecttrap
;
1845 case GATEWAY_FROM_HELL
:
1846 if (rn2(evilfriday
? 2 : 20) && !NastyTrapNation
) goto selecttrap
;
1849 case PESTILENCE_TRAP
:
1850 if (rn2(evilfriday
? 5 : 20) && !NastyTrapNation
) goto selecttrap
;
1853 if ((rn2(2) && !evilfriday
) && !NastyTrapNation
) goto selecttrap
;
1856 case ARTIFACT_JACKPOT_TRAP
:
1857 if (rn2(200)) goto selecttrap
;
1859 case SPREADING_TRAP
:
1860 if (rn2(evilfriday
? 2 : 5) && !NastyTrapNation
) goto selecttrap
;
1862 case SUPERTHING_TRAP
:
1863 if (rn2(evilfriday
? 2 : 10) && !NastyTrapNation
) goto selecttrap
;
1865 case LEVITATION_TRAP
:
1866 if (rn2(evilfriday
? 2 : 3) && !NastyTrapNation
) goto selecttrap
;
1868 case GOOD_ARTIFACT_TRAP
:
1869 if (rn2(200)) goto selecttrap
;
1872 if (rn2(5) && !NastyTrapNation
) goto selecttrap
;
1874 case TRAP_OF_OPPOSITE_ALIGNMENT
:
1875 if (rn2(20) && !NastyTrapNation
) goto selecttrap
;
1878 if (rn2(evilfriday
? 5 : 25) && !NastyTrapNation
) goto selecttrap
;
1880 case PIERCING_BEAM_TRAP
:
1881 if (rn2(3) && !NastyTrapNation
) goto selecttrap
;
1883 case BACK_TO_START_TRAP
:
1884 if (rn2(evilfriday
? 2 : 5) && !NastyTrapNation
) goto selecttrap
;
1886 case FALLING_ROCK_COLD
:
1887 if (rn2(evilfriday
? 2 : 5) && !NastyTrapNation
) goto selecttrap
;
1890 if (rn2(evilfriday
? 10 : 50) && !NastyTrapNation
) goto selecttrap
;
1893 if (rn2(evilfriday
? 5 : 30) && !NastyTrapNation
) goto selecttrap
;
1895 case OUTTA_DEPTH_TRAP
:
1896 if (rn2(evilfriday
? 10 : 50) && !NastyTrapNation
) goto selecttrap
;
1898 case ITEM_NASTIFICATION_TRAP
:
1899 if (rn2(evilfriday
? 20 : 200) && !NastyTrapNation
) goto selecttrap
;
1902 if (rn2(evilfriday
? 10 : 50) && !NastyTrapNation
) goto selecttrap
;
1905 if (rn2(200)) goto selecttrap
;
1908 if (In_sokoban(&u
.uz
) && rn2(10)) goto selecttrap
;
1909 if ((rn2(3) && !evilfriday
) && !NastyTrapNation
) goto selecttrap
;
1912 if (In_sokoban(&u
.uz
) && rn2(4)) goto selecttrap
;
1913 if ((rn2(2) && !evilfriday
) && !NastyTrapNation
) goto selecttrap
;
1915 case ARABELLA_SPEAKER
:
1916 if (rn2(10) && !NastyTrapNation
) goto selecttrap
;
1919 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
1921 case MADELEINE_TRAP
:
1922 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
1925 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
1928 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(25) && !NastyTrapNation
) goto selecttrap
;
1931 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
1934 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
1937 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
1940 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
1943 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
1946 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
1949 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
1951 case LISELOTTE_TRAP
:
1952 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
1955 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
1958 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
1961 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
1963 case CHARLOTTE_TRAP
:
1964 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
1967 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
1969 case LITTLE_MARIE_TRAP
:
1970 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(50) && !NastyTrapNation
) goto selecttrap
;
1973 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(20) && !NastyTrapNation
) goto selecttrap
;
1975 case MAGDALENA_TRAP
:
1976 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(10) && !NastyTrapNation
) goto selecttrap
;
1979 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(10) && !NastyTrapNation
) goto selecttrap
;
1982 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
1984 case FRIEDERIKE_TRAP
:
1985 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(25) && !NastyTrapNation
) goto selecttrap
;
1988 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
1991 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(30) && !NastyTrapNation
) goto selecttrap
;
1994 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(10) && !NastyTrapNation
) goto selecttrap
;
1997 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(20) && !NastyTrapNation
) goto selecttrap
;
1999 case MAY_BRITT_TRAP
:
2000 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(10) && !NastyTrapNation
) goto selecttrap
;
2003 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(10) && !NastyTrapNation
) goto selecttrap
;
2006 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2009 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2012 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(20) && !NastyTrapNation
) goto selecttrap
;
2015 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(15) && !NastyTrapNation
) goto selecttrap
;
2018 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(10) && !NastyTrapNation
) goto selecttrap
;
2021 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2024 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2027 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2030 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2033 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2036 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2039 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(20) && !NastyTrapNation
) goto selecttrap
;
2042 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(10) && !NastyTrapNation
) goto selecttrap
;
2045 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2048 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(25) && !NastyTrapNation
) goto selecttrap
;
2051 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(20) && !NastyTrapNation
) goto selecttrap
;
2054 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2057 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(20) && !NastyTrapNation
) goto selecttrap
;
2060 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(10) && !NastyTrapNation
) goto selecttrap
;
2063 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(10) && !NastyTrapNation
) goto selecttrap
;
2066 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2068 case HENRIETTA_TRAP
:
2069 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(20) && !NastyTrapNation
) goto selecttrap
;
2072 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2075 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(25) && !NastyTrapNation
) goto selecttrap
;
2078 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2081 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2084 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2087 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2089 case ANASTASIA_TRAP
:
2090 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2092 case ANNEMARIE_TRAP
:
2093 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2096 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2099 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2102 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2105 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(20) && !NastyTrapNation
) goto selecttrap
;
2108 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(10) && !NastyTrapNation
) goto selecttrap
;
2111 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(10) && !NastyTrapNation
) goto selecttrap
;
2114 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(15) && !NastyTrapNation
) goto selecttrap
;
2117 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2120 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2123 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2126 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2129 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2132 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(10) && !NastyTrapNation
) goto selecttrap
;
2135 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(20) && !NastyTrapNation
) goto selecttrap
;
2138 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2141 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2144 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(25) && !NastyTrapNation
) goto selecttrap
;
2147 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2149 case BRIDGHITTE_TRAP
:
2150 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2153 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(20) && !NastyTrapNation
) goto selecttrap
;
2156 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2159 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(20) && !NastyTrapNation
) goto selecttrap
;
2161 case TOXIC_VENOM_TRAP
:
2162 if (rn2(evilfriday
? 2 : 7) && !NastyTrapNation
) goto selecttrap
;
2165 if (rn2(evilfriday
? 10 : 100) && !NastyTrapNation
) goto selecttrap
;
2168 if (rn2(evilfriday
? 2 : 5) && !NastyTrapNation
) goto selecttrap
;
2171 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(10) && !NastyTrapNation
) goto selecttrap
;
2174 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(10) && !NastyTrapNation
) goto selecttrap
;
2177 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2179 case KATHARINA_TRAP
:
2180 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(10) && !NastyTrapNation
) goto selecttrap
;
2183 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(10) && !NastyTrapNation
) goto selecttrap
;
2186 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(10) && !NastyTrapNation
) goto selecttrap
;
2189 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(10) && !NastyTrapNation
) goto selecttrap
;
2192 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(20) && !NastyTrapNation
) goto selecttrap
;
2195 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(15) && !NastyTrapNation
) goto selecttrap
;
2198 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(50) && !NastyTrapNation
) goto selecttrap
;
2201 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2204 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2207 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(10) && !NastyTrapNation
) goto selecttrap
;
2210 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2213 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2216 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2219 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2222 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2225 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2228 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(10) && !NastyTrapNation
) goto selecttrap
;
2231 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(5) && !NastyTrapNation
) goto selecttrap
;
2234 if (!Role_if(PM_FEMINIST
) && !Role_if(PM_EMERA
) && !FemtrapActiveJette
&& rn2(10) && !NastyTrapNation
) goto selecttrap
;
2237 case PREMATURE_DEATH_TRAP
:
2238 if (rn2(evilfriday
? 10 : 200) && !NastyTrapNation
) goto selecttrap
;
2241 if (rn2(evilfriday
? 64 : 640) && !NastyTrapNation
) goto selecttrap
;
2243 case SEVERE_DISENCHANT_TRAP
:
2244 if (rn2(evilfriday
? 2 : 5) && !NastyTrapNation
) goto selecttrap
;
2248 if (rn2(evilfriday
? 10 : 50) && !NastyTrapNation
) goto selecttrap
;
2250 case DESTROY_ARMOR_TRAP
:
2251 if (rn2(evilfriday
? 2 : 15) && !NastyTrapNation
) goto selecttrap
;
2253 case DIVINE_ANGER_TRAP
:
2254 if (rn2(evilfriday
? 5 : 40) && !NastyTrapNation
) goto selecttrap
;
2257 if (rn2(evilfriday
? 2 : 10) && !NastyTrapNation
) goto selecttrap
;
2259 case MISSINGNO_TRAP
:
2260 if (rn2(evilfriday
? 10 : 50) && !NastyTrapNation
) goto selecttrap
;
2262 case CANCELLATION_TRAP
:
2263 if (rn2(evilfriday
? 5 : 25) && !NastyTrapNation
) goto selecttrap
;
2266 if (rn2(evilfriday
? 5 : 20) && !NastyTrapNation
) goto selecttrap
;
2268 case HOSTILITY_TRAP
:
2269 if (rn2(evilfriday
? 2 : 4) && !NastyTrapNation
) goto selecttrap
;
2272 if (rn2(evilfriday
? 2 : 16) && !NastyTrapNation
) goto selecttrap
;
2275 if (rn2(500)) goto selecttrap
;
2277 case GUILLOTINE_TRAP
:
2278 if (rn2(evilfriday
? 10 : 200) && !NastyTrapNation
) goto selecttrap
;
2281 if (rn2(evilfriday
? 2 : 5) && !NastyTrapNation
) goto selecttrap
;
2283 case VULNERATE_TRAP
:
2284 if (rn2(evilfriday
? 2 : 3) && !NastyTrapNation
) goto selecttrap
;
2286 case CHLOROFORM_TRAP
:
2287 if (rn2(evilfriday
? 2 : 4) && !NastyTrapNation
) goto selecttrap
;
2289 case BISECTION_TRAP
:
2290 if (rn2(evilfriday
? 10 : 200) && !NastyTrapNation
) goto selecttrap
;
2293 if (rn2(evilfriday
? 2 : 10) && !NastyTrapNation
) goto selecttrap
;
2295 case IMMOBILITY_TRAP
:
2296 if (rn2(evilfriday
? 2 : 15) && !NastyTrapNation
) goto selecttrap
;
2299 if (rn2(evilfriday
? 2 : 5) && !NastyTrapNation
) goto selecttrap
;
2302 if (rn2(evilfriday
? 4 : 10) && !NastyTrapNation
) goto selecttrap
;
2305 if (rn2(evilfriday
? 3 : 7) && !NastyTrapNation
) goto selecttrap
;
2308 if (rn2(evilfriday
? 5 : 20) && !NastyTrapNation
) goto selecttrap
;
2311 if (rn2(evilfriday
? 6 : 35) && !NastyTrapNation
) goto selecttrap
;
2314 if (rn2(evilfriday
? 7 : 49) && !NastyTrapNation
) goto selecttrap
;
2318 } while (rtrap
== NO_TRAP
);
2323 * Create a trap on some random empty location --Amy
2327 makerandomtrap(givehp
)
2335 boolean canbeinawall
= FALSE
;
2336 if (!rn2(Passes_walls
? 5 : 25)) canbeinawall
= TRUE
;
2338 for (tryct
= 0; tryct
< 2000; tryct
++) {
2342 if (isok(x
, y
) && ((levl
[x
][y
].typ
> DBWALL
) || canbeinawall
) && !(t_at(x
, y
)) ) {
2343 (void) maketrap(x
, y
, rtrap
, 100, givehp
);
2350 /* make an invisible trap on some random empty location --Amy */
2359 register struct trap
*ttmp
;
2360 boolean canbeinawall
= FALSE
;
2361 if (!rn2(Passes_walls
? 5 : 25)) canbeinawall
= TRUE
;
2363 for (tryct
= 0; tryct
< 2000; tryct
++) {
2367 if (isok(x
, y
) && ((levl
[x
][y
].typ
> DBWALL
) || canbeinawall
) && !(t_at(x
, y
)) ) {
2368 ttmp
= maketrap(x
, y
, rtrap
, 100, FALSE
);
2369 if (ttmp
) ttmp
->hiddentrap
= TRUE
;
2377 * Create either a fart trap or heel trap on some random empty location, for scroll of girliness --Amy
2385 rtrap
= rn2(2) ? FART_TRAP
: HEEL_TRAP
;
2388 boolean canbeinawall
= FALSE
;
2389 if (!rn2(Passes_walls
? 5 : 25)) canbeinawall
= TRUE
;
2391 for (tryct
= 0; tryct
< 2000; tryct
++) {
2395 if (isok(x
, y
) && ((levl
[x
][y
].typ
> DBWALL
) || canbeinawall
) && !(t_at(x
, y
)) ) {
2396 (void) maketrap(x
, y
, rtrap
, 0, TRUE
);
2408 rtrap
= randominsidetrap();
2411 boolean canbeinawall
= FALSE
;
2412 if (!rn2(Passes_walls
? 5 : 25)) canbeinawall
= TRUE
;
2414 for (tryct
= 0; tryct
< 2000; tryct
++) {
2418 if (isok(x
, y
) && ((levl
[x
][y
].typ
> DBWALL
) || canbeinawall
) && !(t_at(x
, y
)) ) {
2419 (void) maketrap(x
, y
, rtrap
, 0, FALSE
);
2427 * Coordinates in special level files are handled specially:
2429 * if x or y is -11, we generate a random coordinate.
2430 * if x or y is between -1 and -10, we read one from the corresponding
2431 * register (x0, x1, ... x9).
2432 * if x or y is nonnegative, we convert it from relative to the local map
2433 * to global coordinates.
2434 * The "humidity" flag is used to insure that engravings aren't
2435 * created underwater, or eels on dry land.
2441 STATIC_DCL boolean
is_ok_location(SCHAR_P
, SCHAR_P
, int);
2444 get_location(x
, y
, humidity
)
2450 if (*x
>= 0) { /* normal locations */
2453 } else if (*x
> -11) { /* special locations */
2454 char ry
= rloc_y
[ - *x
- 1][ - *y
- 1];
2455 char rx
= rloc_x
[ - *x
- 1][ - *y
- 1];
2456 if (ry
== (char)-1 || rx
== (char)-1)
2457 return FALSE
; /* nowhere */
2462 } else if (*x
> -12) { /* within random region */
2466 *x
= rn2(rarea
[t
].inarea
.x2
- rarea
[t
].inarea
.x1
+ 1) +
2468 *y
= rn2(rarea
[t
].inarea
.y2
- rarea
[t
].inarea
.y1
+ 1) +
2470 if (!rarea
[t
].in_islev
) {
2474 if (is_ok_location(*x
,*y
,humidity
)) {
2475 int x1
= rarea
[t
].delarea
.x1
;
2476 int x2
= rarea
[t
].delarea
.x2
;
2477 int y1
= rarea
[t
].delarea
.y1
;
2478 int y2
= rarea
[t
].delarea
.y2
;
2479 if (!rarea
[t
].del_islev
) {
2485 if (!within_bounded_area(*x
,*y
,x1
,y1
,x2
,y2
)) break;
2487 } while (++cpt
< 100);
2489 register int xx
, yy
;
2490 for (xx
= rarea
[t
].inarea
.x1
; xx
< rarea
[t
].inarea
.x2
; xx
++)
2491 for (yy
= rarea
[t
].inarea
.y1
; yy
< rarea
[t
].inarea
.y2
; yy
++) {
2494 if (!rarea
[t
].in_islev
) {
2498 if (is_ok_location(*x
,*y
,humidity
)) {
2499 int x1
= rarea
[t
].delarea
.x1
;
2500 int x2
= rarea
[t
].delarea
.x2
;
2501 int y1
= rarea
[t
].delarea
.y1
;
2502 int y2
= rarea
[t
].delarea
.y2
;
2503 if (!rarea
[t
].del_islev
) {
2509 if (!within_bounded_area(*x
,*y
,x1
,y1
,x2
,y2
))
2513 panic("get_location: can't find a place!");
2515 } else { /* random location */
2517 *x
= xstart
+ rn2((int)xsize
);
2518 *y
= ystart
+ rn2((int)ysize
);
2519 if (is_ok_location(*x
,*y
,humidity
)) break;
2520 } while (++cpt
< 100);
2522 register int xx
, yy
;
2524 for (xx
= 0; xx
< xsize
; xx
++)
2525 for (yy
= 0; yy
< ysize
; yy
++) {
2528 if (is_ok_location(*x
,*y
,humidity
)) goto found_it
;
2530 panic("get_location: can't find a place!");
2536 impossible("get_location: (%d,%d) out of bounds", *x
, *y
);
2537 *x
= x_maze_max
; *y
= y_maze_max
;
2543 is_ok_location(x
, y
, humidity
)
2544 register schar x
, y
;
2545 register int humidity
;
2549 if (Is_waterlevel(&u
.uz
)) return TRUE
; /* accept any spot */
2551 if (humidity
& DRY
) {
2552 typ
= levl
[x
][y
].typ
;
2553 if (typ
== ROOM
|| typ
== AIR
||
2554 typ
== CLOUD
|| typ
== ICE
|| typ
== CORR
2555 || typ
== SNOW
|| typ
== ASH
|| typ
== SAND
|| typ
== PAVEDFLOOR
|| typ
== HIGHWAY
2556 || typ
== GRASSLAND
|| typ
== NETHERMIST
|| typ
== STALACTITE
|| typ
== CRYPTFLOOR
2557 || typ
== BUBBLES
|| typ
== RAINCLOUD
)
2560 if (humidity
& WET
) {
2561 if (is_waterypool(x
,y
))
2564 if (humidity
& MOLTEN
) {
2572 * Shuffle the registers for locations, objects or monsters
2576 sp_lev_shuffle(list1
, list2
, n
)
2577 char list1
[], list2
[];
2583 for (i
= n
- 1; i
> 0; i
--) {
2584 if ((j
= rn2(i
+ 1)) == i
) continue;
2586 list1
[j
] = list1
[i
];
2590 list2
[j
] = list2
[i
];
2597 * Get a relative position inside a room.
2598 * negative values for x or y means RANDOM!
2602 get_room_loc(x
,y
, croom
)
2604 struct mkroom
*croom
;
2608 if (*x
<0 && *y
<0) {
2609 if (somexy(croom
, &c
)) {
2613 panic("get_room_loc : can't find a place!");
2616 *x
= rn2(croom
->hx
- croom
->lx
+ 1);
2618 *y
= rn2(croom
->hy
- croom
->ly
+ 1);
2625 * Get a relative position inside a room.
2626 * negative values for x or y means RANDOM!
2630 get_free_room_loc(x
,y
, croom
)
2632 struct mkroom
*croom
;
2635 register int trycnt
= 0;
2638 try_x
= *x
, try_y
= *y
;
2639 get_room_loc(&try_x
, &try_y
, croom
);
2640 } while (levl
[try_x
][try_y
].typ
!= ROOM
&& ++trycnt
<= 100);
2643 panic("get_free_room_loc: can't find a place!");
2644 *x
= try_x
, *y
= try_y
;
2648 check_room(lowx
, ddx
, lowy
, ddy
, vault
, anywhere
)
2649 xchar
*lowx
, *ddx
, *lowy
, *ddy
;
2653 register int x
,y
,hix
= *lowx
+ *ddx
, hiy
= *lowy
+ *ddy
;
2654 register struct rm
*lev
;
2655 int xlim
, ylim
, ymax
;
2657 xlim
= XLIM
+ (vault
? 1 : 0);
2658 ylim
= YLIM
+ (vault
? 1 : 0);
2660 /* Allow rooms to be closer together. For warper race characters this will be the case even more often. --Amy */
2664 xlim
= xlim
- rnd(10);
2665 ylim
= ylim
- rnd(10);
2669 /* After all, a warped dungeon is what we'd expect from a character called warper... */
2671 if (*lowx
< 3) *lowx
= 3;
2672 if (*lowy
< 2) *lowy
= 2;
2673 if (hix
> COLNO
-3) hix
= COLNO
-3;
2674 if (hiy
> ROWNO
-3) hiy
= ROWNO
-3;
2676 if (hix
<= *lowx
|| hiy
<= *lowy
) return FALSE
;
2678 /* check area around room (and make room smaller if necessary) */
2679 for (x
= *lowx
- xlim
; x
<= hix
+ xlim
; x
++) {
2680 if(x
<= 0 || x
>= COLNO
) continue;
2681 y
= *lowy
- ylim
; ymax
= hiy
+ ylim
;
2683 if(ymax
>= ROWNO
) ymax
= (ROWNO
-1);
2685 for (; y
<= ymax
; y
++) {
2686 if (lev
++->typ
&& !anywhere
) {
2689 debugpline("strange area [%d,%d] in check_room.",x
,y
);
2691 if (!rn2(3)) return FALSE
;
2693 *lowx
= x
+ xlim
+ 1;
2697 *lowy
= y
+ ylim
+ 1;
2710 * Create a new room.
2711 * This is still very incomplete...
2715 create_room(x
,y
,w
,h
,xal
,yal
,rtype
,rlit
, canbeshaped
, anywhere
)
2720 boolean canbeshaped
;
2724 * numeric args that are -1 mean random
2725 * x and y are position within the rectangle grid for the level
2726 * I *think* these values range from 1 to 5.
2727 * w and h are size (width and height)
2728 * xal and yal are alignment (LEFT/TOP, CENTER, RIGHT/BOTTOM).
2729 * footmp is the current working value of foo; this is typically
2730 * equal to foo, unless foo is -1 (random).
2731 * xabs and yabs are the actual x and y coordinates where the
2732 * room will be placed on the level map.
2735 int wtmp
, htmp
, xaltmp
, yaltmp
, xtmp
, ytmp
;
2738 boolean vault
= FALSE
;
2739 int xlim
= XLIM
, ylim
= YLIM
;
2741 /*if (anywhere) pline("anywhere!");*/
2745 xlim
= xlim
- rnd(10);
2746 ylim
= ylim
- rnd(10);
2750 if (rtype
== -1) /* Is the type random ? */
2753 if (rtype
== VAULT
) {
2755 canbeshaped
= FALSE
;
2760 /* on low levels the room is lit (usually) */
2761 /* some other rooms may require lighting */
2763 /* is light state random ? */
2765 rlit
= (rnd(1+abs(depth(&u
.uz
))) < 25 && rn2(77)) ? TRUE
: FALSE
;
2768 * Here we will try to create a room. If some parameters are
2769 * random we are willing to make several try before we give
2773 xchar xborder
, yborder
;
2776 xaltmp
= xal
; yaltmp
= yal
;
2778 /* First case : a totaly random room */
2780 if((xtmp
< 0 && ytmp
<0 && wtmp
< 0 && xaltmp
< 0 &&
2781 yaltmp
< 0) || vault
) {
2782 xchar hx
, hy
, lx
, ly
, dx
, dy
;
2783 r1
= rnd_rect(); /* Get a random rectangle */
2785 if (!r1
) { /* No more free rectangles ! */
2787 debugpline("No more rects...");
2799 dx
= 2 + rn2((hx
-lx
> 28) ? 20 : 12);
2802 if (!rn2(500) && trycnt
< 200) dx
+= rnd(160);
2803 if (!rn2(500) && trycnt
< 200) dy
+= rnd(48);
2805 if (!rn2(50) && trycnt
< 200) dx
+= rnd(80);
2806 if (!rn2(50) && trycnt
< 200) dy
+= rnd(24);
2808 if (!rn2(5) && trycnt
< 200) dx
+= rnd(30);
2809 if (!rn2(5) && trycnt
< 200) dy
+= rnd(10);
2811 dx
= 2 + rn2((hx
-lx
> 28) ? 12 : 8);
2814 if (!rn2(1000) && trycnt
< 200) dx
+= rnd(80);
2815 if (!rn2(1000) && trycnt
< 200) dy
+= rnd(24);
2817 if (!rn2(100) && trycnt
< 200) dx
+= rnd(40);
2818 if (!rn2(100) && trycnt
< 200) dy
+= rnd(12);
2820 if (!rn2(10) && trycnt
< 200) dx
+= rnd(20);
2821 if (!rn2(10) && trycnt
< 200) dy
+= rnd(6);
2828 /*if (wizard && trycnt == 500) pline("try count 500 a");*/
2830 if ((trycnt
> 500) && (dx
> 10)) dx
= 10;
2831 if ((trycnt
> 1000) && (dx
> 6)) dx
= 6;
2832 if ((trycnt
> 2000) && (dx
> 4)) dx
= 4;
2833 if ((trycnt
> 3000) && (dx
> 2)) dx
= 2;
2834 if ((trycnt
> 500) && (dy
> 6)) dy
= 6;
2835 if ((trycnt
> 1000) && (dy
> 4)) dy
= 4;
2836 if ((trycnt
> 2000) && (dy
> 3)) dy
= 3;
2837 if ((trycnt
> 3000) && (dy
> 2)) dy
= 2;
2839 xborder
= (lx
> 0 && hx
< COLNO
-1) ? 2*xlim
: xlim
+1;
2840 yborder
= (ly
> 0 && hy
< ROWNO
-1) ? 2*ylim
: ylim
+1;
2841 if(hx
-lx
< dx
+ 3 + xborder
||
2842 hy
-ly
< dy
+ 3 + yborder
) {
2846 xabs
= lx
+ (lx
> 0 ? xlim
: 3)
2847 + rn2(hx
- (lx
>0?lx
: 3) - dx
- xborder
+ 1);
2848 yabs
= ly
+ (ly
> 0 ? ylim
: 2)
2849 + rn2(hy
- (ly
>0?ly
: 2) - dy
- yborder
+ 1);
2850 if (ly
== 0 && hy
>= (ROWNO
-1) &&
2851 (!nroom
|| !rn2(nroom
)) && (yabs
+dy
> ROWNO
/2)) {
2853 if(nroom
< 4 && dy
>1) dy
--;
2855 if (!check_room(&xabs
, &dx
, &yabs
, &dy
, vault
, anywhere
)) {
2861 r2
.lx
= xabs
-1; r2
.ly
= yabs
-1;
2862 r2
.hx
= xabs
+ wtmp
;
2863 r2
.hy
= yabs
+ htmp
;
2864 } else { /* Only some parameters are random */
2866 if (xtmp
< 0 && ytmp
< 0) { /* Position is RANDOM */
2871 if (wtmp
< 0 || htmp
< 0) { /* Size is RANDOM */
2875 if (!rn2(1000) && trycnt
< 200) wtmp
+= rnd(80);
2876 if (!rn2(1000) && trycnt
< 200) htmp
+= rnd(24);
2878 if (!rn2(100) && trycnt
< 200) wtmp
+= rnd(40);
2879 if (!rn2(100) && trycnt
< 200) htmp
+= rnd(12);
2881 if (!rn2(10) && trycnt
< 200) wtmp
+= rnd(20);
2882 if (!rn2(10) && trycnt
< 200) htmp
+= rnd(6);
2886 /*if (wizard && trycnt == 501) pline("try count 500 b");*/
2888 if (trycnt
> 500 && wtmp
> 10) wtmp
= 10;
2889 if (trycnt
> 1000 && wtmp
> 6) wtmp
= 6;
2890 if (trycnt
> 2000 && wtmp
> 4) wtmp
= 4;
2891 if (trycnt
> 3000 && wtmp
> 2) wtmp
= 2;
2892 if (trycnt
> 500 && htmp
> 6) htmp
= 6;
2893 if (trycnt
> 1000 && htmp
> 4) htmp
= 4;
2894 if (trycnt
> 2000 && htmp
> 3) htmp
= 3;
2895 if (trycnt
> 3000 && htmp
> 2) htmp
= 2;
2897 if (xaltmp
== -1) /* Horizontal alignment is RANDOM */
2899 if (yaltmp
== -1) /* Vertical alignment is RANDOM */
2902 /* Try to generate real (absolute) coordinates here! */
2904 xabs
= (((xtmp
-1) * COLNO
) / 5) + 1;
2905 yabs
= (((ytmp
-1) * ROWNO
) / 5) + 1;
2910 xabs
+= (COLNO
/ 5) - wtmp
;
2913 xabs
+= ((COLNO
/ 5) - wtmp
) / 2;
2920 yabs
+= (ROWNO
/ 5) - htmp
;
2923 yabs
+= ((ROWNO
/ 5) - htmp
) / 2;
2927 if (xabs
+ wtmp
- 1 > COLNO
- 2)
2928 xabs
= COLNO
- wtmp
- 3;
2931 if (yabs
+ htmp
- 1> ROWNO
- 2)
2932 yabs
= ROWNO
- htmp
- 3;
2936 /* Try to find a rectangle that fit our room ! */
2938 r2
.lx
= xabs
-1; r2
.ly
= yabs
-1;
2939 r2
.hx
= xabs
+ wtmp
+ rndpos
;
2940 r2
.hy
= yabs
+ htmp
+ rndpos
;
2944 } while (++trycnt
<= 5000 && !r1
);
2945 if (!r1
) { /* creation of room failed ? */
2948 split_rects(r1
, &r2
);
2951 smeq
[nroom
] = nroom
;
2952 add_room(xabs
, yabs
, xabs
+wtmp
-1, yabs
+htmp
-1,
2953 rlit
, rtype
, FALSE
, TRUE
, FALSE
);
2955 rooms
[nroom
].lx
= xabs
;
2956 rooms
[nroom
].ly
= yabs
;
2962 * Create a subroom in room proom at pos x,y with width w & height h.
2963 * x & y are relative to the parent room.
2967 create_subroom(proom
, x
, y
, w
, h
, rtype
, rlit
)
2968 struct mkroom
*proom
;
2973 xchar width
, height
;
2975 width
= proom
->hx
- proom
->lx
+ 1;
2976 height
= proom
->hy
- proom
->ly
+ 1;
2978 /* There is a minimum size for the parent room */
2979 if (width
< 4 || height
< 4)
2982 /* Check for random position, size, etc... */
2987 h
= rnd(height
- 3);
2989 x
= rnd(width
- w
- 1) - 1;
2991 y
= rnd(height
- h
- 1) - 1;
2996 if ((x
+ w
+ 1) == width
)
2998 if ((y
+ h
+ 1) == height
)
3003 rlit
= (rnd(1+abs(depth(&u
.uz
))) < 11 && rn2(77)) ? TRUE
: FALSE
;
3004 add_subroom(proom
, proom
->lx
+ x
, proom
->ly
+ y
,
3005 proom
->lx
+ x
+ w
- 1, proom
->ly
+ y
+ h
- 1,
3006 rlit
, rtype
, FALSE
);
3011 * Create a new door in a room.
3012 * It's placed on a wall (north, south, east or west).
3016 create_door(dd
, broom
)
3018 struct mkroom
*broom
;
3024 if (dd
->secret
== -1)
3025 dd
->secret
= rn2(2);
3027 if (dd
->mask
== -1) {
3028 /* is it a locked door, closed, or a doorway? */
3032 dd
->mask
= D_ISOPEN
;
3034 dd
->mask
= D_LOCKED
;
3036 dd
->mask
= D_CLOSED
;
3037 if (dd
->mask
!= D_ISOPEN
&& !rn2(25))
3038 dd
->mask
|= D_TRAPPED
;
3040 dd
->mask
= D_NODOOR
;
3042 if(!rn2(5)) dd
->mask
= D_LOCKED
;
3043 else dd
->mask
= D_CLOSED
;
3045 if(!rn2(20)) dd
->mask
|= D_TRAPPED
;
3050 register int dwall
, dpos
;
3053 if (dwall
== -1) /* The wall is RANDOM */
3054 dwall
= 1 << rn2(4);
3057 if (dpos
== -1) /* The position is RANDOM */
3058 dpos
= rn2((dwall
== W_WEST
|| dwall
== W_EAST
) ?
3059 (broom
->hy
- broom
->ly
) : (broom
->hx
- broom
->lx
));
3061 /* Convert wall and pos into an absolute coordinate! */
3066 x
= broom
->lx
+ dpos
;
3070 x
= broom
->lx
+ dpos
;
3074 y
= broom
->ly
+ dpos
;
3078 y
= broom
->ly
+ dpos
;
3082 panic("create_door: No wall for door!");
3087 } while (++trycnt
<= 100);
3089 if (wizard
) pline("create_door: Can't find a proper place!");
3092 i
= add_door(x
,y
,broom
);
3093 doors
[i
].arti_key
= dd
->arti_key
;
3094 levl
[x
][y
].typ
= (dd
->secret
? SDOOR
: DOOR
);
3095 levl
[x
][y
].doormask
= dd
->mask
;
3099 * Create a secret door in croom on any one of the specified walls.
3102 create_secret_door(croom
, walls
)
3103 struct mkroom
*croom
;
3104 xchar walls
; /* any of W_NORTH | W_SOUTH | W_EAST | W_WEST (or W_ANY) */
3106 xchar sx
, sy
; /* location of the secret door */
3109 for(count
= 0; count
< 100; count
++) {
3110 sx
= rn1(croom
->hx
- croom
->lx
+ 1, croom
->lx
);
3111 sy
= rn1(croom
->hy
- croom
->ly
+ 1, croom
->ly
);
3115 if(!(walls
& W_NORTH
)) continue;
3116 sy
= croom
->ly
-1; break;
3117 case 1: /* bottom */
3118 if(!(walls
& W_SOUTH
)) continue;
3119 sy
= croom
->hy
+1; break;
3121 if(!(walls
& W_EAST
)) continue;
3122 sx
= croom
->lx
-1; break;
3124 if(!(walls
& W_WEST
)) continue;
3125 sx
= croom
->hx
+1; break;
3129 levl
[sx
][sy
].typ
= SDOOR
;
3130 levl
[sx
][sy
].doormask
= D_CLOSED
;
3131 add_door(sx
,sy
,croom
);
3138 levl
[sx
][sy
].typ
= SDOOR
;
3139 levl
[sx
][sy
].doormask
= D_CLOSED
;
3140 add_door(sx
,sy
,croom
);
3142 /* impossible("couldn't create secret door on any walls 0x%x", walls); */
3146 * Create a trap in a room.
3150 create_trap(t
,croom
)
3152 struct mkroom
*croom
;
3157 if (rn2(100) < t
->chance
) {
3161 get_free_room_loc(&x
, &y
, croom
);
3163 if (!get_location(&x
, &y
, DRY
))
3169 mktrap(t
->type
, 1, (struct mkroom
*) 0, &tm
, TRUE
);
3170 /*pline("traptest %d", t->type);*/
3175 * Create a monster in a room.
3179 noncoalignment(alignment
)
3187 return(k
? -alignment
: 0);
3191 create_monster(m
,croom
)
3193 struct mkroom
*croom
;
3200 struct permonst
*pm
;
3203 if (rn2(100) < m
->chance
) {
3205 /* ugly hack for monster symbols with ascii chars greater than 127 --Amy */
3207 if (m
->class == -79) m
->class = 177;
3208 if (m
->class == -80) m
->class = 176;
3209 if (m
->class == -81) m
->class = 175;
3210 if (m
->class == -89) m
->class = 167;
3213 class = (char) def_char_to_monclass((char)m
->class);
3214 else if (m
->class > -11)
3215 class = (char) def_char_to_monclass(rmonst
[- m
->class - 1]);
3219 if (class == MAXMCLASSES
)
3220 panic("create_monster: unknown monster class '%c'", m
->class);
3222 amask
= (m
->align
== AM_SPLEV_CO
) ?
3223 Align2amask(u
.ualignbase
[A_ORIGINAL
]) :
3224 (m
->align
== AM_SPLEV_NONCO
) ?
3225 Align2amask(noncoalignment(u
.ualignbase
[A_ORIGINAL
])) :
3226 (m
->align
<= -11) ? induced_align(80) :
3227 (m
->align
< 0 ? ralign
[-m
->align
-1] : m
->align
);
3230 pm
= (struct permonst
*) 0;
3231 else if (m
->id
!= NON_PM
) {
3232 #if 0 /* OBSOLETE */
3233 if (flags
.female
&& Role_if(PM_ELF
) /*&& !u.uelf_drow*/ && m
->id
== PM_EARENDIL
)
3237 if (flags
.female
&& Role_if(PM_ELPH
) && m
->id
== PM_EARENDIL
) /* elf role re-enabled by Amy */
3240 /* in the Gnome Mines, make the gnomes & dwarves into
3241 orcs, ogres, & zombies (because gnomes & dwarves are friendly...
3242 the mines would be hella easy otherwise) */
3243 if (In_mines(&u
.uz
) && (
3244 Race_if(PM_DWARF
) ||
3245 Race_if(PM_GNOME
))) {
3247 case PM_GNOME
: m
->id
= PM_GNOME_ZOMBIE
; break;
3248 case PM_GNOMISH_WIZARD
: m
->id
= PM_ORC_SHAMAN
; break;
3249 case PM_GNOME_LORD
: m
->id
= PM_GNOME_MUMMY
; break;
3250 case PM_GNOME_KING
: m
->id
= PM_OGRE
; break;
3251 case PM_DWARF
: m
->id
= PM_DWARF_ZOMBIE
; break;
3252 case PM_DWARF_LORD
: m
->id
= PM_DWARF_MUMMY
; break;
3253 case PM_DWARF_KING
: m
->id
= PM_WAR_ORC
; break;
3257 g_mvflags
= (unsigned) mvitals
[monsndx(pm
)].mvflags
;
3258 if ((pm
->geno
& G_UNIQ
) && (g_mvflags
& G_EXTINCT
))
3260 else if (g_mvflags
& G_GONE
) /* genocided or extinct */
3261 pm
= (struct permonst
*) 0; /* make random monster */
3263 pm
= mkclass(class,MKC_ULIMIT
);
3264 /* if we can't get a specific monster type (pm == 0) then all
3265 the monsters of acceptable difficulty in the given class
3266 have been genocided, so settle for a random monster */
3267 /* Amy edit: what the fuck man why did this allow G_NOGEN monsters to spawn */
3272 get_room_loc(&x
, &y
, croom
);
3275 if (!pm
|| !is_swimmer(pm
) && !likes_lava(pm
))
3276 found
= get_location(&x
, &y
, DRY
);
3277 else if (pm
->mlet
== S_EEL
)
3278 found
= get_location(&x
, &y
, DRY
|WET
);
3279 else if (likes_lava(pm
))
3280 found
= get_location(&x
, &y
, DRY
|MOLTEN
);
3282 found
= get_location(&x
, &y
, DRY
|WET
);
3284 goto m_done
; /* nowhere */
3286 /* try to find a close place if someone else is already there */
3287 if (MON_AT(x
,y
) && enexto(&cc
, x
, y
, pm
))
3291 mtmp
= mk_roamer(pm
, Amask2align(amask
), x
, y
, m
->peaceful
);
3292 else if(PM_ARCHEOLOGIST
<= m
->id
&& m
->id
<= PM_WIZARD
)
3293 mtmp
= mk_mplayer(pm
, x
, y
, FALSE
);
3294 else mtmp
= makemon(pm
, x
, y
, NO_MM_FLAGS
);
3297 /* handle specific attributes for some special monsters */
3298 if (m
->name
.str
) mtmp
= christen_monst(mtmp
, m
->name
.str
);
3301 * This is currently hardwired for mimics only. It should
3302 * eventually be expanded.
3304 if (m
->appear_as
.str
&& mtmp
->data
->mlet
== S_MIMIC
) {
3307 switch (m
->appear
) {
3310 "create_monster: mon has an appearance, \"%s\", but no type",
3314 case M_AP_FURNITURE
:
3315 for (i
= 0; i
< MAXPCHARS
; i
++)
3316 if (!strcmp(defsyms
[i
].explanation
,
3319 if (i
== MAXPCHARS
) {
3321 "create_monster: can't find feature \"%s\"",
3324 mtmp
->m_ap_type
= M_AP_FURNITURE
;
3325 mtmp
->mappearance
= i
;
3330 for (i
= 0; i
< NUM_OBJECTS
; i
++)
3331 if (OBJ_NAME(objects
[i
]) &&
3332 !strcmp(OBJ_NAME(objects
[i
]),m
->appear_as
.str
))
3334 if (i
== NUM_OBJECTS
) {
3336 "create_monster: can't find object \"%s\"",
3339 mtmp
->m_ap_type
= M_AP_OBJECT
;
3340 mtmp
->mappearance
= i
;
3345 /* note: mimics don't appear as monsters! */
3346 /* (but chameleons can :-) */
3349 "create_monster: unimplemented mon appear type [%d,\"%s\"]",
3350 m
->appear
, m
->appear_as
.str
);
3353 if (does_block(x
, y
, &levl
[x
][y
]))
3357 if (m
->peaceful
>= 0) {
3358 mtmp
->mpeaceful
= m
->peaceful
;
3359 /* changed mpeaceful again; have to reset malign */
3362 if (m
->asleep
>= 0) {
3364 /* optimizer bug strikes again */
3366 mtmp
->msleeping
= 1;
3368 mtmp
->msleeping
= 0;
3370 mtmp
->msleeping
= m
->asleep
;
3375 } /* if (rn2(100) < m->chance) */
3378 free(m
->appear_as
.str
);
3382 * Create an object in a room.
3386 create_object(o
,croom
)
3388 struct mkroom
*croom
;
3393 boolean named
; /* has a name been supplied in level description? */
3395 if (rn2(100) < o
->chance
) {
3396 named
= o
->name
.str
? TRUE
: FALSE
;
3400 get_room_loc(&x
, &y
, croom
);
3402 if (!get_location(&x
, &y
, DRY
)) /* nowhere */
3407 else if (o
->class > -11)
3408 c
= robjects
[ -(o
->class+1)];
3413 otmp
= mkobj_at(RANDOM_CLASS
, x
, y
, !named
, FALSE
);
3414 else if (o
->id
!= -1)
3415 otmp
= mksobj_at(o
->id
, x
, y
, TRUE
, !named
, FALSE
);
3418 * The special levels are compiled with the default "text" object
3419 * class characters. We must convert them to the internal format.
3421 char oclass
= (char) def_char_to_objclass(c
);
3423 if (oclass
== MAXOCLASSES
)
3424 panic("create_object: unexpected object class '%c'",c
);
3426 /* KMH -- Create piles of gold properly */
3427 /* Bruce Cox/WAC - some clean ups */
3428 if (oclass
== COIN_CLASS
&& !o
->containment
) {
3432 otmp
= mkobj_at(oclass
, x
, y
, !named
, FALSE
);
3437 if (o
->spe
!= -127) /* That means NOT RANDOM! */
3438 otmp
->spe
= (schar
)o
->spe
;
3440 switch (o
->curse_state
) {
3441 case 1: bless(otmp
); break; /* BLESSED */
3442 case 2: unbless(otmp
); uncurse(otmp
, TRUE
); break; /* uncursed */
3443 case 3: curse(otmp
); break; /* CURSED */
3444 default: break; /* Otherwise it's random and we're happy
3445 * with what mkobj gave us! */
3448 /* corpsenm is "empty" if -1, random if -2, otherwise specific */
3449 if (o
->corpsenm
!= NON_PM
) {
3450 if (o
->corpsenm
== NON_PM
- 1) otmp
->corpsenm
= rndmonnum();
3451 else otmp
->corpsenm
= o
->corpsenm
;
3452 otmp
->owt
= weight(otmp
);
3455 if (otmp
->otyp
== EGG
&& In_spiders(&u
.uz
)) {
3456 otmp
->corpsenm
= PM_GIANT_SPIDER
;
3457 otmp
->age
= monstermoves
;
3459 /* assume we wouldn't be given an egg corpsenm unless it was
3461 if (otmp
->otyp
== EGG
&& otmp
->corpsenm
!= NON_PM
) {
3462 if (dead_species(otmp
->otyp
, TRUE
))
3463 kill_egg(otmp
); /* make sure nothing hatches */
3465 attach_egg_hatch_timeout(otmp
); /* attach new hatch timeout */
3469 otmp
= oname(otmp
, o
->name
.str
);
3471 switch(o
->containment
) {
3472 static struct obj
*container
= 0;
3477 impossible("create_object: no container");
3480 if (container
&& container
->otyp
== GOLD_PIECE
) { /* minimalist fix, though it doesn't completely fix things */
3483 remove_object(otmp
);
3484 (void) add_to_container(container
, otmp
, TRUE
);
3485 goto o_done
; /* don't stack, but do other cleanup */
3488 delete_contents(otmp
);
3494 default: impossible("containment type %d?", (int) o
->containment
);
3497 /* Medusa level special case: statues are petrified monsters, so they
3498 * are not stone-resistant and have monster inventory. They also lack
3499 * other contents, but that can be specified as an empty container.
3501 if (o
->id
== STATUE
&& Is_medusa_level(&u
.uz
) &&
3502 o
->corpsenm
== NON_PM
) {
3506 int i
= 0; /* prevent endless loop in case makemon always fails */
3508 /* Named random statues are of player types, and aren't stone-
3509 * resistant (if they were, we'd have to reset the name as well as
3510 * setting corpsenm).
3512 for (wastyp
= otmp
->corpsenm
; i
< 1000; i
++) {
3513 /* makemon without rndmonst() might create a group */
3514 was
= makemon(&mons
[wastyp
], 0, 0, NO_MM_FLAGS
);
3516 if (!resists_ston(was
)) break;
3519 wastyp
= rndmonnum();
3522 otmp
->corpsenm
= wastyp
;
3523 while(was
->minvent
) {
3526 obj_extract_self(obj
);
3527 (void) add_to_container(otmp
, obj
, TRUE
);
3529 otmp
->owt
= weight(otmp
);
3534 #ifdef RECORD_ACHIEVE
3535 /* Nasty hack here: try to determine if this is the Mines or Sokoban
3536 * "prize" and then set record_achieve_special (maps to corpsenm)
3537 * for the object. That field will later be checked to find out if
3538 * the player obtained the prize. */
3539 if(otmp
->otyp
== LUCKSTONE
&& Is_mineend_level(&u
.uz
)) {
3540 otmp
->record_achieve_special
= 1;
3541 } else if((otmp
->otyp
== AMULET_OF_REFLECTION
|| otmp
->otyp
== GAUNTLETS_OF_REFLECTION
|| otmp
->otyp
== RIN_POLYMORPH_CONTROL
|| otmp
->otyp
== RIN_TELEPORT_CONTROL
|| otmp
->otyp
== SHIELD_OF_MOBILITY
|| otmp
->otyp
== HELM_OF_DRAIN_RESISTANCE
|| otmp
->otyp
== CYAN_DRAGON_SCALE_MAIL
|| otmp
->otyp
== FLYING_BOOTS
||
3542 otmp
->otyp
== BAG_OF_HOLDING
) &&
3543 Is_sokoend_level(&u
.uz
)) {
3544 otmp
->record_achieve_special
= 1;
3545 } else if (otmp
->otyp
== STONE_OF_MAGIC_RESISTANCE
&& Is_deepend_level(&u
.uz
)) {
3546 otmp
->record_achieve_special
= 1;
3552 if (o
->oflags
& OBJF_LIT
)
3553 begin_burn(otmp
, FALSE
);
3554 if (o
->oflags
& OBJF_BURIED
)
3555 otmp
= bury_an_obj(otmp
);
3557 } /* if (rn2(100) < o->chance) */
3563 * Randomly place a specific engraving, then release its memory.
3566 create_engraving(e
, croom
)
3568 struct mkroom
*croom
;
3571 boolean found
= TRUE
;
3575 get_room_loc(&x
, &y
, croom
);
3577 found
= get_location(&x
, &y
, DRY
);
3580 make_engr_at(x
, y
, e
->engr
.str
, 0L, e
->etype
);
3581 free((void *) e
->engr
.str
);
3585 * Create stairs in a room.
3590 create_stairs(s
,croom
)
3592 struct mkroom
*croom
;
3597 get_free_room_loc(&x
, &y
, croom
);
3598 mkstairs(x
,y
,(char)s
->up
, croom
);
3602 * Create an altar in a room.
3606 create_altar(a
, croom
)
3608 struct mkroom
*croom
;
3612 boolean croom_is_temple
= TRUE
;
3618 get_free_room_loc(&x
, &y
, croom
);
3619 if (croom
->rtype
!= TEMPLE
)
3620 croom_is_temple
= FALSE
;
3622 if (!get_location(&x
, &y
, DRY
))
3623 return; /* nowhere */
3624 if ((sproom
= (schar
) *in_rooms(x
, y
, TEMPLE
)) != 0)
3625 croom
= &rooms
[sproom
- ROOMOFFSET
];
3627 croom_is_temple
= FALSE
;
3630 /* check for existing features */
3631 oldtyp
= levl
[x
][y
].typ
;
3632 if (oldtyp
== STAIRS
|| oldtyp
== LADDER
)
3638 /* Is the alignment random ?
3639 * If so, it's an 80% chance that the altar will be co-aligned.
3641 * The alignment is encoded as amask values instead of alignment
3642 * values to avoid conflicting with the rest of the encoding,
3643 * shared by many other parts of the special level code.
3646 amask
= (a
->align
== AM_SPLEV_CO
) ?
3647 Align2amask(u
.ualignbase
[A_ORIGINAL
]) :
3648 (a
->align
== AM_SPLEV_NONCO
) ?
3649 Align2amask(noncoalignment(u
.ualignbase
[A_ORIGINAL
])) :
3650 (a
->align
== -11) ? induced_align(80) :
3651 (a
->align
< 0 ? ralign
[-a
->align
-1] : a
->align
);
3653 levl
[x
][y
].typ
= ALTAR
;
3654 levl
[x
][y
].altarmask
= amask
;
3656 if (a
->shrine
< 0) a
->shrine
= rn2(2); /* handle random case */
3658 if (oldtyp
== FOUNTAIN
)
3659 level
.flags
.nfountains
--;
3660 else if (oldtyp
== SINK
)
3661 level
.flags
.nsinks
--;
3663 if (!croom_is_temple
|| !a
->shrine
) return;
3665 if (a
->shrine
) { /* Is it a shrine or sanctum? */
3666 priestini(&u
.uz
, croom
, x
, y
, (a
->shrine
> 1));
3667 levl
[x
][y
].altarmask
|= AM_SHRINE
;
3668 level
.flags
.has_temple
= TRUE
;
3671 register struct obj
*otmp
;
3672 otmp
= mksobj_at(POT_WATER
, x
, y
, FALSE
, FALSE
, FALSE
);
3682 * Create a gold pile in a room.
3686 create_gold(g
,croom
)
3688 struct mkroom
*croom
;
3694 get_room_loc(&x
, &y
, croom
);
3696 if (!get_location(&x
, &y
, DRY
))
3697 return; /* nowhere */
3699 if (g
->amount
== -1)
3700 g
->amount
= rnd(200);
3701 (void) mkgold((long) g
->amount
, x
, y
);
3705 * Create a feature (e.g a fountain) in a room.
3709 create_feature(fx
, fy
, croom
, typ
)
3711 struct mkroom
*croom
;
3722 get_room_loc(&x
, &y
, croom
);
3723 } while (++trycnt
<= 200 && occupied(x
,y
));
3725 get_room_loc(&x
, &y
, croom
);
3729 if (!get_location(&x
, &y
, DRY
))
3730 return; /* nowhere */
3732 /* Don't cover up an existing feature (particularly randomly
3733 placed stairs). However, if the _same_ feature is already
3734 here, it came from the map drawing and we still need to
3735 update the special counters. */
3736 if (IS_FURNITURE(levl
[x
][y
].typ
) && levl
[x
][y
].typ
!= typ
)
3739 levl
[x
][y
].typ
= typ
;
3740 if (typ
== FOUNTAIN
)
3741 level
.flags
.nfountains
++;
3742 else if (typ
== SINK
)
3743 level
.flags
.nsinks
++;
3744 /* else if (typ == TOILET)
3745 level.flags.nsinks++;*/
3749 * Search for a door in a room on a specified wall.
3753 search_door(croom
,x
,y
,wall
,cnt
)
3754 struct mkroom
*croom
;
3784 dx
= dy
= xx
= yy
= 0;
3785 panic("search_door: Bad wall!");
3788 while (xx
<= croom
->hx
+1 && yy
<= croom
->hy
+1) {
3789 if (IS_DOOR(levl
[xx
][yy
].typ
) || levl
[xx
][yy
].typ
== SDOOR
) {
3802 * Dig a corridor between two points.
3806 dig_corridor(org
,dest
,nxcor
,ftyp
,btyp
)
3811 register int dx
=0, dy
=0, dix
, diy
, cct
;
3812 register struct rm
*crm
;
3813 register int tx
, ty
, xx
, yy
;
3815 randomcolouur
= rnd(16);
3817 xx
= org
->x
; yy
= org
->y
;
3818 tx
= dest
->x
; ty
= dest
->y
;
3820 /* there's no real reason to restrict corridors to tiles one square away from the edge...
3821 * in fact, that restriction causes disjointed levels with the new sporkhack code in mklev.c --Amy */
3822 if (xx
</*=*/ 0 || yy
</*=*/ 0 || tx
</*=*/ 0 || ty
</*=*/ 0 ||
3823 xx
> COLNO
/*-1*/ || tx
> COLNO
/*-1*/ ||
3824 yy
> ROWNO
/*-1*/ || ty
> ROWNO
/*-1*/) {
3826 debugpline("dig_corridor: bad coords : (%d,%d) (%d,%d).",
3831 if (tx
> xx
) dx
= 1;
3832 else if (ty
> yy
) dy
= 1;
3833 else if (tx
< xx
) dx
= -1;
3839 while(xx
!= tx
|| yy
!= ty
) {
3840 /* loop: dig corridor at [xx,yy] and find new [xx,yy] */
3841 if(cct
++ > 500 || (nxcor
&& !rn2(35)))
3847 if(xx
>= COLNO
/*-1*/ || xx
</*=*/ 0 || yy
</*=*/ 0 || yy
>= ROWNO
/*-1*/)
3848 return FALSE
; /* impossible */
3850 crm
= &levl
[xx
][yy
];
3851 if(crm
->typ
== btyp
) {
3852 if(ftyp
!= CORR
|| rn2(100)) {
3854 crm
->fleecycolor
= randomcolouur
;
3856 if(!rn2(ishaxor
? 38 : 75))
3857 (void) mksobj_at(BOULDER
, xx
, yy
, TRUE
, FALSE
, FALSE
);
3858 else if(!rn2(ishaxor
? 20 : 40) && (timebasedlowerchance() || timebasedlowerchance() || timebasedlowerchance() ) )
3859 (void) mkobj_at(0, xx
, yy
, TRUE
, FALSE
);
3860 else if(moves
== 1 && !rn2(60)) /* some earlygame help... --Amy */
3861 (void) mkobj_at(0, xx
, yy
, TRUE
, FALSE
);
3862 else if(!rn2(ishaxor
? 50 : 100)){
3864 const char *mesg
= random_engraving(buf
);
3865 make_engr_at(xx
, yy
, mesg
, 0L, (xchar
)0);
3867 else if(!rn2(ishaxor
? 150 : 300) && !(depth(&u
.uz
) == 1 && In_dod(&u
.uz
) && rn2(3)) && !(depth(&u
.uz
) == 2 && In_dod(&u
.uz
) && rn2(2)) )
3868 (void) maketrap(xx
, yy
, rndtrap(), 100, TRUE
);
3869 else if(!rn2(ishaxor
? 100 : 200)) {
3870 if (!ishomicider
) (void) makemon((struct permonst
*)0, xx
, yy
, MM_MAYSLEEP
);
3871 else makerandomtrap_at(xx
, yy
, TRUE
);
3873 else if(!rn2(ishaxor
? 200 : 400))
3874 (void) mkfeature(xx
, yy
);
3879 if(crm
->typ
!= ftyp
&& crm
->typ
!= SCORR
) {
3884 /* find next corridor position */
3888 /* randomization code by jonadab */
3889 if ((dix
> diy
) && diy
&& !rn2(dix
-diy
+1)) {
3891 } else if ((diy
> dix
) && dix
&& !rn2(diy
-dix
+1)) {
3895 /* do we have to change direction ? */
3896 if(dy
&& dix
> diy
) {
3897 register int ddx
= (xx
> tx
) ? -1 : 1;
3899 crm
= &levl
[xx
+ddx
][yy
];
3900 if(crm
->typ
== btyp
|| crm
->typ
== ftyp
|| crm
->typ
== SCORR
) {
3905 } else if(dx
&& diy
> dix
) {
3906 register int ddy
= (yy
> ty
) ? -1 : 1;
3908 crm
= &levl
[xx
][yy
+ddy
];
3909 if(crm
->typ
== btyp
|| crm
->typ
== ftyp
|| crm
->typ
== SCORR
) {
3916 /* continue straight on? */
3917 crm
= &levl
[xx
+dx
][yy
+dy
];
3918 if(crm
->typ
== btyp
|| crm
->typ
== ftyp
|| crm
->typ
== SCORR
)
3921 /* no, what must we do now?? */
3924 dy
= (ty
< yy
) ? -1 : 1;
3927 dx
= (tx
< xx
) ? -1 : 1;
3929 crm
= &levl
[xx
+dx
][yy
+dy
];
3930 if(crm
->typ
== btyp
|| crm
->typ
== ftyp
|| crm
->typ
== SCORR
)
3939 * Disgusting hack: since special levels have their rooms filled before
3940 * sorting the rooms, we have to re-arrange the speed values upstairs_room
3941 * and dnstairs_room after the rooms have been sorted. On normal levels,
3942 * stairs don't get created until _after_ sorting takes place.
3948 struct mkroom
*croom
;
3951 !((dnstairs_room
->lx
<= xdnstair
&& xdnstair
<= dnstairs_room
->hx
) &&
3952 (dnstairs_room
->ly
<= ydnstair
&& ydnstair
<= dnstairs_room
->hy
))) {
3953 for(i
=0; i
< nroom
; i
++) {
3955 if((croom
->lx
<= xdnstair
&& xdnstair
<= croom
->hx
) &&
3956 (croom
->ly
<= ydnstair
&& ydnstair
<= croom
->hy
)) {
3957 dnstairs_room
= croom
;
3962 panic("Couldn't find dnstair room in fix_stair_rooms!");
3965 !((upstairs_room
->lx
<= xupstair
&& xupstair
<= upstairs_room
->hx
) &&
3966 (upstairs_room
->ly
<= yupstair
&& yupstair
<= upstairs_room
->hy
))) {
3967 for(i
=0; i
< nroom
; i
++) {
3969 if((croom
->lx
<= xupstair
&& xupstair
<= croom
->hx
) &&
3970 (croom
->ly
<= yupstair
&& yupstair
<= croom
->hy
)) {
3971 upstairs_room
= croom
;
3976 panic("Couldn't find upstair room in fix_stair_rooms!");
3981 * Corridors always start from a door. But it can end anywhere...
3982 * Basically we search for door coordinates or for endpoints coordinates
3983 * (from a distance).
3992 boolean specialcorridor
= 0;
3993 if (!rn2(iswarper
? 50 : 500)) specialcorridor
= 1;
3995 if (c
->src
.room
== -1) {
4002 if( !search_door(&rooms
[c
->src
.room
], &org
.x
, &org
.y
, c
->src
.wall
,
4006 if (c
->dest
.room
!= -1) {
4007 if(!search_door(&rooms
[c
->dest
.room
], &dest
.x
, &dest
.y
,
4008 c
->dest
.wall
, c
->dest
.door
))
4010 switch(c
->src
.wall
) {
4011 case W_NORTH
: org
.y
--; break;
4012 case W_SOUTH
: org
.y
++; break;
4013 case W_WEST
: org
.x
--; break;
4014 case W_EAST
: org
.x
++; break;
4016 switch(c
->dest
.wall
) {
4017 case W_NORTH
: dest
.y
--; break;
4018 case W_SOUTH
: dest
.y
++; break;
4019 case W_WEST
: dest
.x
--; break;
4020 case W_EAST
: dest
.x
++; break;
4022 if (!specialcorridor
) {
4023 (void) dig_corridor(&org
, &dest
, FALSE
, CORR
, STONE
);
4025 (void) dig_corridor(&org
, &dest
, FALSE
, walkableterrain(), STONE
);
4032 * Fill a room (shop, zoo, etc...) with appropriate stuff.
4036 fill_room(croom
, prefilled
)
4037 struct mkroom
*croom
;
4041 register int sx
,sy
,i
,eelct
=0;
4048 register int tryct
= 0;
4049 register struct obj
*otmp
;
4051 if (croom
&& croom
->rtype
== OROOM
&& at_dgn_entrance("Green Cross") && !(level
.flags
.has_greencrossroom
)) croom
->rtype
= GREENCROSSROOM
;
4053 if (croom
&& croom
->rtype
== OROOM
&& !rn2( ((isironman
|| RngeIronmanMode
|| In_netherrealm(&u
.uz
)) && (depth(&u
.uz
) > 1 && !(u
.preversionmode
&& In_greencross(&u
.uz
) && (dunlev(&u
.uz
) == 1)) && !(iszapem
&& In_spacebase(&u
.uz
) && (dunlev(&u
.uz
) == 1))) ) ? 1 : ((isironman
|| RngeIronmanMode
|| In_netherrealm(&u
.uz
)) && depth(&u
.uz
) < 2) ? 10 : Role_if(PM_CAMPERSTRIKER
) ? 50 : 5000) ) {
4058 case 1: croom
->rtype
= COURT
; break;
4059 case 2: croom
->rtype
= SWAMP
; break;
4060 case 3: croom
->rtype
= BEEHIVE
; break;
4061 case 4: croom
->rtype
= MORGUE
; break;
4062 case 5: croom
->rtype
= BARRACKS
; break;
4063 case 6: croom
->rtype
= ZOO
; break;
4064 case 7: croom
->rtype
= REALZOO
; break;
4065 case 8: croom
->rtype
= GIANTCOURT
; break;
4066 case 9: croom
->rtype
= LEPREHALL
; break;
4067 case 10: croom
->rtype
= DRAGONLAIR
; break;
4068 case 11: croom
->rtype
= BADFOODSHOP
; break;
4069 case 12: croom
->rtype
= COCKNEST
; break;
4070 case 13: croom
->rtype
= ANTHOLE
; break;
4071 case 14: croom
->rtype
= LEMUREPIT
; break;
4072 case 15: croom
->rtype
= MIGOHIVE
; break;
4073 case 16: croom
->rtype
= FUNGUSFARM
; break;
4074 case 17: croom
->rtype
= CLINIC
; break;
4075 case 18: croom
->rtype
= TERRORHALL
; break;
4076 case 19: croom
->rtype
= ELEMHALL
; break;
4077 case 20: croom
->rtype
= ANGELHALL
; break;
4078 case 21: croom
->rtype
= MIMICHALL
; break;
4079 case 22: croom
->rtype
= NYMPHHALL
; break;
4080 case 23: croom
->rtype
= SPIDERHALL
; break;
4081 case 24: croom
->rtype
= TROLLHALL
; break;
4082 case 25: croom
->rtype
= HUMANHALL
; break;
4083 case 26: croom
->rtype
= GOLEMHALL
; break;
4084 case 27: croom
->rtype
= COINHALL
; break;
4085 case 28: croom
->rtype
= DOUGROOM
; break;
4086 case 29: croom
->rtype
= ARMORY
; break;
4087 case 30: croom
->rtype
= TENSHALL
; break;
4088 case 31: croom
->rtype
= TRAPROOM
; break;
4089 case 32: croom
->rtype
= POOLROOM
; break;
4090 case 33: croom
->rtype
= STATUEROOM
; break;
4091 case 34: croom
->rtype
= INSIDEROOM
; break;
4092 case 35: croom
->rtype
= RIVERROOM
; break;
4093 case 36: croom
->rtype
= TEMPLE
; break;
4094 case 37: croom
->rtype
= EMPTYNEST
; break;
4095 case 38: croom
->rtype
= INSIDEROOM
; break;
4096 case 39: croom
->rtype
= INSIDEROOM
; break;
4097 case 40: croom
->rtype
= INSIDEROOM
; break;
4098 case 41: croom
->rtype
= INSIDEROOM
; break;
4099 case 42: croom
->rtype
= INSIDEROOM
; break;
4100 case 43: croom
->rtype
= INSIDEROOM
; break;
4101 case 44: croom
->rtype
= INSIDEROOM
; break;
4102 case 45: croom
->rtype
= INSIDEROOM
; break;
4103 case 46: croom
->rtype
= INSIDEROOM
; break;
4104 case 47: croom
->rtype
= INSIDEROOM
; break;
4105 case 48: croom
->rtype
= RIVERROOM
; break;
4106 case 49: croom
->rtype
= RIVERROOM
; break;
4107 case 50: croom
->rtype
= RIVERROOM
; break;
4108 case 51: croom
->rtype
= RIVERROOM
; break;
4109 case 52: croom
->rtype
= RIVERROOM
; break;
4110 case 53: croom
->rtype
= RIVERROOM
; break;
4111 case 54: croom
->rtype
= RIVERROOM
; break;
4112 case 55: croom
->rtype
= RIVERROOM
; break;
4113 case 56: croom
->rtype
= RIVERROOM
; break;
4114 case 57: croom
->rtype
= RIVERROOM
; break;
4115 case 58: croom
->rtype
= GRUEROOM
; break;
4116 case 59: croom
->rtype
= CRYPTROOM
; break;
4117 case 60: croom
->rtype
= TROUBLEZONE
; break;
4118 case 61: croom
->rtype
= WEAPONCHAMBER
; break;
4119 case 62: croom
->rtype
= HELLPIT
; break;
4120 case 63: croom
->rtype
= FEMINISMROOM
; break;
4121 case 64: croom
->rtype
= MEADOWROOM
; break;
4122 case 65: croom
->rtype
= COOLINGCHAMBER
; break;
4123 case 66: croom
->rtype
= VOIDROOM
; break;
4124 case 67: croom
->rtype
= HAMLETROOM
; break;
4125 case 68: croom
->rtype
= KOPSTATION
; break;
4126 case 69: croom
->rtype
= BOSSROOM
; break;
4127 case 70: croom
->rtype
= RNGCENTER
; break;
4128 case 71: croom
->rtype
= WIZARDSDORM
; break;
4129 case 72: croom
->rtype
= DOOMEDBARRACKS
; break;
4130 case 73: croom
->rtype
= SLEEPINGROOM
; break;
4131 case 74: croom
->rtype
= DIVERPARADISE
; break;
4132 case 75: croom
->rtype
= MENAGERIE
; break;
4135 croom
->rtype
= NASTYCENTRAL
; break;
4137 else goto retryrandtype
;
4138 case 77: croom
->rtype
= EMPTYDESERT
; break;
4139 case 78: croom
->rtype
= RARITYROOM
; break;
4140 case 79: croom
->rtype
= EXHIBITROOM
; break;
4141 case 80: croom
->rtype
= PRISONCHAMBER
; break;
4142 case 81: croom
->rtype
= NUCLEARCHAMBER
; break;
4143 case 82: croom
->rtype
= LEVELSEVENTYROOM
; break;
4144 case 83: croom
->rtype
= VARIANTROOM
; break;
4145 case 84: croom
->rtype
= EVILROOM
; break;
4146 case 85: croom
->rtype
= RELIGIONCENTER
; break;
4147 case 86: croom
->rtype
= CHAOSROOM
; break;
4148 case 87: croom
->rtype
= CURSEDMUMMYROOM
; break;
4149 case 88: croom
->rtype
= MIXEDPOOL
; break;
4150 case 89: croom
->rtype
= ARDUOUSMOUNTAIN
; break;
4151 case 90: croom
->rtype
= LEVELFFROOM
; break;
4152 case 91: croom
->rtype
= VERMINROOM
; break;
4153 case 92: croom
->rtype
= MIRASPA
; break;
4154 case 93: croom
->rtype
= MACHINEROOM
; break;
4155 case 94: croom
->rtype
= SHOWERROOM
; break;
4156 case 95: croom
->rtype
= GREENCROSSROOM
; break;
4157 case 96: croom
->rtype
= CENTRALTEDIUM
; break;
4158 case 97: croom
->rtype
= RUINEDCHURCH
; break;
4159 case 98: croom
->rtype
= RAMPAGEROOM
; break;
4160 case 99: croom
->rtype
= GAMECORNER
; break;
4161 case 100: croom
->rtype
= ILLUSIONROOM
; break;
4162 case 101: croom
->rtype
= ROBBERCAVE
; break;
4163 case 102: croom
->rtype
= SANITATIONCENTRAL
; break;
4164 case 103: croom
->rtype
= PLAYERCENTRAL
; break;
4165 case 104: croom
->rtype
= CASINOROOM
; break;
4166 case 105: croom
->rtype
= FULLROOM
; break;
4167 case 106: croom
->rtype
= LETTERSALADROOM
; break;
4168 case 107: croom
->rtype
= THE_AREA_ROOM
; break;
4169 case 108: croom
->rtype
= CHANGINGROOM
; break;
4170 case 109: croom
->rtype
= QUESTORROOM
; break;
4176 if (!croom
|| croom
->rtype
== OROOM
)
4179 if (croom
->rtype
== RANDOMSHOP
) {
4181 switch (rnd(100)) { /* random shop - probabilities should match shknam.c --Amy */
4206 croom
->rtype
= SHOPBASE
; break;
4224 croom
->rtype
= ARMORSHOP
; break;
4229 croom
->rtype
= SCROLLSHOP
; break;
4234 croom
->rtype
= POTIONSHOP
; break;
4252 croom
->rtype
= WEAPONSHOP
; break;
4254 croom
->rtype
= HEALTHFOODSHOP
; break;
4256 croom
->rtype
= FASTFOODSHOP
; break;
4259 croom
->rtype
= FOODSHOP
; break;
4263 croom
->rtype
= RINGSHOP
; break;
4268 croom
->rtype
= WANDSHOP
; break;
4272 croom
->rtype
= TOOLSHOP
; break;
4277 croom
->rtype
= PETSHOP
; break;
4282 croom
->rtype
= TINSHOP
; break;
4287 croom
->rtype
= BOOKSHOP
; break;
4289 croom
->rtype
= USELESSSHOP
; break;
4291 croom
->rtype
= GUNSHOP
; break;
4293 croom
->rtype
= BANGSHOP
; break;
4295 croom
->rtype
= AMMOSHOP
; break;
4297 croom
->rtype
= LITENSHOP
; break;
4299 croom
->rtype
= BOULDSHOP
; break;
4301 croom
->rtype
= ROCKSSHOP
; break;
4303 croom
->rtype
= WIERDSHOP
; break;
4305 croom
->rtype
= ZORKSHOP
; break;
4310 if (croom
->rtype
== RANDOMROOM
) {
4314 case 1: croom
->rtype
= COURT
; break;
4315 case 2: croom
->rtype
= SWAMP
; break;
4316 case 3: croom
->rtype
= BEEHIVE
; break;
4317 case 4: croom
->rtype
= MORGUE
; break;
4318 case 5: croom
->rtype
= BARRACKS
; break;
4319 case 6: croom
->rtype
= ZOO
; break;
4320 case 7: croom
->rtype
= REALZOO
; break;
4321 case 8: croom
->rtype
= GIANTCOURT
; break;
4322 case 9: croom
->rtype
= LEPREHALL
; break;
4323 case 10: croom
->rtype
= DRAGONLAIR
; break;
4324 case 11: croom
->rtype
= BADFOODSHOP
; break;
4325 case 12: croom
->rtype
= COCKNEST
; break;
4326 case 13: croom
->rtype
= ANTHOLE
; break;
4327 case 14: croom
->rtype
= LEMUREPIT
; break;
4328 case 15: croom
->rtype
= MIGOHIVE
; break;
4329 case 16: croom
->rtype
= FUNGUSFARM
; break;
4330 case 17: croom
->rtype
= CLINIC
; break;
4331 case 18: croom
->rtype
= TERRORHALL
; break;
4332 case 19: croom
->rtype
= ELEMHALL
; break;
4333 case 20: croom
->rtype
= ANGELHALL
; break;
4334 case 21: croom
->rtype
= MIMICHALL
; break;
4335 case 22: croom
->rtype
= NYMPHHALL
; break;
4336 case 23: croom
->rtype
= SPIDERHALL
; break;
4337 case 24: croom
->rtype
= TROLLHALL
; break;
4338 case 25: croom
->rtype
= HUMANHALL
; break;
4339 case 26: croom
->rtype
= GOLEMHALL
; break;
4340 case 27: croom
->rtype
= COINHALL
; break;
4341 case 28: croom
->rtype
= DOUGROOM
; break;
4342 case 29: croom
->rtype
= ARMORY
; break;
4343 case 30: croom
->rtype
= TENSHALL
; break;
4344 case 31: croom
->rtype
= TRAPROOM
; break;
4345 case 32: croom
->rtype
= POOLROOM
; break;
4346 case 33: croom
->rtype
= STATUEROOM
; break;
4347 case 34: croom
->rtype
= INSIDEROOM
; break;
4348 case 35: croom
->rtype
= RIVERROOM
; break;
4349 case 36: croom
->rtype
= TEMPLE
; break;
4350 case 37: croom
->rtype
= EMPTYNEST
; break;
4351 case 38: croom
->rtype
= GRUEROOM
; break;
4352 case 39: croom
->rtype
= CRYPTROOM
; break;
4353 case 40: croom
->rtype
= TROUBLEZONE
; break;
4354 case 41: croom
->rtype
= WEAPONCHAMBER
; break;
4355 case 42: croom
->rtype
= HELLPIT
; break;
4356 case 43: croom
->rtype
= FEMINISMROOM
; break;
4357 case 44: croom
->rtype
= MEADOWROOM
; break;
4358 case 45: croom
->rtype
= COOLINGCHAMBER
; break;
4359 case 46: croom
->rtype
= VOIDROOM
; break;
4360 case 47: croom
->rtype
= HAMLETROOM
; break;
4361 case 48: croom
->rtype
= KOPSTATION
; break;
4362 case 49: croom
->rtype
= BOSSROOM
; break;
4363 case 50: croom
->rtype
= RNGCENTER
; break;
4364 case 51: croom
->rtype
= WIZARDSDORM
; break;
4365 case 52: croom
->rtype
= DOOMEDBARRACKS
; break;
4366 case 53: croom
->rtype
= SLEEPINGROOM
; break;
4367 case 54: croom
->rtype
= DIVERPARADISE
; break;
4368 case 55: croom
->rtype
= MENAGERIE
; break;
4369 case 56: croom
->rtype
= rn2(20) ? TROUBLEZONE
: NASTYCENTRAL
; break;
4370 case 57: croom
->rtype
= EMPTYDESERT
; break;
4371 case 58: croom
->rtype
= RARITYROOM
; break;
4372 case 59: croom
->rtype
= EXHIBITROOM
; break;
4373 case 60: croom
->rtype
= PRISONCHAMBER
; break;
4374 case 61: croom
->rtype
= NUCLEARCHAMBER
; break;
4375 case 62: croom
->rtype
= LEVELSEVENTYROOM
; break;
4376 case 63: croom
->rtype
= VARIANTROOM
; break;
4377 case 64: croom
->rtype
= EVILROOM
; break;
4378 case 65: croom
->rtype
= RELIGIONCENTER
; break;
4379 case 66: croom
->rtype
= CHAOSROOM
; break;
4380 case 67: croom
->rtype
= CURSEDMUMMYROOM
; break;
4381 case 68: croom
->rtype
= MIXEDPOOL
; break;
4382 case 69: croom
->rtype
= ARDUOUSMOUNTAIN
; break;
4383 case 70: croom
->rtype
= LEVELFFROOM
; break;
4384 case 71: croom
->rtype
= VERMINROOM
; break;
4385 case 72: croom
->rtype
= MIRASPA
; break;
4386 case 73: croom
->rtype
= MACHINEROOM
; break;
4387 case 74: croom
->rtype
= SHOWERROOM
; break;
4388 case 75: croom
->rtype
= GREENCROSSROOM
; break;
4389 case 76: croom
->rtype
= CENTRALTEDIUM
; break;
4390 case 77: croom
->rtype
= RUINEDCHURCH
; break;
4391 case 78: croom
->rtype
= RAMPAGEROOM
; break;
4392 case 79: croom
->rtype
= GAMECORNER
; break;
4393 case 80: croom
->rtype
= ILLUSIONROOM
; break;
4394 case 81: croom
->rtype
= ROBBERCAVE
; break;
4395 case 82: croom
->rtype
= SANITATIONCENTRAL
; break;
4396 case 83: croom
->rtype
= PLAYERCENTRAL
; break;
4397 case 84: croom
->rtype
= CASINOROOM
; break;
4398 case 85: croom
->rtype
= FULLROOM
; break;
4399 case 86: croom
->rtype
= LETTERSALADROOM
; break;
4400 case 87: croom
->rtype
= THE_AREA_ROOM
; break;
4401 case 88: croom
->rtype
= CHANGINGROOM
; break;
4402 case 89: croom
->rtype
= QUESTORROOM
; break;
4412 if (croom
->rtype
>= SHOPBASE
) {
4413 stock_room(croom
->rtype
- SHOPBASE
, croom
);
4414 level
.flags
.has_shop
= TRUE
;
4418 switch (croom
->rtype
) {
4420 for (x
=croom
->lx
;x
<=croom
->hx
;x
++)
4421 for (y
=croom
->ly
;y
<=croom
->hy
;y
++)
4422 (void) mkgold((long)rn1(abs(depth(&u
.uz
))*20, 501), x
, y
);
4423 if (!rn2(5)) { /* sporkhack code */
4424 /* it's an aquarium! :) */
4425 level
.flags
.vault_is_aquarium
= TRUE
;
4426 create_feature(0,0,croom
,POOL
);
4427 create_feature(1,1,croom
,POOL
);
4429 (void)makemon(mkclass(S_EEL
,0),croom
->lx
,croom
->ly
, MM_MAYSLEEP
);
4432 (void)makemon(mkclass(S_EEL
,0),croom
->hx
,croom
->hy
, MM_MAYSLEEP
);
4435 else if (!rn2(100)) { /* evil patch idea by jonadab - cursed vaults filled with L */
4437 level
.flags
.vault_is_cursed
= TRUE
;
4439 u
.aggravation
= 1; /* make them high-level for good measure --Amy */
4440 u
.heavyaggravation
= 1; /* make them really high-level */
4441 DifficultyIncreased
+= 1; /* make them REALLY high-level (ugly hack) */
4442 HighlevelStatus
+= 1; /* and make the high-level ones more likely to spawn (ugly hack #2) */
4443 reset_rndmonst(NON_PM
);
4445 mtmp
= makemon(mkclass(S_LICH
,0),croom
->lx
,croom
->ly
, MM_MAYSLEEP
);
4446 if (mtmp
) mtmp
->msleeping
= 1;
4447 mtmp
= makemon(mkclass(S_LICH
,0),croom
->hx
,croom
->hy
, MM_MAYSLEEP
);
4448 if (mtmp
) mtmp
->msleeping
= 1;
4449 if (rn2(2)) {mtmp
= makemon(mkclass(S_LICH
,0),croom
->hx
,croom
->ly
, MM_MAYSLEEP
);
4450 if (mtmp
) mtmp
->msleeping
= 1;
4452 if (rn2(2)) {mtmp
= makemon(mkclass(S_LICH
,0),croom
->lx
,croom
->hy
, MM_MAYSLEEP
);
4453 if (mtmp
) mtmp
->msleeping
= 1;
4457 u
.heavyaggravation
= 0;
4458 if (DifficultyIncreased
> 0) DifficultyIncreased
-= 1;
4459 if (HighlevelStatus
> 0) HighlevelStatus
-= 1;
4496 /*case STATUEROOM:*/
4505 case SANITATIONCENTRAL
:
4508 case COOLINGCHAMBER
:
4515 case DOOMEDBARRACKS
:
4522 case NUCLEARCHAMBER
:
4523 case LEVELSEVENTYROOM
:
4528 case RELIGIONCENTER
:
4529 case CURSEDMUMMYROOM
:
4530 case ARDUOUSMOUNTAIN
:
4531 case LETTERSALADROOM
:
4540 case GREENCROSSROOM
:
4550 if (croom
->rtype
== SWAMP
) {
4552 if (croom
->ly
== 20 && croom
->hy
== 19) croom
->ly
= croom
->hy
= 20;
4553 if (croom
->ly
== 1 && croom
->hy
== 0) croom
->ly
= croom
->hy
= 0;
4555 for(sx
= croom
->lx
; sx
<= croom
->hx
; sx
++)
4556 for(sy
= croom
->ly
; sy
<= croom
->hy
; sy
++)
4557 if((levl
[sx
][sy
].typ
== ROOM
|| levl
[sx
][sy
].typ
== CORR
) && !t_at(sx
,sy
) ) {
4559 levl
[sx
][sy
].typ
= POOL
;
4560 if(!eelct
|| !rn2(10)) {
4561 /* mkclass() won't do, as we might get kraken */
4562 /* comment by Amy - low-level players shouldn't move close to water anyway, so I will totally spawn everything here! */
4563 (void) makemon(mkclass(S_EEL
,0), sx
, sy
, NO_MM_FLAGS
);
4567 if(!rn2(10)) /* swamps tend to be moldy */
4568 (void) makemon(mkclass(S_FUNGUS
,0), sx
, sy
, NO_MM_FLAGS
);
4570 if (!rn2(ishaxor
? 25 : 50))
4571 (void) mksobj_at(BLACK_HENBANE
, sx
, sy
, TRUE
, FALSE
, FALSE
);
4577 if (croom
->rtype
== TRAPROOM
) {
4581 if (!rn2(4)) randomnes
= 1;
4583 if (croom
->ly
== 20 && croom
->hy
== 19) croom
->ly
= croom
->hy
= 20;
4584 if (croom
->ly
== 1 && croom
->hy
== 0) croom
->ly
= croom
->hy
= 0;
4586 for(sx
= croom
->lx
; sx
<= croom
->hx
; sx
++)
4587 for(sy
= croom
->ly
; sy
<= croom
->hy
; sy
++)
4588 if((levl
[sx
][sy
].typ
> DBWALL
) && !t_at(sx
,sy
) ) {
4590 (void) maketrap(sx
, sy
, rtrap
, 100, TRUE
);
4591 if (randomnes
== 1) rtrap
= rndtrap();
4596 if (croom
->rtype
== POOLROOM
) {
4598 typ
= !rn2(6) ? POOL
: !rn2(5) ? MOAT
: !rn2(8) ? ICE
: !rn2(14) ? GRASSLAND
: !rn2(25) ? SNOW
: !rn2(30) ? ASH
: !rn2(35) ? SAND
: !rn2(35) ? PAVEDFLOOR
: !rn2(50) ? HIGHWAY
: !rn2(45) ? GRAVEWALL
: !rn2(20) ? CLOUD
: !rn2(32) ? AIR
: !rn2(40) ? ROCKWALL
: !rn2(40) ? TREE
: !rn2(50) ? FARMLAND
: !rn2(75) ? NETHERMIST
: !rn2(100) ? STALACTITE
: !rn2(100) ? MOUNTAIN
: !rn2(60) ? IRONBARS
: !rn2(70) ? CRYSTALWATER
: !rn2(100) ? TUNNELWALL
: !rn2(150) ? WATERTUNNEL
: !rn2(100) ? MOORLAND
: !rn2(150) ? URINELAKE
: !rn2(200) ? SHIFTINGSAND
: !rn2(50) ? STYXRIVER
: !rn2(400) ? WOODENTABLE
: !rn2(800) ? CARVEDBED
: !rn2(300) ? STRAWMATTRESS
: !rn2(800) ? WELL
: !rn2(800) ? POISONEDWELL
: !rn2(800) ? WAGON
: !rn2(800) ? BURNINGWAGON
: !rn2(480) ? FOUNTAIN
: !rn2(60) ? CRYPTFLOOR
: !rn2(100) ? BUBBLES
: !rn2(80) ? RAINCLOUD
: !rn2(1000) ? PENTAGRAM
: !rn2(1000) ? THRONE
: !rn2(240) ? SINK
: !rn2(160) ? TOILET
: !rn2(80) ? GRAVE
: !rn2(1000) ? ALTAR
: LAVAPOOL
;
4600 if (croom
->ly
== 20 && croom
->hy
== 19) croom
->ly
= croom
->hy
= 20;
4601 if (croom
->ly
== 1 && croom
->hy
== 0) croom
->ly
= croom
->hy
= 0;
4603 for(sx
= croom
->lx
; sx
<= croom
->hx
; sx
++)
4604 for(sy
= croom
->ly
; sy
<= croom
->hy
; sy
++)
4605 if((levl
[sx
][sy
].typ
== ROOM
|| levl
[sx
][sy
].typ
== CORR
) ) {
4607 levl
[sx
][sy
].typ
= typ
;
4608 if (typ
== FOUNTAIN
) level
.flags
.nfountains
++;
4609 if (typ
== SINK
) level
.flags
.nsinks
++;
4617 if (croom
->rtype
== CHAOSROOM
) {
4619 if (croom
->ly
== 20 && croom
->hy
== 19) croom
->ly
= croom
->hy
= 20;
4620 if (croom
->ly
== 1 && croom
->hy
== 0) croom
->ly
= croom
->hy
= 0;
4622 for(sx
= croom
->lx
; sx
<= croom
->hx
; sx
++)
4623 for(sy
= croom
->ly
; sy
<= croom
->hy
; sy
++)
4624 if((levl
[sx
][sy
].typ
== ROOM
|| levl
[sx
][sy
].typ
== CORR
) ) {
4626 levl
[sx
][sy
].typ
= randomwalltype();
4634 if (croom
->rtype
== RAMPAGEROOM
) {
4636 if (croom
->ly
== 20 && croom
->hy
== 19) croom
->ly
= croom
->hy
= 20;
4637 if (croom
->ly
== 1 && croom
->hy
== 0) croom
->ly
= croom
->hy
= 0;
4639 for(sx
= croom
->lx
; sx
<= croom
->hx
; sx
++)
4640 for(sy
= croom
->ly
; sy
<= croom
->hy
; sy
++) {
4641 if((levl
[sx
][sy
].typ
== ROOM
|| levl
[sx
][sy
].typ
== CORR
) ) {
4643 levl
[sx
][sy
].typ
= ROCKWALL
;
4649 if (!rn2(3)) (void) mksobj_at(BOULDER
, sx
, sy
, TRUE
, FALSE
, FALSE
);
4650 if (!rn2(3)) (void) maketrap(sx
, sy
, rndtrap(), 100, TRUE
);
4656 if (croom
->rtype
== MIXEDPOOL
) {
4658 if (croom
->ly
== 20 && croom
->hy
== 19) croom
->ly
= croom
->hy
= 20;
4659 if (croom
->ly
== 1 && croom
->hy
== 0) croom
->ly
= croom
->hy
= 0;
4661 for(sx
= croom
->lx
; sx
<= croom
->hx
; sx
++)
4662 for(sy
= croom
->ly
; sy
<= croom
->hy
; sy
++) {
4663 if((levl
[sx
][sy
].typ
== ROOM
|| levl
[sx
][sy
].typ
== CORR
) ) {
4665 levl
[sx
][sy
].typ
= rn2(2) ? MOAT
: CRYSTALWATER
;
4673 if (somexy(croom
, &mm
)) {
4674 (void) mksobj_at(TREASURE_CHEST
, mm
.x
, mm
.y
, TRUE
, FALSE
, FALSE
);
4679 if (croom
->rtype
== SHOWERROOM
) {
4681 if (croom
->ly
== 20 && croom
->hy
== 19) croom
->ly
= croom
->hy
= 20;
4682 if (croom
->ly
== 1 && croom
->hy
== 0) croom
->ly
= croom
->hy
= 0;
4684 for(sx
= croom
->lx
; sx
<= croom
->hx
; sx
++)
4685 for(sy
= croom
->ly
; sy
<= croom
->hy
; sy
++) {
4686 if((levl
[sx
][sy
].typ
== ROOM
|| levl
[sx
][sy
].typ
== CORR
) ) {
4688 levl
[sx
][sy
].typ
= rn2(2) ? BUBBLES
: RAINCLOUD
;
4698 if (croom
->rtype
== CENTRALTEDIUM
) {
4700 if (croom
->ly
== 20 && croom
->hy
== 19) croom
->ly
= croom
->hy
= 20;
4701 if (croom
->ly
== 1 && croom
->hy
== 0) croom
->ly
= croom
->hy
= 0;
4703 for(sx
= croom
->lx
; sx
<= croom
->hx
; sx
++)
4704 for(sy
= croom
->ly
; sy
<= croom
->hy
; sy
++) {
4705 if((levl
[sx
][sy
].typ
== ROOM
|| levl
[sx
][sy
].typ
== CORR
) ) {
4715 levl
[sx
][sy
].typ
= HIGHWAY
;
4719 levl
[sx
][sy
].typ
= GRASSLAND
;
4727 if((levl
[sx
][sy
].typ
> DBWALL
) && !t_at(sx
,sy
) ) {
4731 (void) maketrap(sx
, sy
, randominsidetrap(), 100, TRUE
);
4733 else (void) maketrap(sx
, sy
, LEVEL_TELEP
, 100, TRUE
);
4735 else (void) maketrap(sx
, sy
, TELEP_TRAP
, 100, TRUE
);
4744 if (croom
->rtype
== BOSSROOM
) {
4746 if (croom
->ly
== 20 && croom
->hy
== 19) croom
->ly
= croom
->hy
= 20;
4747 if (croom
->ly
== 1 && croom
->hy
== 0) croom
->ly
= croom
->hy
= 0;
4749 for(sx
= croom
->lx
; sx
<= croom
->hx
; sx
++)
4750 for(sy
= croom
->ly
; sy
<= croom
->hy
; sy
++) {
4752 if(!rn2(5) && !t_at(sx
, sy
))
4753 (void) maketrap(sx
, sy
, BOSS_SPAWNER
, 100, FALSE
);
4758 if (croom
->rtype
== NASTYCENTRAL
) {
4760 if (croom
->ly
== 20 && croom
->hy
== 19) croom
->ly
= croom
->hy
= 20;
4761 if (croom
->ly
== 1 && croom
->hy
== 0) croom
->ly
= croom
->hy
= 0;
4763 for(sx
= croom
->lx
; sx
<= croom
->hx
; sx
++)
4764 for(sy
= croom
->ly
; sy
<= croom
->hy
; sy
++) {
4765 (void) mksobj_at(rnd_class(RIGHT_MOUSE_BUTTON_STONE
, NASTY_STONE
), sx
, sy
, TRUE
, FALSE
, FALSE
);
4770 if (croom
->rtype
== EMPTYDESERT
) {
4772 if (croom
->ly
== 20 && croom
->hy
== 19) croom
->ly
= croom
->hy
= 20;
4773 if (croom
->ly
== 1 && croom
->hy
== 0) croom
->ly
= croom
->hy
= 0;
4775 for(sx
= croom
->lx
; sx
<= croom
->hx
; sx
++)
4776 for(sy
= croom
->ly
; sy
<= croom
->hy
; sy
++) {
4777 if((levl
[sx
][sy
].typ
== ROOM
|| levl
[sx
][sy
].typ
== CORR
) && rn2(10)) {
4778 levl
[sx
][sy
].typ
= rn2(5) ? SAND
: SHIFTINGSAND
;
4784 if (croom
->rtype
== INSIDEROOM
) {
4786 if (croom
->ly
== 20 && croom
->hy
== 19) croom
->ly
= croom
->hy
= 20;
4787 if (croom
->ly
== 1 && croom
->hy
== 0) croom
->ly
= croom
->hy
= 0;
4790 if (somexy(croom
, &mm
))
4791 (void) mksobj_at(TREASURE_CHEST
, mm
.x
, mm
.y
, TRUE
, FALSE
, FALSE
);
4794 if (somexy(croom
, &mm
))
4795 (void) mksobj_at(TREASURE_CHEST
, mm
.x
, mm
.y
, TRUE
, FALSE
, FALSE
);
4799 for(sx
= croom
->lx
; sx
<= croom
->hx
; sx
++)
4800 for(sy
= croom
->ly
; sy
<= croom
->hy
; sy
++)
4801 if((levl
[sx
][sy
].typ
== ROOM
|| levl
[sx
][sy
].typ
== CORR
) && !t_at(sx
,sy
) ) {
4803 typ
= !rn2(8) ? POOL
: !rn2(10) ? MOAT
: !rn2(9) ? ICE
: !rn2(20) ? GRASSLAND
: !rn2(50) ? SNOW
: !rn2(75) ? ASH
: !rn2(100) ? SAND
: !rn2(35) ? PAVEDFLOOR
: !rn2(150) ? HIGHWAY
: !rn2(25) ? GRAVEWALL
: !rn2(15) ? CLOUD
: !rn2(16) ? AIR
: !rn2(16) ? ROCKWALL
: !rn2(16) ? TREE
: !rn2(30) ? FARMLAND
: !rn2(100) ? NETHERMIST
: !rn2(200) ? STALACTITE
: !rn2(20) ? MOUNTAIN
: !rn2(20) ? IRONBARS
: !rn2(50) ? CRYSTALWATER
: !rn2(16) ? TUNNELWALL
: !rn2(150) ? WATERTUNNEL
: !rn2(100) ? MOORLAND
: !rn2(200) ? URINELAKE
: !rn2(300) ? SHIFTINGSAND
: !rn2(100) ? STYXRIVER
: !rn2(200) ? WOODENTABLE
: !rn2(300) ? CARVEDBED
: !rn2(100) ? STRAWMATTRESS
: !rn2(400) ? WELL
: !rn2(200) ? POISONEDWELL
: !rn2(400) ? WAGON
: !rn2(200) ? BURNINGWAGON
: !rn2(40) ? FOUNTAIN
: !rn2(60) ? CRYPTFLOOR
: !rn2(100) ? BUBBLES
: !rn2(80) ? RAINCLOUD
: !rn2(100) ? PENTAGRAM
: !rn2(100) ? THRONE
: !rn2(32) ? SINK
: !rn2(24) ? TOILET
: !rn2(12) ? GRAVE
: !rn2(200) ? ALTAR
: LAVAPOOL
;
4805 typ2
= randominsidetrap();
4808 levl
[sx
][sy
].typ
= typ
;
4810 if (typ
== FOUNTAIN
) level
.flags
.nfountains
++;
4811 if (typ
== SINK
) level
.flags
.nsinks
++;
4815 make_grave(sx
, sy
, (char *) 0);
4816 /* Possibly fill it with objects */
4817 if (!rn2(5)) (void) mkgold(0L, sx
, sy
);
4818 for (tryct
= rn2(2 + rn2(4)); tryct
; tryct
--) {
4819 if (timebasedlowerchance()) {
4820 otmp
= mkobj(rn2(3) ? COIN_CLASS
: RANDOM_CLASS
, TRUE
, FALSE
);
4825 add_to_buried(otmp
);
4832 /*else*/ if (!rn2(Role_if(PM_CAMPERSTRIKER
) ? 5 : 10)) (void) maketrap(sx
, sy
, typ2
, 100, TRUE
);
4834 if (!rn2(1000)) (void) mksobj_at(SWITCHER
, sx
, sy
, TRUE
, FALSE
, FALSE
);
4835 if (!rn2(Role_if(PM_CAMPERSTRIKER
) ? 25 : 100)) (void) mksobj_at(UGH_MEMORY_TO_CREATE_INVENTORY
, sx
, sy
, TRUE
, FALSE
, FALSE
);
4837 if (!rn2(Role_if(PM_CAMPERSTRIKER
) ? 20 : 40)) (void) makemon(insidemon(), sx
, sy
, MM_ADJACENTOK
|MM_ANGRY
);
4842 if (croom
->rtype
== RIVERROOM
) {
4844 if (croom
->ly
== 20 && croom
->hy
== 19) croom
->ly
= croom
->hy
= 20;
4845 if (croom
->ly
== 1 && croom
->hy
== 0) croom
->ly
= croom
->hy
= 0;
4848 if (somexy(croom
, &mm
))
4849 (void) mksobj_at(TREASURE_CHEST
, mm
.x
, mm
.y
, TRUE
, FALSE
, FALSE
);
4852 for(sx
= croom
->lx
; sx
<= croom
->hx
; sx
++)
4853 for(sy
= croom
->ly
; sy
<= croom
->hy
; sy
++)
4854 if((levl
[sx
][sy
].typ
== ROOM
|| levl
[sx
][sy
].typ
== CORR
) && !t_at(sx
,sy
) ) {
4856 typ
= !rn2(5) ? POOL
: !rn2(6) ? MOAT
: !rn2(20) ? ICE
: !rn2(20) ? GRASSLAND
: !rn2(80) ? HIGHWAY
: !rn2(20) ? FOUNTAIN
: !rn2(30) ? FARMLAND
: !rn2(35) ? MOUNTAIN
: !rn2(50) ? CRYSTALWATER
: !rn2(100) ? TUNNELWALL
: !rn2(150) ? WATERTUNNEL
: !rn2(6) ? ROCKWALL
: !rn2(16) ? TREE
: ROOM
;
4858 levl
[sx
][sy
].typ
= typ
;
4859 if (typ
== FOUNTAIN
) level
.flags
.nfountains
++;
4860 if (typ
== SINK
) level
.flags
.nsinks
++;
4861 if(Role_if(PM_CAMPERSTRIKER
) && !rn2(50)) (void) maketrap(sx
, sy
, rndtrap(), 100, TRUE
);
4866 if (croom
->rtype
== STATUEROOM
) {
4868 if (croom
->ly
== 20 && croom
->hy
== 19) croom
->ly
= croom
->hy
= 20;
4869 if (croom
->ly
== 1 && croom
->hy
== 0) croom
->ly
= croom
->hy
= 0;
4871 for(sx
= croom
->lx
; sx
<= croom
->hx
; sx
++)
4872 for(sy
= croom
->ly
; sy
<= croom
->hy
; sy
++)
4873 if((levl
[sx
][sy
].typ
== ROOM
|| levl
[sx
][sy
].typ
== CORR
) && !t_at(sx
,sy
) ) {
4875 (void) maketrap(sx
, sy
, (rn2(10) ? STATUE_TRAP
: ANIMATION_TRAP
), 100, TRUE
);
4878 for(sx
= croom
->lx
; sx
<= croom
->hx
; sx
++)
4879 for(sy
= croom
->ly
; sy
<= croom
->hy
; sy
++)
4882 struct obj
*sobj
= mksobj_at(STATUE
, sx
, sy
, TRUE
, FALSE
, FALSE
);
4884 if (sobj
&& !rn2(3) ) {
4885 for (i
= rn2(2 + rn2(4)); i
; i
--)
4886 if (timebasedlowerchance()) {
4887 (void) add_to_container(sobj
, mkobj(RANDOM_CLASS
, FALSE
, FALSE
), TRUE
);
4889 sobj
->owt
= weight(sobj
);
4891 if (sobj
) sobj
->owt
= weight(sobj
);
4896 switch (croom
->rtype
) {
4898 level
.flags
.has_vault
= TRUE
;
4902 level
.flags
.has_zoo
= TRUE
;
4905 level
.flags
.has_court
= TRUE
;
4908 level
.flags
.has_morgue
= TRUE
;
4911 level
.flags
.has_beehive
= TRUE
;
4914 level
.flags
.has_lemurepit
= TRUE
;
4917 level
.flags
.has_migohive
= TRUE
;
4920 level
.flags
.has_fungusfarm
= TRUE
;
4923 level
.flags
.has_clinic
= TRUE
;
4926 level
.flags
.has_mimichall
= TRUE
;
4929 level
.flags
.has_angelhall
= TRUE
;
4932 level
.flags
.has_elemhall
= TRUE
;
4935 level
.flags
.has_nymphhall
= TRUE
;
4938 level
.flags
.has_golemhall
= TRUE
;
4941 level
.flags
.has_grueroom
= TRUE
;
4944 level
.flags
.has_cryptroom
= TRUE
;
4947 level
.flags
.has_troublezone
= TRUE
;
4950 level
.flags
.has_weaponchamber
= TRUE
;
4953 level
.flags
.has_hellpit
= TRUE
;
4956 level
.flags
.has_robbercave
= TRUE
;
4959 level
.flags
.has_casinoroom
= TRUE
;
4961 case SANITATIONCENTRAL
:
4962 level
.flags
.has_sanitationcentral
= TRUE
;
4965 level
.flags
.has_feminismroom
= TRUE
;
4968 level
.flags
.has_meadowroom
= TRUE
;
4970 case COOLINGCHAMBER
:
4971 level
.flags
.has_coolingchamber
= TRUE
;
4974 level
.flags
.has_voidroom
= TRUE
;
4977 level
.flags
.has_armory
= TRUE
;
4980 level
.flags
.has_hamletroom
= TRUE
;
4983 level
.flags
.has_kopstation
= TRUE
;
4986 level
.flags
.has_bossroom
= TRUE
;
4989 level
.flags
.has_rngcenter
= TRUE
;
4992 level
.flags
.has_wizardsdorm
= TRUE
;
4994 case DOOMEDBARRACKS
:
4995 level
.flags
.has_doomedbarracks
= TRUE
;
4998 level
.flags
.has_sleepingroom
= TRUE
;
5001 level
.flags
.has_diverparadise
= TRUE
;
5004 level
.flags
.has_menagerie
= TRUE
;
5007 level
.flags
.has_nastycentral
= TRUE
;
5010 level
.flags
.has_emptydesert
= TRUE
;
5013 level
.flags
.has_rarityroom
= TRUE
;
5016 level
.flags
.has_exhibitroom
= TRUE
;
5019 level
.flags
.has_prisonchamber
= TRUE
;
5021 case NUCLEARCHAMBER
:
5022 level
.flags
.has_nuclearchamber
= TRUE
;
5024 case LEVELSEVENTYROOM
:
5025 level
.flags
.has_levelseventyroom
= TRUE
;
5028 level
.flags
.has_playercentral
= TRUE
;
5031 level
.flags
.has_variantroom
= TRUE
;
5034 level
.flags
.has_poolroom
= TRUE
;
5037 level
.flags
.has_statueroom
= TRUE
;
5040 level
.flags
.has_insideroom
= TRUE
;
5043 level
.flags
.has_riverroom
= TRUE
;
5046 level
.flags
.has_traproom
= TRUE
;
5049 level
.flags
.has_coinhall
= TRUE
;
5052 level
.flags
.has_spiderhall
= TRUE
;
5055 level
.flags
.has_trollhall
= TRUE
;
5058 level
.flags
.has_humanhall
= TRUE
;
5061 level
.flags
.has_terrorhall
= TRUE
;
5064 level
.flags
.has_tenshall
= TRUE
;
5067 level
.flags
.has_barracks
= TRUE
;
5070 level
.flags
.has_temple
= TRUE
;
5073 level
.flags
.has_swamp
= TRUE
;
5076 level
.flags
.has_evilroom
= TRUE
;
5078 case RELIGIONCENTER
:
5079 level
.flags
.has_religioncenter
= TRUE
;
5081 case CURSEDMUMMYROOM
:
5082 level
.flags
.has_cursedmummyroom
= TRUE
;
5084 case ARDUOUSMOUNTAIN
:
5085 level
.flags
.has_arduousmountain
= TRUE
;
5088 level
.flags
.has_questorroom
= TRUE
;
5091 level
.flags
.has_changingroom
= TRUE
;
5094 level
.flags
.has_levelffroom
= TRUE
;
5097 level
.flags
.has_verminroom
= TRUE
;
5100 level
.flags
.has_miraspa
= TRUE
;
5103 level
.flags
.has_machineroom
= TRUE
;
5106 level
.flags
.has_showerroom
= TRUE
;
5108 case GREENCROSSROOM
:
5109 level
.flags
.has_greencrossroom
= TRUE
;
5112 level
.flags
.has_ruinedchurch
= TRUE
;
5115 level
.flags
.has_gamecorner
= TRUE
;
5118 level
.flags
.has_illusionroom
= TRUE
;
5135 if ((j
= r
->ndoor
) != 0) {
5140 if ((j
= r
->nstair
) != 0) {
5145 if ((j
= r
->naltar
) != 0) {
5150 if ((j
= r
->nfountain
) != 0) {
5152 free(r
->fountains
[j
]);
5155 if ((j
= r
->nsink
) != 0) {
5160 if ((j
= r
->npool
) != 0) {
5165 if ((j
= r
->ntrap
) != 0) {
5170 if ((j
= r
->nmonster
) != 0) {
5172 free(r
->monsters
[j
]);
5175 if ((j
= r
->nobject
) != 0) {
5177 free(r
->objects
[j
]);
5180 if ((j
= r
->ngold
) != 0) {
5185 if ((j
= r
->nengraving
) != 0) {
5187 free(r
->engravings
[j
]);
5188 free(r
->engravings
);
5200 struct mkroom
*aroom
;
5202 xchar rtype
= (!r
->chance
|| rn2(100) < r
->chance
) ? r
->rtype
: OROOM
;
5205 aroom
= &subrooms
[nsubroom
];
5206 okroom
= create_subroom(pr
->mkr
, r
->x
, r
->y
, r
->w
, r
->h
,
5209 aroom
= &rooms
[nroom
];
5210 okroom
= create_room(r
->x
, r
->y
, r
->w
, r
->h
, r
->xalign
,
5211 r
->yalign
, rtype
, r
->rlit
, FALSE
, FALSE
);
5216 /* Create subrooms if necessary... */
5217 for(i
=0; i
< r
->nsubroom
; i
++)
5218 build_room(r
->subrooms
[i
], r
);
5219 /* And now we can fill the room! */
5221 /* Priority to the stairs */
5223 for(i
=0; i
<r
->nstair
; i
++)
5224 create_stairs(r
->stairs
[i
], aroom
);
5226 /* Then to the various elements (sinks, etc..) */
5227 for(i
= 0; i
<r
->nsink
; i
++)
5228 create_feature(r
->sinks
[i
]->x
, r
->sinks
[i
]->y
, aroom
, SINK
);
5229 /* for(i = 0; i<r->ntoilet; i++)
5230 create_feature(r->toilets[i]->x, r->toilets[i]->y, aroom, TOILET);*/
5231 for(i
= 0; i
<r
->npool
; i
++)
5232 create_feature(r
->pools
[i
]->x
, r
->pools
[i
]->y
, aroom
, POOL
);
5233 for(i
= 0; i
<r
->nfountain
; i
++)
5234 create_feature(r
->fountains
[i
]->x
, r
->fountains
[i
]->y
,
5236 for(i
= 0; i
<r
->naltar
; i
++)
5237 create_altar(r
->altars
[i
], aroom
);
5238 for(i
= 0; i
<r
->ndoor
; i
++)
5239 create_door(r
->doors
[i
], aroom
);
5242 for(i
= 0; i
<r
->ntrap
; i
++)
5243 create_trap(r
->traps
[i
], aroom
);
5246 for(i
= 0; i
<r
->nmonster
; i
++)
5247 create_monster(r
->monsters
[i
], aroom
);
5250 for(i
= 0; i
<r
->nobject
; i
++)
5251 create_object(r
->objects
[i
], aroom
);
5253 /* The gold piles */
5254 for(i
= 0; i
<r
->ngold
; i
++)
5255 create_gold(r
->golds
[i
], aroom
);
5257 /* The engravings */
5258 for (i
= 0; i
< r
->nengraving
; i
++)
5259 create_engraving(r
->engravings
[i
], aroom
);
5261 #ifdef SPECIALIZATION
5262 topologize(aroom
,FALSE
); /* set roomno */
5264 topologize(aroom
); /* set roomno */
5266 /* MRS - 07/04/91 - This is temporary but should result
5267 * in proper filling of shops, etc.
5268 * DLC - this can fail if corridors are added to this room
5269 * at a later point. Currently no good way to fix this.
5271 if( (aroom
->rtype
!= OROOM
|| (at_dgn_entrance("Green Cross") && !(level
.flags
.has_greencrossroom
)) || !rn2( ((isironman
|| RngeIronmanMode
|| In_netherrealm(&u
.uz
)) && (depth(&u
.uz
) > 1 && !(u
.preversionmode
&& In_greencross(&u
.uz
) && (dunlev(&u
.uz
) == 1)) && !(iszapem
&& In_spacebase(&u
.uz
) && (dunlev(&u
.uz
) == 1))) ) ? 1 : ((isironman
|| RngeIronmanMode
|| In_netherrealm(&u
.uz
)) && depth(&u
.uz
) < 2) ? 10 : Role_if(PM_CAMPERSTRIKER
) ? 50 : 5000) ) && r
->filled
) fill_room(aroom
, FALSE
);
5273 if ( (aroom
->rtype
== OROOM
|| !rn2(5)) && (!r
->nsubroom
|| !rn2(5)) ) {
5274 add_amy_stuff(aroom
);
5280 * set lighting in a region that will not become a room.
5283 light_region(tmpregion
)
5286 register boolean litstate
= tmpregion
->rlit
? 1 : 0;
5287 register int hiy
= tmpregion
->y2
;
5289 register struct rm
*lev
;
5290 int lowy
= tmpregion
->y1
;
5291 int lowx
= tmpregion
->x1
, hix
= tmpregion
->x2
;
5294 /* adjust region size for walls, but only if lighted */
5295 lowx
= max(lowx
-1,1);
5296 hix
= min(hix
+1,COLNO
-1);
5297 lowy
= max(lowy
-1,0);
5298 hiy
= min(hiy
+1, ROWNO
-1);
5300 for(x
= lowx
; x
<= hix
; x
++) {
5301 lev
= &levl
[x
][lowy
];
5302 for(y
= lowy
; y
<= hiy
; y
++) {
5303 if (lev
->typ
!= LAVAPOOL
) /* this overrides normal lighting */
5304 lev
->lit
= litstate
;
5310 /* initialization common to all special levels */
5312 load_common_data(fd
, typ
)
5322 /* shuffle 3 alignments; can't use sp_lev_shuffle() on aligntyp's */
5323 i
= rn2(3); atmp
=ralign
[2]; ralign
[2]=ralign
[i
]; ralign
[i
]=atmp
;
5324 if (rn2(2)) { atmp
=ralign
[1]; ralign
[1]=ralign
[0]; ralign
[0]=atmp
; }
5327 level
.flags
.is_maze_lev
= typ
== SP_LEV_MAZE
;
5329 /* Read the level initialization data */
5330 Fread((void *) &init_lev
, 1, sizeof(lev_init
), fd
);
5331 if(init_lev
.init_present
) {
5332 if(init_lev
.lit
< 0)
5333 init_lev
.lit
= rn2(2);
5337 /* Read the per level flags */
5338 Fread((void *) &lev_flags
, 1, sizeof(lev_flags
), fd
);
5339 if (lev_flags
& NOTELEPORT
)
5340 level
.flags
.noteleport
= 1;
5341 if (lev_flags
& HARDFLOOR
)
5342 level
.flags
.hardfloor
= 1;
5343 if (lev_flags
& NOMMAP
)
5344 level
.flags
.nommap
= 1;
5345 if (lev_flags
& SHORTSIGHTED
)
5346 level
.flags
.shortsighted
= 1;
5347 if (lev_flags
& ARBOREAL
)
5348 level
.flags
.arboreal
= 1;
5349 if (lev_flags
& SPOOKY
)
5350 level
.flags
.spooky
= 1;
5351 if (lev_flags
& LETHE
)
5352 level
.flags
.lethe
= 1;
5355 Fread((void *) &n
, 1, sizeof(n
), fd
);
5357 lev_message
= (char *) alloc(n
+ 1);
5358 Fread((void *) lev_message
, 1, (int) n
, fd
);
5364 load_one_monster(fd
, m
)
5370 Fread((void *) m
, 1, sizeof *m
, fd
);
5371 if ((size
= m
->name
.len
) != 0) {
5372 m
->name
.str
= (char *) alloc((unsigned)size
+ 1);
5373 Fread((void *) m
->name
.str
, 1, size
, fd
);
5374 m
->name
.str
[size
] = '\0';
5376 m
->name
.str
= (char *) 0;
5377 if ((size
= m
->appear_as
.len
) != 0) {
5378 m
->appear_as
.str
= (char *) alloc((unsigned)size
+ 1);
5379 Fread((void *) m
->appear_as
.str
, 1, size
, fd
);
5380 m
->appear_as
.str
[size
] = '\0';
5382 m
->appear_as
.str
= (char *) 0;
5386 load_one_object(fd
, o
)
5392 Fread((void *) o
, 1, sizeof *o
, fd
);
5393 if ((size
= o
->name
.len
) != 0) {
5394 o
->name
.str
= (char *) alloc((unsigned)size
+ 1);
5395 Fread((void *) o
->name
.str
, 1, size
, fd
);
5396 o
->name
.str
[size
] = '\0';
5398 o
->name
.str
= (char *) 0;
5402 load_one_engraving(fd
, e
)
5408 Fread((void *) e
, 1, sizeof *e
, fd
);
5410 e
->engr
.str
= (char *) alloc((unsigned)size
+1);
5411 Fread((void *) e
->engr
.str
, 1, size
, fd
);
5412 e
->engr
.str
[size
] = '\0';
5416 * Select a random coordinate in the maze.
5418 * We want a place not 'touched' by the loader. That is, a place in
5419 * the maze outside every part of the special level.
5426 xchar nrooms
, ncorr
;
5434 load_common_data(fd
, SP_LEV_ROOMS
);
5436 Fread((void *) &n
, 1, sizeof(n
), fd
); /* nrobjects */
5438 Fread((void *)robjects
, sizeof(*robjects
), n
, fd
);
5439 sp_lev_shuffle(robjects
, (char *)0, (int)n
);
5442 Fread((void *) &n
, 1, sizeof(n
), fd
); /* nrmonst */
5444 Fread((void *)rmonst
, sizeof(*rmonst
), n
, fd
);
5445 sp_lev_shuffle(rmonst
, (char *)0, (int)n
);
5448 Fread((void *) &nrooms
, 1, sizeof(nrooms
), fd
);
5449 /* Number of rooms to read */
5450 tmproom
= NewTab(room
,nrooms
);
5451 for (i
=0;i
<nrooms
;i
++) {
5454 r
= tmproom
[i
] = New(room
);
5456 /* Let's see if this room has a name */
5457 Fread((void *) &size
, 1, sizeof(size
), fd
);
5458 if (size
> 0) { /* Yup, it does! */
5459 r
->name
= (char *) alloc((unsigned)size
+ 1);
5460 Fread((void *) r
->name
, 1, size
, fd
);
5463 r
->name
= (char *) 0;
5465 /* Let's see if this room has a parent */
5466 Fread((void *) &size
, 1, sizeof(size
), fd
);
5467 if (size
> 0) { /* Yup, it does! */
5468 r
->parent
= (char *) alloc((unsigned)size
+ 1);
5469 Fread((void *) r
->parent
, 1, size
, fd
);
5470 r
->parent
[size
] = 0;
5472 r
->parent
= (char *) 0;
5474 Fread((void *) &r
->x
, 1, sizeof(r
->x
), fd
);
5475 /* x pos on the grid (1-5) */
5476 Fread((void *) &r
->y
, 1, sizeof(r
->y
), fd
);
5477 /* y pos on the grid (1-5) */
5478 Fread((void *) &r
->w
, 1, sizeof(r
->w
), fd
);
5479 /* width of the room */
5480 Fread((void *) &r
->h
, 1, sizeof(r
->h
), fd
);
5481 /* height of the room */
5482 Fread((void *) &r
->xalign
, 1, sizeof(r
->xalign
), fd
);
5483 /* horizontal alignment */
5484 Fread((void *) &r
->yalign
, 1, sizeof(r
->yalign
), fd
);
5485 /* vertical alignment */
5486 Fread((void *) &r
->rtype
, 1, sizeof(r
->rtype
), fd
);
5487 /* type of room (zoo, shop, etc.) */
5488 Fread((void *) &r
->chance
, 1, sizeof(r
->chance
), fd
);
5489 /* chance of room being special. */
5490 Fread((void *) &r
->rlit
, 1, sizeof(r
->rlit
), fd
);
5492 Fread((void *) &r
->filled
, 1, sizeof(r
->filled
), fd
);
5496 /* read the doors */
5497 Fread((void *) &r
->ndoor
, 1, sizeof(r
->ndoor
), fd
);
5498 if ((n
= r
->ndoor
) != 0)
5499 r
->doors
= NewTab(room_door
, n
);
5501 r
->doors
[(int)n
] = New(room_door
);
5502 Fread((void *) r
->doors
[(int)n
], 1,
5503 sizeof(room_door
), fd
);
5506 /* read the stairs */
5507 Fread((void *) &r
->nstair
, 1, sizeof(r
->nstair
), fd
);
5508 if ((n
= r
->nstair
) != 0)
5509 r
->stairs
= NewTab(stair
, n
);
5511 r
->stairs
[(int)n
] = New(stair
);
5512 Fread((void *) r
->stairs
[(int)n
], 1,
5516 /* read the altars */
5517 Fread((void *) &r
->naltar
, 1, sizeof(r
->naltar
), fd
);
5518 if ((n
= r
->naltar
) != 0)
5519 r
->altars
= NewTab(altar
, n
);
5521 r
->altars
[(int)n
] = New(altar
);
5522 Fread((void *) r
->altars
[(int)n
], 1,
5526 /* read the fountains */
5527 Fread((void *) &r
->nfountain
, 1,
5528 sizeof(r
->nfountain
), fd
);
5529 if ((n
= r
->nfountain
) != 0)
5530 r
->fountains
= NewTab(fountain
, n
);
5532 r
->fountains
[(int)n
] = New(fountain
);
5533 Fread((void *) r
->fountains
[(int)n
], 1,
5534 sizeof(fountain
), fd
);
5537 /* read the sinks */
5538 Fread((void *) &r
->nsink
, 1, sizeof(r
->nsink
), fd
);
5539 if ((n
= r
->nsink
) != 0)
5540 r
->sinks
= NewTab(sink
, n
);
5542 r
->sinks
[(int)n
] = New(sink
);
5543 Fread((void *) r
->sinks
[(int)n
], 1, sizeof(sink
), fd
);
5546 /* read the pools */
5547 Fread((void *) &r
->npool
, 1, sizeof(r
->npool
), fd
);
5548 if ((n
= r
->npool
) != 0)
5549 r
->pools
= NewTab(pool
,n
);
5551 r
->pools
[(int)n
] = New(pool
);
5552 Fread((void *) r
->pools
[(int)n
], 1, sizeof(pool
), fd
);
5555 /* read the traps */
5556 Fread((void *) &r
->ntrap
, 1, sizeof(r
->ntrap
), fd
);
5557 if ((n
= r
->ntrap
) != 0)
5558 r
->traps
= NewTab(trap
, n
);
5560 r
->traps
[(int)n
] = New(trap
);
5561 Fread((void *) r
->traps
[(int)n
], 1, sizeof(trap
), fd
);
5564 /* read the monsters */
5565 Fread((void *) &r
->nmonster
, 1, sizeof(r
->nmonster
), fd
);
5566 if ((n
= r
->nmonster
) != 0) {
5567 r
->monsters
= NewTab(monster
, n
);
5569 r
->monsters
[(int)n
] = New(monster
);
5570 load_one_monster(fd
, r
->monsters
[(int)n
]);
5575 /* read the objects, in same order as mazes */
5576 Fread((void *) &r
->nobject
, 1, sizeof(r
->nobject
), fd
);
5577 if ((n
= r
->nobject
) != 0) {
5578 r
->objects
= NewTab(object
, n
);
5579 for (j
= 0; j
< n
; ++j
) {
5580 r
->objects
[j
] = New(object
);
5581 load_one_object(fd
, r
->objects
[j
]);
5586 /* read the gold piles */
5587 Fread((void *) &r
->ngold
, 1, sizeof(r
->ngold
), fd
);
5588 if ((n
= r
->ngold
) != 0)
5589 r
->golds
= NewTab(gold
, n
);
5591 r
->golds
[(int)n
] = New(gold
);
5592 Fread((void *) r
->golds
[(int)n
], 1, sizeof(gold
), fd
);
5595 /* read the engravings */
5596 Fread((void *) &r
->nengraving
, 1,
5597 sizeof(r
->nengraving
), fd
);
5598 if ((n
= r
->nengraving
) != 0) {
5599 r
->engravings
= NewTab(engraving
,n
);
5601 r
->engravings
[(int)n
] = New(engraving
);
5602 load_one_engraving(fd
, r
->engravings
[(int)n
]);
5609 /* Now that we have loaded all the rooms, search the
5610 * subrooms and create the links.
5613 for (i
= 0; i
<nrooms
; i
++)
5614 if (tmproom
[i
]->parent
) {
5615 /* Search the parent room */
5616 for(j
=0; j
<nrooms
; j
++)
5617 if (tmproom
[j
]->name
&& !strcmp(tmproom
[j
]->name
,
5618 tmproom
[i
]->parent
)) {
5619 n
= tmproom
[j
]->nsubroom
++;
5620 tmproom
[j
]->subrooms
[(int)n
] = tmproom
[i
];
5626 * Create the rooms now...
5629 for (i
=0; i
< nrooms
; i
++)
5630 if(!tmproom
[i
]->parent
)
5631 build_room(tmproom
[i
], (room
*) 0);
5633 free_rooms(tmproom
, nrooms
);
5635 /* read the corridors */
5637 Fread((void *) &ncorr
, sizeof(ncorr
), 1, fd
);
5638 for (i
=0; i
<ncorr
; i
++) {
5639 Fread((void *) &tmpcor
, 1, sizeof(tmpcor
), fd
);
5640 create_corridor(&tmpcor
);
5643 /* chance to create Ludios portal, by Amy */
5644 if (In_dod(&u
.uz
)) {
5646 if (isok(mm
.x
, mm
.y
)) mk_knox_portal(mm
.x
, mm
.y
);
5654 maze1xy(m
, humidity
)
5658 register int x
, y
, tryct
= 2000;
5659 /* tryct: normally it won't take more than ten or so tries due
5660 to the circumstances under which we'll be called, but the
5661 `humidity' screening might drastically change the chances */
5664 x
= rn1(x_maze_max
- 3, 3);
5665 y
= rn1(y_maze_max
- 3, 3);
5666 if (--tryct
< 0) break; /* give up */
5667 } while (Map
[x
][y
] || !is_ok_location((schar
)x
, (schar
)y
, humidity
));
5668 /* Amy edit: used to also check for "!(x % 2) || !(y % 2) ||"... we want all tiles to have a chance of
5669 * getting stuff though, so that players can't simply avoid certain squares to never step on a trap */
5671 m
->x
= (xchar
)x
, m
->y
= (xchar
)y
;
5675 * The Big Thing: special maze loader
5677 * Could be cleaner, but it works.
5685 boolean prefilled
, room_not_needed
;
5687 char n
, numpart
= 0;
5688 xchar nwalk
= 0, nwalk_sav
;
5690 char halign
, valign
;
5694 int mapcount
, mapcountmax
, mapfact
;
5696 lev_region tmplregion
;
5706 stair tmpstair
, prevstair
;
5709 fountain tmpfountain
;
5710 engraving tmpengraving
;
5711 xchar mustfill
[(MAXNROFROOMS
+1)*2];
5712 struct trap
*badtrap
;
5715 int specialcorridor
;
5716 if (!rn2(iswarper
? 50 : 500)) specialcorridor
= rnd(2);
5718 (void) memset((void *)&Map
[0][0], 0, sizeof Map
);
5719 load_common_data(fd
, SP_LEV_MAZE
);
5721 /* Initialize map */
5722 Fread((void *) &filling
, 1, sizeof(filling
), fd
);
5723 if (!init_lev
.init_present
) { /* don't init if mkmap() has been called */
5724 for(x
= 2; x
<= x_maze_max
; x
++)
5725 for(y
= 0; y
<= y_maze_max
; y
++)
5726 if (filling
== -1) {
5727 #ifndef WALLIFIED_MAZE
5728 levl
[x
][y
].typ
= STONE
;
5731 (y
< 2 || ((x
% 2) && (y
% 2))) ? STONE
: HWALL
;
5734 levl
[x
][y
].typ
= filling
;
5738 /* Start reading the file */
5739 Fread((void *) &numpart
, 1, sizeof(numpart
), fd
);
5740 /* Number of parts */
5741 if (!numpart
|| numpart
> 9)
5742 panic("load_maze error: numpart = %d", (int) numpart
);
5745 Fread((void *) &halign
, 1, sizeof(halign
), fd
);
5746 /* Horizontal alignment */
5747 Fread((void *) &valign
, 1, sizeof(valign
), fd
);
5748 /* Vertical alignment */
5749 Fread((void *) &xsize
, 1, sizeof(xsize
), fd
);
5751 Fread((void *) &ysize
, 1, sizeof(ysize
), fd
);
5753 switch((int) halign
) {
5754 case LEFT
: xstart
= 3; break;
5755 case H_LEFT
: xstart
= 2+((x_maze_max
-2-xsize
)/4); break;
5756 case CENTER
: xstart
= 2+((x_maze_max
-2-xsize
)/2); break;
5757 case H_RIGHT
: xstart
= 2+((x_maze_max
-2-xsize
)*3/4); break;
5758 case RIGHT
: xstart
= x_maze_max
-xsize
-1; break;
5764 xstart
= 2+((x_maze_max
-2-xsize
)/4); break;
5766 xstart
= 2+((x_maze_max
-2-xsize
)/2); break;
5768 xstart
= 2+((x_maze_max
-2-xsize
)*3/4); break;
5770 xstart
= x_maze_max
-xsize
-1; break;
5774 switch((int) valign
) {
5775 case TOP
: ystart
= 3; break;
5776 case CENTER
: ystart
= 2+((y_maze_max
-2-ysize
)/2); break;
5777 case BOTTOM
: ystart
= y_maze_max
-ysize
-1; break;
5783 ystart
= 2+((y_maze_max
-2-ysize
)/2); break;
5785 ystart
= y_maze_max
-ysize
-1; break;
5789 if (!(xstart
% 2)) xstart
++;
5791 if ((ystart
% 2)) ystart
++;
5793 if (!(ystart
% 2)) ystart
++;
5795 if ((ystart
< 0) || (ystart
+ ysize
> ROWNO
)) {
5796 /* try to move the start a bit */
5797 ystart
+= (ystart
> 0) ? -2 : 2;
5798 if(ysize
== ROWNO
) ystart
= 0;
5799 if(ystart
< 0 || ystart
+ ysize
> ROWNO
)
5800 panic("reading special level with ysize too large");
5804 * If any CROSSWALLs are found, must change to ROOM after REGION's
5805 * are laid out. CROSSWALLS are used to specify "invisible"
5806 * boundaries where DOOR syms look bad or aren't desirable.
5810 if(init_lev
.init_present
&& xsize
<= 1 && ysize
<= 1) {
5817 for(y
= ystart
; y
< ystart
+ysize
; y
++)
5818 for(x
= xstart
; x
< xstart
+xsize
; x
++) {
5819 levl
[x
][y
].typ
= Fgetc(fd
);
5820 levl
[x
][y
].lit
= FALSE
;
5821 /* clear out levl: load_common_data may set them */
5822 levl
[x
][y
].flags
= 0;
5823 levl
[x
][y
].horizontal
= 0;
5824 levl
[x
][y
].roomno
= 0;
5825 levl
[x
][y
].edge
= 0;
5827 * Note: Even though levl[x][y].typ is type schar,
5828 * lev_comp.y saves it as type char. Since schar != char
5829 * all the time we must make this exception or hack
5830 * through lev_comp.y to fix.
5834 * Set secret doors to closed (why not trapped too?). Set
5835 * the horizontal bit.
5837 if (levl
[x
][y
].typ
== SDOOR
|| IS_DOOR(levl
[x
][y
].typ
)) {
5838 if(levl
[x
][y
].typ
== SDOOR
)
5839 levl
[x
][y
].doormask
= D_CLOSED
;
5841 * If there is a wall to the left that connects to a
5842 * (secret) door, then it is horizontal. This does
5843 * not allow (secret) doors to be corners of rooms.
5845 if (x
!= xstart
&& (IS_WALL(levl
[x
-1][y
].typ
) ||
5846 levl
[x
-1][y
].horizontal
))
5847 levl
[x
][y
].horizontal
= 1;
5848 } else if(levl
[x
][y
].typ
== HWALL
||
5849 levl
[x
][y
].typ
== IRONBARS
)
5850 levl
[x
][y
].horizontal
= 1;
5851 else if(levl
[x
][y
].typ
== LAVAPOOL
)
5853 else if(levl
[x
][y
].typ
== CROSSWALL
)
5857 if (init_lev
.init_present
&& init_lev
.joined
)
5858 remove_rooms(xstart
, ystart
, xstart
+xsize
, ystart
+ysize
);
5861 Fread((void *) &n
, 1, sizeof(n
), fd
);
5862 /* Number of level regions */
5865 /* realloc the lregion space to add the new ones */
5866 /* don't really free it up until the whole level is done */
5867 lev_region
*newl
= (lev_region
*) alloc(sizeof(lev_region
) *
5868 (unsigned)(n
+num_lregions
));
5869 (void) memcpy((void *)(newl
+n
), (void *)lregions
,
5870 sizeof(lev_region
) * num_lregions
);
5876 lregions
= (lev_region
*)
5877 alloc(sizeof(lev_region
) * (unsigned)n
);
5882 boolean found
= TRUE
;
5883 Fread((void *) &tmplregion
, sizeof(tmplregion
), 1, fd
);
5884 if ((size
= tmplregion
.rname
.len
) != 0) {
5885 tmplregion
.rname
.str
= (char *) alloc((unsigned)size
+ 1);
5886 Fread((void *) tmplregion
.rname
.str
, size
, 1, fd
);
5887 tmplregion
.rname
.str
[size
] = '\0';
5889 tmplregion
.rname
.str
= (char *) 0;
5890 if(!tmplregion
.in_islev
) {
5891 found
&= get_location(&tmplregion
.inarea
.x1
,
5892 &tmplregion
.inarea
.y1
, DRY
|WET
);
5893 found
&= get_location(&tmplregion
.inarea
.x2
,
5894 &tmplregion
.inarea
.y2
, DRY
|WET
);
5896 if(!tmplregion
.del_islev
) {
5897 found
&= get_location(&tmplregion
.delarea
.x1
,
5898 &tmplregion
.delarea
.y1
, DRY
|WET
);
5899 found
&= get_location(&tmplregion
.delarea
.x2
,
5900 &tmplregion
.delarea
.y2
, DRY
|WET
);
5903 panic("reading special level with region located nowhere");
5904 lregions
[(int)n
] = tmplregion
;
5907 /* random level region registers */
5908 Fread((void *) &n
, 1, sizeof(n
), fd
);
5912 boolean found
= TRUE
;
5913 Fread((void *) &tmplregion
, sizeof(tmplregion
), 1, fd
);
5914 if ((size
= tmplregion
.rname
.len
) != 0) {
5915 tmplregion
.rname
.str
= (char *) alloc((unsigned)size
+ 1);
5916 Fread((void *) tmplregion
.rname
.str
, size
, 1, fd
);
5917 tmplregion
.rname
.str
[size
] = '\0';
5919 tmplregion
.rname
.str
= (char *) 0;
5921 panic("reading special level with random region located nowhere");
5922 (void) memcpy((void *)&rarea
[(int)tmpn
- n
- 1],
5923 (void *)&tmplregion
, sizeof(lev_region
));
5927 Fread((void *) &n
, 1, sizeof(n
), fd
);
5928 /* Random objects */
5930 Fread((void *)robjects
, sizeof(*robjects
), (int) n
, fd
);
5931 sp_lev_shuffle(robjects
, (char *)0, (int)n
);
5934 Fread((void *) &n
, 1, sizeof(n
), fd
);
5935 /* Random locations */
5938 Fread((void *)nloc
, sizeof(*nloc
), (int) n
, fd
);
5939 for(xi
= 0; xi
< n
; xi
++) {
5940 Fread((void *)rloc_x
[xi
], sizeof(*rloc_x
[xi
]),
5941 (int) nloc
[xi
], fd
);
5942 Fread((void *)rloc_y
[xi
], sizeof(*rloc_y
[xi
]),
5943 (int) nloc
[xi
], fd
);
5944 sp_lev_shuffle(rloc_x
[xi
], rloc_y
[xi
], (int)nloc
[xi
]);
5948 Fread((void *) &n
, 1, sizeof(n
), fd
);
5949 /* Random monsters */
5951 Fread((void *)rmonst
, sizeof(*rmonst
), (int) n
, fd
);
5952 sp_lev_shuffle(rmonst
, (char *)0, (int)n
);
5955 (void) memset((void *)mustfill
, 0, sizeof(mustfill
));
5956 Fread((void *) &n
, 1, sizeof(n
), fd
);
5957 /* Number of subrooms */
5959 register struct mkroom
*troom
;
5961 Fread((void *)&tmpregion
, 1, sizeof(tmpregion
), fd
);
5963 if(tmpregion
.rtype
> MAXRTYPE
) {
5964 tmpregion
.rtype
-= MAXRTYPE
+1;
5969 if(tmpregion
.rlit
< 0)
5970 tmpregion
.rlit
= (rnd(1+abs(depth(&u
.uz
))) < 11 && rn2(77))
5973 if (!get_location(&tmpregion
.x1
, &tmpregion
.y1
, DRY
|WET
) ||
5974 !get_location(&tmpregion
.x2
, &tmpregion
.y2
, DRY
|WET
))
5975 panic("reading special level with region located nowhere");
5977 /* for an ordinary room, `prefilled' is a flag to force
5978 an actual room to be created (such rooms are used to
5979 control placement of migrating monster arrivals) */
5980 room_not_needed
= (tmpregion
.rtype
== OROOM
&&
5981 !tmpregion
.rirreg
&& !prefilled
);
5982 if (room_not_needed
|| nroom
>= MAXNROFROOMS
) {
5983 if (!room_not_needed
)
5984 impossible("Too many rooms on new level!");
5985 light_region(&tmpregion
);
5989 troom
= &rooms
[nroom
];
5991 /* mark rooms that must be filled, but do it later */
5992 if (tmpregion
.rtype
!= OROOM
|| (at_dgn_entrance("Green Cross") && !(level
.flags
.has_greencrossroom
)) || !rn2( ((isironman
|| RngeIronmanMode
|| In_netherrealm(&u
.uz
)) && (depth(&u
.uz
) > 1 && !(u
.preversionmode
&& In_greencross(&u
.uz
) && (dunlev(&u
.uz
) == 1)) && !(iszapem
&& In_spacebase(&u
.uz
) && (dunlev(&u
.uz
) == 1))) ) ? 1 : ((isironman
|| RngeIronmanMode
|| In_netherrealm(&u
.uz
)) && depth(&u
.uz
) < 2) ? 10 : Role_if(PM_CAMPERSTRIKER
) ? 50 : 5000) )
5993 mustfill
[nroom
] = (prefilled
? 2 : 1);
5995 if(tmpregion
.rirreg
) {
5996 min_rx
= max_rx
= tmpregion
.x1
;
5997 min_ry
= max_ry
= tmpregion
.y1
;
5998 flood_fill_rm(tmpregion
.x1
, tmpregion
.y1
,
5999 nroom
+ROOMOFFSET
, tmpregion
.rlit
, TRUE
);
6000 add_room(min_rx
, min_ry
, max_rx
, max_ry
,
6001 FALSE
, tmpregion
.rtype
, TRUE
, FALSE
, FALSE
);
6002 troom
->rlit
= tmpregion
.rlit
;
6003 troom
->irregular
= TRUE
;
6005 add_room(tmpregion
.x1
, tmpregion
.y1
,
6006 tmpregion
.x2
, tmpregion
.y2
,
6007 tmpregion
.rlit
, tmpregion
.rtype
, TRUE
, FALSE
, FALSE
);
6008 #ifdef SPECIALIZATION
6009 topologize(troom
,FALSE
); /* set roomno */
6011 topologize(troom
); /* set roomno */
6016 Fread((void *) &n
, 1, sizeof(n
), fd
);
6017 /* Number of doors */
6019 struct mkroom
*croom
= &rooms
[0];
6021 Fread((void *)&tmpdoor
, 1, sizeof(tmpdoor
), fd
);
6023 x
= tmpdoor
.x
; y
= tmpdoor
.y
;
6024 typ
= tmpdoor
.mask
== -1 ? rnddoor() : tmpdoor
.mask
;
6026 if (get_location(&x
, &y
, DRY
)) {
6027 if(levl
[x
][y
].typ
!= SDOOR
)
6028 levl
[x
][y
].typ
= DOOR
;
6031 typ
= D_CLOSED
; /* force it to be closed */
6033 levl
[x
][y
].doormask
= typ
;
6035 /* Fix random door alignment */
6037 if (y
> 0 && (IS_WALL(levl
[x
][y
-1].typ
) ||
6038 levl
[x
][y
-1].horizontal
))
6039 levl
[x
][y
].horizontal
= 0;
6042 /* Now the complicated part, list it with each subroom */
6043 /* The dog move and mail daemon routines use this */
6045 while(croom
->hx
>= 0 && doorindex
< DOORMAX
) {
6046 if(croom
->hx
>= x
-1 && croom
->lx
<= x
+1 &&
6047 croom
->hy
>= y
-1 && croom
->ly
<= y
+1) {
6049 xi
= add_door(x
, y
, croom
);
6050 doors
[xi
].arti_key
= tmpdoor
.arti_key
;
6054 if (xi
< 0) { /* Not in any room */
6055 if (doorindex
>= DOORMAX
)
6056 impossible("Too many doors?");
6058 xi
= add_door(x
, y
, (struct mkroom
*)0);
6059 doors
[xi
].arti_key
= tmpdoor
.arti_key
;
6064 /* now that we have rooms _and_ associated doors, fill the rooms */
6065 for(n
= 0; n
< SIZE(mustfill
); n
++)
6066 if(mustfill
[(int)n
])
6067 fill_room(&rooms
[(int)n
], (mustfill
[(int)n
] == 2));
6069 /* if special boundary syms (CROSSWALL) in map, remove them now */
6071 for(x
= xstart
; x
< xstart
+xsize
; x
++)
6072 for(y
= ystart
; y
< ystart
+ysize
; y
++)
6073 if(levl
[x
][y
].typ
== CROSSWALL
)
6074 levl
[x
][y
].typ
= ROOM
;
6077 Fread((void *) &n
, 1, sizeof(n
), fd
);
6078 /* Number of drawbridges */
6080 Fread((void *)&tmpdb
, 1, sizeof(tmpdb
), fd
);
6082 x
= tmpdb
.x
; y
= tmpdb
.y
;
6083 if (get_location(&x
, &y
, DRY
|WET
)) {
6084 if (!create_drawbridge(x
, y
, tmpdb
.dir
, tmpdb
.db_open
))
6085 impossible("Cannot create drawbridge.");
6089 Fread((void *) &n
, 1, sizeof(n
), fd
);
6090 /* Number of mazewalks */
6092 Fread((void *)&tmpwalk
, 1, sizeof(tmpwalk
), fd
);
6094 if (get_location(&tmpwalk
.x
, &tmpwalk
.y
, DRY
|WET
))
6095 walklist
[nwalk
++] = tmpwalk
;
6098 Fread((void *) &n
, 1, sizeof(n
), fd
);
6099 /* Number of non_diggables */
6101 Fread((void *)&tmpdig
, 1, sizeof(tmpdig
), fd
);
6103 get_location(&tmpdig
.x1
, &tmpdig
.y1
, DRY
|WET
);
6104 get_location(&tmpdig
.x2
, &tmpdig
.y2
, DRY
|WET
);
6106 set_wall_property(tmpdig
.x1
, tmpdig
.y1
,
6107 tmpdig
.x2
, tmpdig
.y2
, W_NONDIGGABLE
);
6110 Fread((void *) &n
, 1, sizeof(n
), fd
);
6111 /* Number of non_passables */
6113 Fread((void *)&tmpdig
, 1, sizeof(tmpdig
), fd
);
6115 get_location(&tmpdig
.x1
, &tmpdig
.y1
, DRY
|WET
);
6116 get_location(&tmpdig
.x2
, &tmpdig
.y2
, DRY
|WET
);
6118 set_wall_property(tmpdig
.x1
, tmpdig
.y1
,
6119 tmpdig
.x2
, tmpdig
.y2
, W_NONPASSWALL
);
6122 Fread((void *) &n
, 1, sizeof(n
), fd
);
6123 /* Number of ladders */
6125 Fread((void *)&tmplad
, 1, sizeof(tmplad
), fd
);
6127 x
= tmplad
.x
; y
= tmplad
.y
;
6128 if (get_location(&x
, &y
, DRY
)) {
6129 levl
[x
][y
].typ
= LADDER
;
6130 if (tmplad
.up
== 1) {
6131 xupladder
= x
; yupladder
= y
;
6132 levl
[x
][y
].ladder
= LA_UP
;
6134 xdnladder
= x
; ydnladder
= y
;
6135 levl
[x
][y
].ladder
= LA_DOWN
;
6140 prevstair
.x
= prevstair
.y
= 0;
6141 Fread((void *) &n
, 1, sizeof(n
), fd
);
6142 /* Number of stairs */
6145 Fread((void *)&tmpstair
, 1, sizeof(tmpstair
), fd
);
6149 x
= tmpstair
.x
; y
= tmpstair
.y
;
6150 found
= get_location(&x
, &y
, DRY
);
6151 } while(found
&& prevstair
.x
&& xi
++ < 100 &&
6152 distmin(x
,y
,prevstair
.x
,prevstair
.y
) <= 8);
6155 if ((badtrap
= t_at(x
,y
)) != 0) deltrap(badtrap
);
6156 mkstairs(x
, y
, (char)tmpstair
.up
, (struct mkroom
*)0);
6161 Fread((void *) &n
, 1, sizeof(n
), fd
);
6162 /* Number of altars */
6164 Fread((void *)&tmpaltar
, 1, sizeof(tmpaltar
), fd
);
6166 create_altar(&tmpaltar
, (struct mkroom
*)0);
6169 Fread((void *) &n
, 1, sizeof(n
), fd
);
6170 /* Number of fountains */
6172 Fread((void *)&tmpfountain
, 1, sizeof(tmpfountain
), fd
);
6174 create_feature(tmpfountain
.x
, tmpfountain
.y
,
6175 (struct mkroom
*)0, FOUNTAIN
);
6178 Fread((void *) &n
, 1, sizeof(n
), fd
);
6179 /* Number of traps */
6181 Fread((void *)&tmptrap
, 1, sizeof(tmptrap
), fd
);
6183 create_trap(&tmptrap
, (struct mkroom
*)0);
6186 Fread((void *) &n
, 1, sizeof(n
), fd
);
6187 /* Number of monsters */
6189 load_one_monster(fd
, &tmpmons
);
6191 create_monster(&tmpmons
, (struct mkroom
*)0);
6194 Fread((void *) &n
, 1, sizeof(n
), fd
);
6195 /* Number of objects */
6197 load_one_object(fd
, &tmpobj
);
6199 create_object(&tmpobj
, (struct mkroom
*)0);
6202 Fread((void *) &n
, 1, sizeof(n
), fd
);
6203 /* Number of gold piles */
6205 Fread((void *)&tmpgold
, 1, sizeof(tmpgold
), fd
);
6207 create_gold(&tmpgold
, (struct mkroom
*)0);
6210 Fread((void *) &n
, 1, sizeof(n
), fd
);
6211 /* Number of engravings */
6213 load_one_engraving(fd
, &tmpengraving
);
6215 create_engraving(&tmpengraving
, (struct mkroom
*)0);
6218 } /* numpart loop */
6222 x
= (xchar
) walklist
[nwalk
].x
;
6223 y
= (xchar
) walklist
[nwalk
].y
;
6224 dir
= walklist
[nwalk
].dir
;
6226 /* don't use move() - it doesn't use W_NORTH, etc. */
6228 case W_NORTH
: --y
; break;
6229 case W_SOUTH
: y
++; break;
6230 case W_EAST
: x
++; break;
6231 case W_WEST
: --x
; break;
6232 default: panic("load_maze: bad MAZEWALK direction");
6235 if(!IS_DOOR(levl
[x
][y
].typ
) && !specialcorridor
) {
6236 #ifndef WALLIFIED_MAZE
6237 levl
[x
][y
].typ
= CORR
;
6239 levl
[x
][y
].typ
= ROOM
;
6241 levl
[x
][y
].flags
= 0;
6243 if(!IS_DOOR(levl
[x
][y
].typ
) && specialcorridor
) {
6245 levl
[x
][y
].typ
= walkableterrain();
6246 levl
[x
][y
].flags
= 0;
6250 * We must be sure that the parity of the coordinates for
6251 * walkfrom() is odd. But we must also take into account
6252 * what direction was chosen.
6260 /* no need for IS_DOOR check; out of map bounds */
6262 if (!specialcorridor
) {
6263 #ifndef WALLIFIED_MAZE
6264 levl
[x
][y
].typ
= CORR
;
6266 levl
[x
][y
].typ
= ROOM
;
6269 else levl
[x
][y
].typ
= walkableterrain();
6271 levl
[x
][y
].flags
= 0;
6283 /* wallification(1, 0, COLNO-1, ROWNO-1, FALSE); */
6284 wallification(1, 0, COLNO
-1, ROWNO
-1, TRUE
);
6287 * If there's a significant portion of maze unused by the special level,
6288 * we don't want it empty.
6290 * Makes the number of traps, monsters, etc. proportional
6291 * to the size of the maze.
6293 mapcountmax
= mapcount
= (x_maze_max
- 2) * (y_maze_max
- 2);
6295 for(x
= 2; x
< x_maze_max
; x
++)
6296 for(y
= 0; y
< y_maze_max
; y
++)
6297 if(Map
[x
][y
]) mapcount
--;
6299 if (nwalk_sav
&& (mapcount
> (int) (mapcountmax
/ 10))) {
6300 mapfact
= (int) ((mapcount
* 100L) / mapcountmax
);
6302 for(x
= rnd((int) ((rn2(4) ? 30 : 60) * mapfact
) / 100); x
; x
--) {
6304 for(x
= rnd((int) ((rn2(4) ? 20 : 40) * mapfact
) / 100); x
; x
--) {
6306 if (timebasedlowerchance() || timebasedlowerchance() || timebasedlowerchance()) {
6308 (void) mkobj_at(!rn2(25) ? GEM_CLASS
: RANDOM_CLASS
, mm
.x
, mm
.y
, TRUE
, FALSE
);
6312 if (moves
== 1) { /* some earlygame help... --Amy */
6314 for(x
= rnd((int) ((rn2(4) ? 30 : 60) * mapfact
) / 100); x
; x
--) {
6316 for(x
= rnd((int) ((rn2(4) ? 20 : 40) * mapfact
) / 100); x
; x
--) {
6318 /* not affected by timebasedlowerchance() */
6320 (void) mkobj_at(!rn2(25) ? GEM_CLASS
: RANDOM_CLASS
, mm
.x
, mm
.y
, TRUE
, FALSE
);
6324 for(x
= rnd((int) (12 * mapfact
) / 100); x
; x
--) {
6326 (void) mksobj_at(BOULDER
, mm
.x
, mm
.y
, TRUE
, FALSE
, FALSE
);
6329 for (x
= rn2(70); x
; x
--) {
6331 for (x
= rn2(20); x
; x
--) {
6335 const char *mesg
= random_engraving(buf
);
6336 make_engr_at(mm
.x
, mm
.y
, mesg
, 0L, (xchar
)0);
6338 for (x
= rn2(2); x
; x
--) { if (!(iszapem
&& !(u
.zapemescape
)) && !(u
.preversionmode
&& !u
.preversionescape
) && (depth(&u
.uz
) > depth(&medusa_level
))) {
6340 if (!ishomicider
) (void) makemon(minotaurvariant(), mm
.x
, mm
.y
, MM_MAYSLEEP
);
6341 else makerandomtrap_at(mm
.x
, mm
.y
, TRUE
);
6342 } /* cause they would be outta depth when mazes are generated at a shallow level --Amy */
6345 for(x
= rnd((int) ((rn2(2) ? 168 : rn2(4) ? 42 : 84) * mapfact
) / 100); x
; x
--) {
6347 for(x
= rnd((int) ((rn2(2) ? 48 : rn2(4) ? 12 : 24) * mapfact
) / 100); x
; x
--) {
6349 maze1xy(&mm
, WET
|DRY
);
6350 if (!ishomicider
) (void) makemon((struct permonst
*) 0, mm
.x
, mm
.y
, MM_MAYSLEEP
);
6351 else makerandomtrap_at(mm
.x
, mm
.y
, TRUE
);
6353 for(x
= rn2((int) (15 * mapfact
) / 100); x
; x
--) {
6355 (void) mkgold(0L,mm
.x
,mm
.y
);
6358 for(x
= rn2((int) ((!rn2(6) ? 210 : rn2(4) ? 52 : 105) * mapfact
) / 100); x
; x
--) {
6360 for(x
= rn2((int) ((!rn2(6) ? 60 : rn2(4) ? 15 : 30) * mapfact
) / 100); x
; x
--) {
6365 trytrap
= rndtrap();
6366 if (sobj_at(BOULDER
, mm
.x
, mm
.y
))
6367 while (trytrap
== PIT
|| trytrap
== SPIKED_PIT
|| trytrap
== GIANT_CHASM
|| trytrap
== SHIT_PIT
|| trytrap
== MANA_PIT
|| trytrap
== ANOXIC_PIT
|| trytrap
== HYPOXIC_PIT
|| trytrap
== ACID_PIT
|| trytrap
== SHAFT_TRAP
|| trytrap
== CURRENT_SHAFT
||
6368 trytrap
== TRAPDOOR
|| trytrap
== HOLE
)
6369 trytrap
= rndtrap();
6370 (void) maketrap(mm
.x
, mm
.y
, trytrap
, 100, TRUE
);
6375 for(x
= rnd((int) ((rn2(4) ? 30 : 60) * mapfact
) / 100); x
; x
--) {
6377 for(x
= rnd((int) ((rn2(4) ? 20 : 40) * mapfact
) / 100); x
; x
--) {
6379 if (timebasedlowerchance() || timebasedlowerchance() || timebasedlowerchance()) {
6381 (void) mkobj_at(!rn2(25) ? GEM_CLASS
: RANDOM_CLASS
, mm
.x
, mm
.y
, TRUE
, FALSE
);
6384 for(x
= rnd((int) (12 * mapfact
) / 100); x
; x
--) {
6386 (void) mksobj_at(BOULDER
, mm
.x
, mm
.y
, TRUE
, FALSE
, FALSE
);
6389 for (x
= rn2(70); x
; x
--) {
6391 for (x
= rn2(20); x
; x
--) {
6395 const char *mesg
= random_engraving(buf
);
6396 make_engr_at(mm
.x
, mm
.y
, mesg
, 0L, (xchar
)0);
6398 for (x
= rn2(2); x
; x
--) { if (!(iszapem
&& !(u
.zapemescape
)) && !(u
.preversionmode
&& !u
.preversionescape
) && (depth(&u
.uz
) > depth(&medusa_level
))) {
6400 if (!ishomicider
) (void) makemon(minotaurvariant(), mm
.x
, mm
.y
, MM_MAYSLEEP
);
6401 else makerandomtrap_at(mm
.x
, mm
.y
, TRUE
);
6402 } /* cause they would be outta depth when mazes are generated at a shallow level --Amy */
6405 for(x
= rnd((int) ((rn2(2) ? 168 : rn2(4) ? 42 : 84) * mapfact
) / 100); x
; x
--) {
6407 for(x
= rnd((int) ((rn2(2) ? 48 : rn2(4) ? 12 : 24) * mapfact
) / 100); x
; x
--) {
6409 maze1xy(&mm
, WET
|DRY
);
6410 if (!ishomicider
) (void) makemon((struct permonst
*) 0, mm
.x
, mm
.y
, MM_MAYSLEEP
);
6411 else makerandomtrap_at(mm
.x
, mm
.y
, TRUE
);
6413 for(x
= rn2((int) (15 * mapfact
) / 100); x
; x
--) {
6415 (void) mkgold(0L,mm
.x
,mm
.y
);
6418 for(x
= rn2((int) ((!rn2(6) ? 210 : rn2(4) ? 52 : 105) * mapfact
) / 100); x
; x
--) {
6420 for(x
= rn2((int) ((!rn2(6) ? 60 : rn2(4) ? 15 : 30) * mapfact
) / 100); x
; x
--) {
6425 trytrap
= rndtrap();
6426 if (sobj_at(BOULDER
, mm
.x
, mm
.y
))
6427 while (trytrap
== PIT
|| trytrap
== SPIKED_PIT
|| trytrap
== GIANT_CHASM
|| trytrap
== SHIT_PIT
|| trytrap
== MANA_PIT
|| trytrap
== ANOXIC_PIT
|| trytrap
== HYPOXIC_PIT
|| trytrap
== ACID_PIT
|| trytrap
== SHAFT_TRAP
|| trytrap
== CURRENT_SHAFT
||
6428 trytrap
== TRAPDOOR
|| trytrap
== HOLE
)
6429 trytrap
= rndtrap();
6430 (void) maketrap(mm
.x
, mm
.y
, trytrap
, 100, TRUE
);
6436 /* make rivers if possible --Amy */
6437 if (!rn2(50) && !In_endgame(&u
.uz
) ) mkrivers();
6438 if (!rn2(250) && !In_endgame(&u
.uz
) ) mkrivers();
6441 if (!rn2(50) && !In_endgame(&u
.uz
) ) mkrivers();
6442 if (!rn2(250) && !In_endgame(&u
.uz
) ) mkrivers();
6445 if (isaquarian
&& !In_endgame(&u
.uz
) && !Invocation_lev(&u
.uz
) ) mkrivers();
6446 if (RngeRivers
&& !In_endgame(&u
.uz
) && !Invocation_lev(&u
.uz
) ) mkrivers();
6448 if (Race_if(PM_HUNKAJUNK
) && !rn2(25) && depth(&u
.uz
) > 1 && !In_endgame(&u
.uz
) && !Invocation_lev(&u
.uz
) ) hunkajunkriver();
6449 if (Race_if(PM_HUNKAJUNK
) && depth(&u
.uz
) > 1 && !In_endgame(&u
.uz
) && !Invocation_lev(&u
.uz
) ) randhunkrivers();
6451 if (!rn2(50) && !In_endgame(&u
.uz
) && !Invocation_lev(&u
.uz
) ) mkrandrivers();
6452 if (!rn2(250) && !In_endgame(&u
.uz
) && !Invocation_lev(&u
.uz
) ) mkrandrivers();
6455 if (!rn2(50) && !In_endgame(&u
.uz
) && !Invocation_lev(&u
.uz
) ) mkrandrivers();
6456 if (!rn2(250) && !In_endgame(&u
.uz
) && !Invocation_lev(&u
.uz
) ) mkrandrivers();
6459 if (isaquarian
&& !In_endgame(&u
.uz
) && !Invocation_lev(&u
.uz
) ) mkrandrivers();
6460 if (RngeRivers
&& !In_endgame(&u
.uz
) && !Invocation_lev(&u
.uz
) ) mkrandrivers();
6462 if ((isroommate
|| !rn2(100)) && ((depth(&u
.uz
) > 1 && !(u
.preversionmode
&& In_greencross(&u
.uz
) && (dunlev(&u
.uz
) == 1)) && !(iszapem
&& In_spacebase(&u
.uz
) && (dunlev(&u
.uz
) == 1))) || !rn2(10)) && !Is_branchlev(&u
.uz
) && !In_endgame(&u
.uz
)) {
6467 while (!rn2(3)) mkroommateroom(0);
6473 /* chance to create Ludios portal, by Amy */
6474 if (In_dod(&u
.uz
)) {
6476 if (isok(mm
.x
, mm
.y
)) mk_knox_portal(mm
.x
, mm
.y
);
6491 boolean result
= FALSE
;
6493 struct version_info vers_info
;
6495 fd
= dlb_fopen_area(FILE_AREA_UNSHARE
, name
, RDBMODE
);
6496 if (!fd
) return FALSE
;
6498 Fread((void *) &vers_info
, sizeof vers_info
, 1, fd
);
6499 if (!check_version(&vers_info
, name
, TRUE
))
6502 Fread((void *) &c
, sizeof c
, 1, fd
); /* c Header */
6506 result
= load_rooms(fd
);
6509 result
= load_maze(fd
);
6515 (void)dlb_fclose(fd
);