Source:NetHack 1.4f/sit.c

Below is the full text to sit.c from the source code of NetHack 1.4f. To link to a particular line, write [[NetHack 1.4f/sit.c#line123 ]], for example.

Warning! This is the source code from an old release. For the latest release, see Source code

1.   /*	SCCS Id: @(#)sit.c	1.4	87/08/08 2.   /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ 3.    /* sit.c - version 1.0 */ 4.    5.    #include "hack.h"  6. 7.   #ifdef NEWCLASS 8.   int	identify; 9.    10.   dosit { 11.  	extern struct obj *readobjnam, *addinv; 12.  	register struct	obj	*otmp; 13.  	struct	 obj	*sobj_at; 14.  	register int	cnt; 15.   16.   	char	buf[BUFSZ]; 17.   18.   	if(Levitation)  { 19.   20.   		pline("You are floating in the air, you can't sit!"); 21.  	} else	if(IS_THRONE(levl[u.ux][u.uy].typ)) { 22.   23.   		pline("As you sit in the opulant throne"); 24.  		if (rnd(6) > 4)  { 25.   26.   			switch (rnd(13))  { 27.   28.   			    case 1: 29.  				pline("you feel suddenly weaker."); 30.  				if(Poison_resistance) { 31.   32.   				    losestr(rn1(1,2)); 33.  				    losehp(rnd(6), "cursed throne"); 34.  				} else { 35.   36.   				    losestr(rn1(4,3)); 37.  				    losehp(rnd(10), "cursed throne"); 38.  				}  39.   				break; 40.  			    case 2: 41.  				pline("you feel suddenly stronger."); 42.  				gainstr(0); 43.  				break; 44.  			    case 3: 45.  				pline("A massive charge of electricity shoots through your body!"); 46.  				losehp(rnd(30), "electric chair"); 47.  				break; 48.  			    case 4: 49.  				pline("you feel much, much better!"); 50.  				if(u.uhp >= (u.uhpmax - 5))  u.uhpmax += 4; 51.  				u.uhp = u.uhpmax; 52.  				if (Blind) Blind = 1; 53.  				if (Sick)  Sick = 0; 54.  				heal_legs; 55.  				flags.botl = 1; 56.  				break; 57.  			    case 5: 58.  				if (u.ugold <= 0)  { 59.   60.   					pline("you feel a strange sensation."); 61.  				} else { 62.  					pline("you notice you have no gold!"); 63.  					u.ugold = 0; 64.  					flags.botl = 1; 65.  				}  66.   				break; 67.  			    case 6: 68.  				if(u.uluck + rn2(5) < 0) { 69.   70.   				    pline("you feel your luck is changing."); 71.  				    u.uluck++; 72.  				} else	    makewish; 73.  				break; 74.  			    case 7: 75.  				cnt = rnd(10); 76.  				pline("you hear a voice echo:"); 77.  				pline("Your audience has been summoned, Sire!"); 78.  				while(cnt--) 79.  				    (void) makemon(courtmon, u.ux, u.uy); 80.  				break; 81.  			    case 8: 82.  				if (Confusion != 0)  { 83.   84.   				    pline("you hear a voice echo:"); 85.  				    pline("By your Imperious order Sire..."); 86.  				}  87.   				do_genocide; 88.  				break; 89.  			    case 9: 90.  				pline("you hear a voice echo:"); 91.  				pline("A curse upon you for sitting upon this most holy throne!"); 92.  				if (u.uluck > 0)  { 93.   94.   				    if(!Blind)	pline("a cloud of darkness falls upon you."); 95.  				    Blind += rn1(100,250); 96.  				    seeoff(0); 97.  				} else	    rndcurse; 98.  				break; 99.  			    case 10: 100. 				if (u.uluck < 0)  { 101.  102.  					pline("an image forms in your mind."); 103. 					do_mapping; 104. 				} else  { 105.  106.  					pline("your vision clarifies."); 107. 					HSee_invisible |= INTRINSIC; 108. 				}  109.  				break; 110. 			    case 11: 111. 				if (u.uluck < 0)  { 112.  113.  				    pline("you feel threatened."); 114. 				    aggravate; 115. 				} else  { 116.  117.  				    pline("you feel a wrenching sensation."); 118. 				    tele;		/* teleport him */ 119. 				}  120.  				break; 121. 			    case 12: 122. 				pline("you are granted a gift of insight!"); 123. 				while (!ggetobj("identify", identify, rn2(5))  124.  					&& invent); 125. 				break; 126. 			    case 13: 127. 				pline("your mind turns into a pretzel!"); 128. 				HConfusion += rn1(7,16); 129. 				break; 130. 			    default:	impossible("throne effect"); 131. 					break; 132. 			}  133.  		} else	pline("you feel somehow out of place..."); 134.  135.  		if (!rn2(3) && IS_THRONE(levl[u.ux][u.uy].typ))	{ 136.  137.  			pline("The throne vanishes in a puff of logic."); 138. /*			levl[u.ux][u.uy].scrsym = ROOM_SYM; */ 139. 			levl[u.ux][u.uy].typ = ROOM; 140. 		}  141.   142.  	} else	pline("Having fun sitting on the floor???"); 143. 	return(1); 144. }  145.  #endif /* NEWCLASS /**/ 146.  147.  #if defined(NEWCLASS) || defined(PRAYERS) || defined(HARD) 148. rndcurse {			/* curse a few inventory items at random! */ 149.   150.  	int	nobj = 0; 151. 	int	cnt, onum; 152. 	struct	obj	*otmp; 153.  154.  	for (otmp = invent; otmp; otmp = otmp->nobj)  nobj++; 155. 	    for (cnt = rnd(6); cnt > 0; cnt--)  { 156.  157.  		onum = rn2(nobj); 158. 		for(otmp = invent; onum != 0; onum--) 159. 		    otmp = otmp->nobj; 160.  161.  			otmp->cursed++; 162. 	    }  163.  }  164.  #endif