pc-hack

PC HACK 3.61 source code (archival)
git clone http://frotz.net/git/pc-hack.git
Log | Files | Refs

zap.c (15036B)


      1 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
      2 /* zap.c - version 1.0.3 */
      3 
      4 #include "hack.h"
      5 
      6 extern struct obj *mkobj_at();
      7 extern struct monst *makemon(), *mkmon_at(), youmonst;
      8 struct monst *bhit();
      9 char *exclam();
     10 
     11 char *fl[]= {
     12 	"magic missile",
     13 	"bolt of fire",
     14 	"sleep ray",
     15 	"bolt of cold",
     16 	"death ray"
     17 };
     18 
     19 /* Routines for IMMEDIATE wands. */
     20 /* bhitm: monster mtmp was hit by the effect of wand otmp */
     21 bhitm(mtmp, otmp)
     22 register struct monst *mtmp;
     23 register struct obj *otmp;
     24 {
     25 	wakeup(mtmp);
     26 	switch(otmp->otyp) {
     27 	case WAN_STRIKING:
     28 		if(u.uswallow || rnd(20) < 10+mtmp->data->ac) {
     29 			register int tmp = d(2,12);
     30 			hit("wand", mtmp, exclam(tmp));
     31 			mtmp->mhp -= tmp;
     32 			if(mtmp->mhp < 1) killed(mtmp);
     33 		} else miss("wand", mtmp);
     34 		break;
     35 	case WAN_SLOW_MONSTER:
     36 		mtmp->mspeed = MSLOW;
     37 		break;
     38 	case WAN_SPEED_MONSTER:
     39 		mtmp->mspeed = MFAST;
     40 		break;
     41 	case WAN_UNDEAD_TURNING:
     42 		if(index(UNDEAD,mtmp->data->mlet)) {
     43 			mtmp->mhp -= rnd(8);
     44 			if(mtmp->mhp < 1) killed(mtmp);
     45 			else mtmp->mflee = 1;
     46 		}
     47 		break;
     48 	case WAN_POLYMORPH:
     49 		if( newcham(mtmp,&mons[rn2(CMNUM)]) )
     50 			objects[otmp->otyp].oc_name_known = 1;
     51 		break;
     52 	case WAN_CANCELLATION:
     53 		mtmp->mcan = 1;
     54 		break;
     55 	case WAN_TELEPORTATION:
     56 		rloc(mtmp);
     57 		break;
     58 	case WAN_MAKE_INVISIBLE:
     59 		mtmp->minvis = 1;
     60 		break;
     61 #ifdef WAN_PROBING
     62 	case WAN_PROBING:
     63 		mstatusline(mtmp);
     64 		break;
     65 #endif
     66 	default:
     67 		impossible("What an interesting wand (%u)", otmp->otyp);
     68 	}
     69 }
     70 
     71 bhito(obj, otmp)	/* object obj was hit by the effect of wand otmp */
     72 register struct obj *obj, *otmp;	/* returns TRUE if sth was done */
     73 {
     74 	register int res = TRUE;
     75 #ifdef DGK
     76 	struct obj *otmp2;
     77 #endif
     78 
     79 	if(obj == uball || obj == uchain)
     80 		res = FALSE;
     81 	else
     82 	switch(otmp->otyp) {
     83 	case WAN_POLYMORPH:
     84 		/* preserve symbol and quantity, but turn rocks into gems */
     85 #ifdef DGK
     86 		otmp2 = mkobj_at((obj->otyp == ROCK
     87 			|| obj->otyp == ENORMOUS_ROCK) ? GEM_SYM : obj->olet,
     88 			obj->ox, obj->oy);
     89 		otmp2->quan = obj->quan;
     90 		/* keep special fields (including charges on wands) */
     91 		otmp2->spe = min(obj->spe, otmp2->spe);
     92 		otmp2->cursed = otmp->cursed;
     93 		/* update the weight */
     94 		otmp2->owt = weight(otmp2);
     95 #else
     96 		mkobj_at((obj->otyp == ROCK || obj->otyp == ENORMOUS_ROCK)
     97 			? GEM_SYM : obj->olet,
     98 			obj->ox, obj->oy) -> quan = obj->quan;
     99 #endif
    100 		delobj(obj);
    101 		break;
    102 	case WAN_STRIKING:
    103 		if(obj->otyp == ENORMOUS_ROCK)
    104 			fracture_rock(obj);
    105 		else
    106 			res = FALSE;
    107 		break;
    108 	case WAN_CANCELLATION:
    109 		if(obj->spe && obj->olet != AMULET_SYM) {
    110 			obj->known = 0;
    111 			obj->spe = 0;
    112 		}
    113 		break;
    114 	case WAN_TELEPORTATION:
    115 		rloco(obj);
    116 		break;
    117 	case WAN_MAKE_INVISIBLE:
    118 		obj->oinvis = 1;
    119 		break;
    120 	case WAN_UNDEAD_TURNING:
    121 		res = revive(obj);
    122 		break;
    123 	case WAN_SLOW_MONSTER:		/* no effect on objects */
    124 	case WAN_SPEED_MONSTER:
    125 #ifdef WAN_PROBING
    126 	case WAN_PROBING:
    127 #endif
    128 		res = FALSE;
    129 		break;
    130 	default:
    131 		impossible("What an interesting wand (%u)", otmp->otyp);
    132 	}
    133 	return(res);
    134 }
    135 
    136 dozap()
    137 {
    138 	register struct obj *obj;
    139 	xchar zx,zy;
    140 
    141 	obj = getobj("/", "zap");
    142 	if(!obj) return(0);
    143 	if(obj->spe < 0 || (obj->spe == 0 && rn2(121))) {
    144 		pline("Nothing Happens.");
    145 		return(1);
    146 	}
    147 	if(obj->spe == 0)
    148 		pline("You wrest one more spell from the worn-out wand.");
    149 	if(!(objects[obj->otyp].bits & NODIR) && !getdir(1))
    150 		return(1);	/* make him pay for knowing !NODIR */
    151 	obj->spe--;
    152 	if(objects[obj->otyp].bits & IMMEDIATE) {
    153 		if(u.uswallow)
    154 			bhitm(u.ustuck, obj);
    155 		else if(u.dz) {
    156 			if(u.dz > 0) {
    157 				register struct obj *otmp = o_at(u.ux, u.uy);
    158 				if(otmp)
    159 					(void) bhito(otmp, obj);
    160 			}
    161 		} else
    162 			(void) bhit(u.dx,u.dy,rn1(8,6),0,bhitm,bhito,obj);
    163 	} else {
    164 	    switch(obj->otyp){
    165 		case WAN_LIGHT:
    166 			litroom(TRUE);
    167 			break;
    168 		case WAN_SECRET_DOOR_DETECTION:
    169 			if(!findit()) return(1);
    170 			break;
    171 		case WAN_CREATE_MONSTER:
    172 			{ register int cnt = 1;
    173 			if(!rn2(23)) cnt += rn2(7) + 1;
    174 			while(cnt--)
    175 			    (void) makemon((struct permonst *) 0, u.ux, u.uy);
    176 			}
    177 			break;
    178 		case WAN_WISHING:
    179 			{ char buf[BUFSZ];
    180 			  register struct obj *otmp;
    181 			  extern struct obj *readobjnam(), *addinv();
    182 		      if(u.uluck + rn2(5) < 0) {
    183 			pline("Unfortunately, nothing happens.");
    184 			break;
    185 		      }
    186 		      pline("You may wish for an object. What do you want? ");
    187 		      getlin(buf);
    188 		      if(buf[0] == '\033') buf[0] = 0;
    189 		      otmp = readobjnam(buf);
    190 		      otmp = addinv(otmp);
    191 		      prinv(otmp);
    192 		      break;
    193 			}
    194 		case WAN_DIGGING:
    195 			/* Original effect (approximately):
    196 			 * from CORR: dig until we pierce a wall
    197 			 * from ROOM: piece wall and dig until we reach
    198 			 * an ACCESSIBLE place.
    199 			 * Currently: dig for digdepth positions;
    200 			 * also down on request of Lennart Augustsson.
    201 			 */
    202 			{ register struct rm *room;
    203 			  register int digdepth;
    204 			if(u.uswallow) {
    205 				register struct monst *mtmp = u.ustuck;
    206 
    207 				pline("You pierce %s's stomach wall!",
    208 					monnam(mtmp));
    209 				mtmp->mhp = 1;	/* almost dead */
    210 				unstuck(mtmp);
    211 				mnexto(mtmp);
    212 				break;
    213 			}
    214 			if(u.dz) {
    215 			    if(u.dz < 0) {
    216 				pline("You loosen a rock from the ceiling.");
    217 				pline("It falls on your head!");
    218 				losehp(1, "falling rock");
    219 				mksobj_at(ROCK, u.ux, u.uy);
    220 				fobj->quan = 1;
    221 				stackobj(fobj);
    222 				if(Invisible) newsym(u.ux, u.uy);
    223 			    } else {
    224 				dighole();
    225 			    }
    226 			    break;
    227 			}
    228 			zx = u.ux+u.dx;
    229 			zy = u.uy+u.dy;
    230 			digdepth = 8 + rn2(18);
    231 			Tmp_at(-1, '*');	/* open call */
    232 			while(--digdepth >= 0) {
    233 				if(!isok(zx,zy)) break;
    234 				room = &levl[zx][zy];
    235 				Tmp_at(zx,zy);
    236 				if(!xdnstair){
    237 					if(zx < 3 || zx > COLNO-3 ||
    238 					    zy < 3 || zy > ROWNO-3)
    239 						break;
    240 					if(room->typ == HWALL ||
    241 					    room->typ == VWALL){
    242 						room->typ = ROOM;
    243 						break;
    244 					}
    245 				} else
    246 				if(room->typ == HWALL || room->typ == VWALL ||
    247 				   room->typ == SDOOR || room->typ == LDOOR){
    248 					room->typ = DOOR;
    249 					digdepth -= 2;
    250 				} else
    251 				if(room->typ == SCORR || !room->typ) {
    252 					room->typ = CORR;
    253 					digdepth--;
    254 				}
    255 				mnewsym(zx,zy);
    256 				zx += u.dx;
    257 				zy += u.dy;
    258 			}
    259 			mnewsym(zx,zy);	/* not always necessary */
    260 			Tmp_at(-1,-1);	/* closing call */
    261 			break;
    262 			}
    263 		default:
    264 			buzz((int) obj->otyp - WAN_MAGIC_MISSILE,
    265 				u.ux, u.uy, u.dx, u.dy);
    266 			break;
    267 		}
    268 		if(!objects[obj->otyp].oc_name_known) {
    269 			objects[obj->otyp].oc_name_known = 1;
    270 			more_experienced(0,10);
    271 		}
    272 	}
    273 	return(1);
    274 }
    275 
    276 char *
    277 exclam(force)
    278 register int force;
    279 {
    280 	/* force == 0 occurs e.g. with sleep ray */
    281 	/* note that large force is usual with wands so that !! would
    282 		require information about hand/weapon/wand */
    283 	return( (force < 0) ? "?" : (force <= 4) ? "." : "!" );
    284 }
    285 
    286 hit(str,mtmp,force)
    287 register char *str;
    288 register struct monst *mtmp;
    289 register char *force;		/* usually either "." or "!" */
    290 {
    291 	if(!cansee(mtmp->mx,mtmp->my)) pline("The %s hits it.", str);
    292 	else pline("The %s hits %s%s", str, monnam(mtmp), force);
    293 }
    294 
    295 miss(str,mtmp)
    296 register char *str;
    297 register struct monst *mtmp;
    298 {
    299 	if(!cansee(mtmp->mx,mtmp->my)) pline("The %s misses it.",str);
    300 	else pline("The %s misses %s.",str,monnam(mtmp));
    301 }
    302 
    303 /* bhit: called when a weapon is thrown (sym = obj->olet) or when an
    304    IMMEDIATE wand is zapped (sym = 0); the weapon falls down at end of
    305    range or when a monster is hit; the monster is returned, and bhitpos
    306    is set to the final position of the weapon thrown; the ray of a wand
    307    may affect several objects and monsters on its path - for each of
    308    these an argument function is called. */
    309 /* check !u.uswallow before calling bhit() */
    310 
    311 struct monst *
    312 bhit(ddx,ddy,range,sym,fhitm,fhito,obj)
    313 register int ddx,ddy,range;		/* direction and range */
    314 char sym;				/* symbol displayed on path */
    315 int (*fhitm)(), (*fhito)();		/* fns called when mon/obj hit */
    316 struct obj *obj;			/* 2nd arg to fhitm/fhito */
    317 {
    318 	register struct monst *mtmp;
    319 	register struct obj *otmp;
    320 	register int typ;
    321 
    322 	bhitpos.x = u.ux;
    323 	bhitpos.y = u.uy;
    324 
    325 	if(sym) tmp_at(-1, sym);	/* open call */
    326 	while(range-- > 0) {
    327 		bhitpos.x += ddx;
    328 		bhitpos.y += ddy;
    329 		typ = levl[bhitpos.x][bhitpos.y].typ;
    330 		if(mtmp = m_at(bhitpos.x,bhitpos.y)){
    331 			if(sym) {
    332 				tmp_at(-1, -1);	/* close call */
    333 				return(mtmp);
    334 			}
    335 			(*fhitm)(mtmp, obj);
    336 			range -= 3;
    337 		}
    338 		if(fhito && (otmp = o_at(bhitpos.x,bhitpos.y))){
    339 			if((*fhito)(otmp, obj))
    340 				range--;
    341 		}
    342 		if(!ZAP_POS(typ)) {
    343 			bhitpos.x -= ddx;
    344 			bhitpos.y -= ddy;
    345 			break;
    346 		}
    347 		if(sym) tmp_at(bhitpos.x, bhitpos.y);
    348 	}
    349 
    350 	/* leave last symbol unless in a pool */
    351 	if(sym)
    352 	   tmp_at(-1, (levl[bhitpos.x][bhitpos.y].typ == POOL) ? -1 : 0);
    353 	return(0);
    354 }
    355 
    356 struct monst *
    357 boomhit(dx,dy) {
    358 	register int i, ct;
    359 	register struct monst *mtmp;
    360 	char sym = ')';
    361 	extern schar xdir[], ydir[];
    362 
    363 	bhitpos.x = u.ux;
    364 	bhitpos.y = u.uy;
    365 
    366 	for(i=0; i<8; i++) if(xdir[i] == dx && ydir[i] == dy) break;
    367 	tmp_at(-1, sym);	/* open call */
    368 	for(ct=0; ct<10; ct++) {
    369 		if(i == 8) i = 0;
    370 		sym = ')' + '(' - sym;
    371 		tmp_at(-2, sym);	/* change let call */
    372 		dx = xdir[i];
    373 		dy = ydir[i];
    374 		bhitpos.x += dx;
    375 		bhitpos.y += dy;
    376 		if(mtmp = m_at(bhitpos.x, bhitpos.y)){
    377 			tmp_at(-1,-1);
    378 			return(mtmp);
    379 		}
    380 		if(!ZAP_POS(levl[bhitpos.x][bhitpos.y].typ)) {
    381 			bhitpos.x -= dx;
    382 			bhitpos.y -= dy;
    383 			break;
    384 		}
    385 		if(bhitpos.x == u.ux && bhitpos.y == u.uy) { /* ct == 9 */
    386 			if(rn2(20) >= 10+u.ulevel){	/* we hit ourselves */
    387 				(void) thitu(10, rnd(10), "boomerang");
    388 				break;
    389 			} else {	/* we catch it */
    390 				tmp_at(-1,-1);
    391 				pline("Skillfully, you catch the boomerang.");
    392 				return(&youmonst);
    393 			}
    394 		}
    395 		tmp_at(bhitpos.x, bhitpos.y);
    396 		if(ct % 5 != 0) i++;
    397 	}
    398 	tmp_at(-1, -1);	/* do not leave last symbol */
    399 	return(0);
    400 }
    401 
    402 char
    403 dirlet(dx,dy) register dx,dy; {
    404 	return
    405 		(dx == dy) ? '\\' : (dx && dy) ? '/' : dx ? '-' : '|';
    406 }
    407 
    408 /* type == -1: monster spitting fire at you */
    409 /* type == -1,-2,-3: bolts sent out by wizard */
    410 /* called with dx = dy = 0 with vertical bolts */
    411 buzz(type,sx,sy,dx,dy)
    412 register int type;
    413 register xchar sx,sy;
    414 register int dx,dy;
    415 {
    416 	int abstype = abs(type);
    417 	register char *fltxt = (type == -1) ? "blaze of fire" : fl[abstype];
    418 	struct rm *lev;
    419 	xchar range;
    420 	struct monst *mon;
    421 
    422 	if(u.uswallow) {
    423 		register int tmp;
    424 
    425 		if(type < 0) return;
    426 		tmp = zhit(u.ustuck, type);
    427 		pline("The %s rips into %s%s",
    428 			fltxt, monnam(u.ustuck), exclam(tmp));
    429 		return;
    430 	}
    431 	if(type < 0) pru();
    432 	range = rn1(7,7);
    433 	Tmp_at(-1, dirlet(dx,dy));	/* open call */
    434 	while(range-- > 0) {
    435 		sx += dx;
    436 		sy += dy;
    437 		if((lev = &levl[sx][sy])->typ) Tmp_at(sx,sy);
    438 		else {
    439 			int bounce = 0;
    440 			if(cansee(sx-dx,sy-dy))
    441 				pline("The %s bounces!", fltxt);
    442 			if(ZAP_POS(levl[sx][sy-dy].typ))
    443 				bounce = 1;
    444 			if(ZAP_POS(levl[sx-dx][sy].typ)) {
    445 				if(!bounce || rn2(2)) bounce = 2;
    446 			}
    447 			switch(bounce){
    448 			case 0:
    449 				dx = -dx;
    450 				dy = -dy;
    451 				continue;
    452 			case 1:
    453 				dy = -dy;
    454 				sx -= dx;
    455 				break;
    456 			case 2:
    457 				dx = -dx;
    458 				sy -= dy;
    459 				break;
    460 			}
    461 			Tmp_at(-2,dirlet(dx,dy));
    462 			continue;
    463 		}
    464 		if(lev->typ == POOL && abstype == 1 /* fire */) {
    465 			range -= 3;
    466 			lev->typ = ROOM;
    467 			if(cansee(sx,sy)) {
    468 				mnewsym(sx,sy);
    469 				pline("The water evaporates.");
    470 			} else
    471 				pline("You hear a hissing sound.");
    472 		}
    473 		if((mon = m_at(sx,sy)) &&
    474 		   (type != -1 || mon->data->mlet != 'D')) {
    475 			wakeup(mon);
    476 			if(rnd(20) < 18 + mon->data->ac) {
    477 				register int tmp = zhit(mon,abstype);
    478 				if(mon->mhp < 1) {
    479 					if(type < 0) {
    480 					    if(cansee(mon->mx,mon->my))
    481 					      pline("%s is killed by the %s!",
    482 						Monnam(mon), fltxt);
    483 					    mondied(mon);
    484 					} else
    485 					    killed(mon);
    486 				} else
    487 					hit(fltxt, mon, exclam(tmp));
    488 				range -= 2;
    489 			} else
    490 				miss(fltxt,mon);
    491 		} else if(sx == u.ux && sy == u.uy) {
    492 			nomul(0);
    493 			if(rnd(20) < 18+u.uac) {
    494 				register int dam = 0;
    495 				range -= 2;
    496 				pline("The %s hits you!",fltxt);
    497 				switch(abstype) {
    498 				case 0:
    499 					dam = d(2,6);
    500 					break;
    501 				case 1:
    502 					if(Fire_resistance)
    503 						pline("You don't feel hot!");
    504 					else dam = d(6,6);
    505 					if(!rn2(3))
    506 						burn_scrolls();
    507 					break;
    508 				case 2:
    509 					nomul(-rnd(25)); /* sleep ray */
    510 					break;
    511 				case 3:
    512 					if(Cold_resistance)
    513 						pline("You don't feel cold!");
    514 					else dam = d(6,6);
    515 					break;
    516 				case 4:
    517 					u.uhp = -1;
    518 				}
    519 				losehp(dam,fltxt);
    520 			} else pline("The %s whizzes by you!",fltxt);
    521 			stop_occupation();
    522 		}
    523 		if(!ZAP_POS(lev->typ)) {
    524 			int bounce = 0, rmn;
    525 			if(cansee(sx,sy)) pline("The %s bounces!",fltxt);
    526 			range--;
    527 			if(!dx || !dy || !rn2(20)){
    528 				dx = -dx;
    529 				dy = -dy;
    530 			} else {
    531 			  if(ZAP_POS(rmn = levl[sx][sy-dy].typ) &&
    532 			    (IS_ROOM(rmn) || ZAP_POS(levl[sx+dx][sy-dy].typ)))
    533 				bounce = 1;
    534 			  if(ZAP_POS(rmn = levl[sx-dx][sy].typ) &&
    535 			    (IS_ROOM(rmn) || ZAP_POS(levl[sx-dx][sy+dy].typ)))
    536 				if(!bounce || rn2(2))
    537 					bounce = 2;
    538 
    539 			  switch(bounce){
    540 			  case 0:
    541 				dy = -dy;
    542 				dx = -dx;
    543 				break;
    544 			  case 1:
    545 				dy = -dy;
    546 				break;
    547 			  case 2:
    548 				dx = -dx;
    549 				break;
    550 			  }
    551 			  Tmp_at(-2, dirlet(dx,dy));
    552 			}
    553 		}
    554 	}
    555 	Tmp_at(-1,-1);
    556 }
    557 
    558 zhit(mon,type)			/* returns damage to mon */
    559 register struct monst *mon;
    560 register type;
    561 {
    562 	register int tmp = 0;
    563 
    564 	switch(type) {
    565 	case 0:			/* magic missile */
    566 		tmp = d(2,6);
    567 		break;
    568 	case -1:		/* Dragon blazing fire */
    569 	case 1:			/* fire */
    570 		if(index("Dg", mon->data->mlet)) break;
    571 		tmp = d(6,6);
    572 		if(index("YF", mon->data->mlet)) tmp += 7;
    573 		break;
    574 	case 2:			/* sleep*/
    575 		mon->mfroz = 1;
    576 		break;
    577 	case 3:			/* cold */
    578 		if(index("YFgf", mon->data->mlet)) break;
    579 		tmp = d(6,6);
    580 		if(mon->data->mlet == 'D') tmp += 7;
    581 		break;
    582 	case 4:			/* death*/
    583 		if(index(UNDEAD, mon->data->mlet)) break;
    584 		tmp = mon->mhp+1;
    585 		break;
    586 	}
    587 	mon->mhp -= tmp;
    588 	return(tmp);
    589 }
    590 
    591 #define	CORPSE_I_TO_C(otyp)	(char) ((otyp >= DEAD_ACID_BLOB)\
    592 		     ?  'a' + (otyp - DEAD_ACID_BLOB)\
    593 		     :	'@' + (otyp - DEAD_HUMAN))
    594 revive(obj)
    595 register struct obj *obj;
    596 {
    597 	register struct monst *mtmp;
    598 
    599 	if(obj->olet == FOOD_SYM && obj->otyp > CORPSE) {
    600 		/* do not (yet) revive shopkeepers */
    601 		/* Note: this might conceivably produce two monsters
    602 			at the same position - strange, but harmless */
    603 		mtmp = mkmon_at(CORPSE_I_TO_C(obj->otyp),obj->ox,obj->oy);
    604 		delobj(obj);
    605 	}
    606 	return(!!mtmp);		/* TRUE if some monster created */
    607 }
    608 
    609 rloco(obj)
    610 register struct obj *obj;
    611 {
    612 	register tx,ty,otx,oty;
    613 
    614 	otx = obj->ox;
    615 	oty = obj->oy;
    616 	do {
    617 		tx = rn1(COLNO-3,2);
    618 		ty = rn2(ROWNO);
    619 	} while(!goodpos(tx,ty));
    620 	obj->ox = tx;
    621 	obj->oy = ty;
    622 	if(cansee(otx,oty))
    623 		newsym(otx,oty);
    624 }
    625 
    626 fracture_rock(obj)	/* fractured by pick-axe or wand of striking */
    627 register struct obj *obj;			   /* no texts here! */
    628 {
    629 	/* unpobj(obj); */
    630 	obj->otyp = ROCK;
    631 	obj->quan = 7 + rn2(60);
    632 	obj->owt = weight(obj);
    633 	obj->olet = WEAPON_SYM;
    634 	if(cansee(obj->ox,obj->oy))
    635 		prl(obj->ox,obj->oy);
    636 }
    637 
    638 burn_scrolls()
    639 {
    640 	register struct obj *obj, *obj2;
    641 	register int cnt = 0;
    642 
    643 	for(obj = invent; obj; obj = obj2) {
    644 		obj2 = obj->nobj;
    645 		if(obj->olet == SCROLL_SYM) {
    646 			cnt++;
    647 			useup(obj);
    648 		}
    649 	}
    650 	if(cnt > 1) {
    651 		pline("Your scrolls catch fire!");
    652 		losehp(cnt, "burning scrolls");
    653 	} else if(cnt) {
    654 		pline("Your scroll catches fire!");
    655 		losehp(1, "burning scroll");
    656 	}
    657 }