示例#1
0
/*
	*******
	OSCROLL
	*******

	function to process a magic scroll
 */
void oscroll(int typ)
{
	lprcat("\nDo you ");
	if (c[BLINDCOUNT]==0) 
		lprcat("(r) read it, "); 
	lprcat("(t) take it"); 
	iopts();
	while (1) switch(getcharacter()) {
	case ESC:
	case 'i':	
		ignore();  
		return;

	case 'r':	
		if (c[BLINDCOUNT]) break;
		lprcat("read.");
		forget();
		if (typ==2 || typ==15)  { 
			show1cell(playerx,playery); 
			cursors(); 
		}
		/*	destroy it	*/	
		read_scroll(typ);  
		return;

	case 't':	
		lprcat("take.");
		if (take(OSCROLL,typ)==0)
			forget();	/*	destroy it	*/
		return;
	};
}
示例#2
0
/*
*  mmove(x,y,xd,yd)    Function to actually perform the monster movement
*      int x,y,xd,yd;
*
*  Enter with the from coordinates in (x,y) and the destination coordinates
*  in (xd,yd).
*/
static void mmove(int aa, int bb, int cc, int dd)
{
	int tmp,i,flag;
	char *who = "";
	char *p = "";

	flag=0; /* set to 1 if monster hit by arrow trap */
	if ((cc==playerx) && (dd==playery))
	{
		hitplayer(aa,bb);
		return;
	}
	i=item[cc][dd];
	if ((i==OPIT) || (i==OTRAPDOOR))
		switch(mitem[aa][bb])
	{
		case BAT:           case EYE:
		case SPIRITNAGA:    case PLATINUMDRAGON:    case WRAITH:
		case VAMPIRE:       case SILVERDRAGON:      case POLTERGEIST:
		case DEMONLORD:     case DEMONLORD+1:       case DEMONLORD+2:
		case DEMONLORD+3:   case DEMONLORD+4:       case DEMONLORD+5:
		case DEMONLORD+6:   case DEMONPRINCE:   break;

		default:    mitem[aa][bb]=0; /* fell in a pit or trapdoor */
	};
	tmp = mitem[aa][bb];
	mitem[cc][dd] = tmp;
	if (i==OANNIHILATION)
	{
		if (tmp>=DEMONLORD+3) /* demons dispel spheres */
		{
			cursors();
			lprintf("\nThe %s dispels the sphere!",monster[tmp].name);
			rmsphere(cc,dd);    /* delete the sphere */
		}
		else mitem[cc][dd]=i=tmp=0;
	}
	stealth[cc][dd]=1;
	if ((hitp[cc][dd] = hitp[aa][bb]) < 0) hitp[cc][dd]=1;
	mitem[aa][bb] = 0;              
	if (tmp == LEPRECHAUN)
		switch(i)
	{
		case OGOLDPILE:  case OMAXGOLD:  case OKGOLD:  case ODGOLD:
		case ODIAMOND:   case ORUBY:     case OEMERALD: case OSAPPHIRE:
			item[cc][dd] = 0; /* leprechaun takes gold */
	};

	if (tmp == TROLL)  /* if a troll regenerate him */
		if ((gtime & 1) == 0)
			if (monster[tmp].hitpoints > hitp[cc][dd])  hitp[cc][dd]++;

	if (i==OTRAPARROW)  /* arrow hits monster */
	{ who = "An arrow";  if ((hitp[cc][dd] -= rnd(10)+level) <= 0)
	{ mitem[cc][dd]=0;  flag=2; } else flag=1; }
	if (i==ODARTRAP)    /* dart hits monster */
	{ who = "A dart";  if ((hitp[cc][dd] -= rnd(6)) <= 0)
	{ mitem[cc][dd]=0;  flag=2; } else flag=1; }
	if (i==OTELEPORTER) /* monster hits teleport trap */
	{ flag=3; fillmonst(mitem[cc][dd]);  mitem[cc][dd]=0; }
	if (cdesc[BLINDCOUNT]) return;  /* if blind don't show where monsters are   */
	if (know[cc][dd] & HAVESEEN)
	{
		p=0;
		if (flag) cursors();
		switch(flag)
		{
		case 1: p="\n%s hits the %s";  break;
		case 2: p="\n%s hits and kills the %s";  break;
		case 3: p="\nThe %s%s gets teleported"; who="";  break;
		};
		if (p) { lprintf(p,who,monster[tmp].name); }
	}
	/*  if (yrepcount>1) { know[aa][bb] &= 2;  know[cc][dd] &= 2; return; } */
	if (know[aa][bb] & HAVESEEN)   show1cell(aa,bb);
	if (know[cc][dd] & HAVESEEN)   show1cell(cc,dd);
}
示例#3
0
/*
	function to drink a potion
 */
void quaffpotion(int pot)
{
	int i,j;
	int k;

	if (pot<0 || pot>=MAXPOTION) 
		return; /* check for within bounds */

/* first character of potion name starts off as \0. */
/* drinking a certain type of potion changes that to a space */
/* ...and from then on it is printable.  */
/*	if (potionname[pot][0] == '\0')   */
/*		potionname[pot][0] = ' '; */
	if (potionknown[pot] == 0) 
	  potionknown[pot] = 1;
	lprintf("\nYou drink a potion of %s.", &potionname[pot][1]);

	switch(pot) {
	case PSLEEP:
		lprcat("  You fall asleep...");
		lflush();
		i=rnd(11)-(c[CONSTITUTION]>>2)+2;
		while(--i>0) {
			parse2();
			nap(1000);
		}
		cursors();
		lprcat("\n.. you wake up.");
		return;

	case PHEALING:
		lprcat("  You feel better.");
		if (c[HP] == c[HPMAX])
			raisemhp(1);
		else if ((c[HP] += rnd(20)+20+c[LEVEL]) > c[HPMAX])
			c[HP]=c[HPMAX];
		break;

	case PRAISELEVEL:
		lprcat("  You feel much more skillful!");
		raiselevel();
		raisemhp(1);
		return;

	case PINCABILITY:
		lprcat("  You feel strange for a moment.");
		c[rund(6)]++;
		break;

	case PWISDOM:
		lprcat("  You feel more self-confident!");
		c[WISDOM] += rnd(2);
		break;

	case PSTRENGTH:
		lprcat("  Wow!  You feel great!");
		if (c[STRENGTH]<12) c[STRENGTH]=12;
		else c[STRENGTH]++;
		break;

	case PCHARISMA:
		lprcat("  You feel charismatic!");
		c[CHARISMA]++;
		break;

	case PDIZZINESS:
		lprcat("  You become dizzy!");
		if (--c[STRENGTH] < 3) c[STRENGTH]=3;
		break;

	case PLEARNING:
		lprcat("  You feel clever!");
		c[INTELLIGENCE]++;
		break;

	case PGOLDDET:
		lprcat("  You feel greedy...");
		lflush();
		nap(2000);
		for (i=0; i<MAXY; i++)  for (j=0; j<MAXX; j++)
			if ((item[j][i]==OGOLDPILE) || (item[j][i]==OMAXGOLD)) {
				know[j][i]=1; 
				show1cell(j,i);
			}
		showplayer();
		return;

	case PMONSTDET:
		for (i=0; i<MAXY; i++)  for (j=0; j<MAXX; j++)
			if (mitem[j][i].mon) {
				know[j][i]=1; 
				show1cell(j,i);
			}
		return;

	case PFORGETFUL:
		lprcat("  You stagger for a moment...");
		lflush();
		for (i=0; i<MAXY; i++)  for (j=0; j<MAXX; j++)
			know[j][i]=0;
		nap(2000);	
		draws(0,MAXX,0,MAXY);
		return;

	case PWATER:
		return;

	case PBLINDNESS:
		lprcat("  You can't see anything!"); 
		c[BLINDCOUNT]+=500;  /* dang, that's a long time. */
		/* erase the character, too! */
		cursor(playerx+1,playery+1);
		lprc(' ');
		cursor(playerx+1,playery+1);
		return;

	case PCONFUSION:
		lprcat("  You feel confused.");
		c[CONFUSE]+= 20+rnd(9); 
		return;

	case PHEROISM:
		lprcat("  WOW!  You feel fantastic!");
		if (c[HERO]==0) for (i=0; i<6; i++) c[i] += 11;
		c[HERO] += 250;  
		break;

	case PSTURDINESS:
		lprcat("  You feel healthier!");
		c[CONSTITUTION]++;  
		break;

	case PGIANTSTR:
		lprcat("  You now have incredible bulging muscles!");
		if (c[GIANTSTR]==0) c[STREXTRA] += 21;
		c[GIANTSTR] += 700;  
		break;

	case PFIRERESIST:
		lprcat("  You feel a chill run up your spine!");
		c[FIRERESISTANCE] += 1000;  
		break;

	case PTREASURE:
		lprcat("  You feel greedy...");
		lflush();
		nap(2000);
		for (i=0; i<MAXY; i++)  for (j=0; j<MAXX; j++) {
			k=item[j][i];
			if ((k==ODIAMOND) || (k==ORUBY) || (k==OEMERALD) 
		 	    || (k==OMAXGOLD) || (k==OSAPPHIRE) 
			    || (k==OLARNEYE) || (k==OGOLDPILE)) {
				know[j][i]=1; 
				show1cell(j,i);
			}
		}
		showplayer();  
		return;

	case PINSTHEAL:
		c[HP] = c[HPMAX]; 
		removecurse();
		break;

	case PCUREDIANTH:
		lprcat("  You don't seem to be affected.");
		return;

	case PPOISON:
		lprcat("  You feel a sickness engulf you!");
		c[HALFDAM] += 200 + rnd(200);  
		return;

	case PSEEINVIS:
		lprcat("  You feel your vision sharpen.");
		c[SEEINVISIBLE] += rnd(1000)+400;
		monstnamelist[INVISIBLESTALKER] = 'I';  
		return;
	};
	/*	show new stats		*/
	bottomline();		
	return;
}