⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 verb.c

📁 minix软件源代码
💻 C
📖 第 1 页 / 共 3 页
字号:
    if (!holding(BOTTLE) && !holding(CASK)) {	rspeak(29);	return;    }    if (holding(BOTTLE) && liq(BOTTLE) == object)	iobj = BOTTLE;    if (holding(CASK) && liq(CASK) == object)	iobj = CASK;    if (iobj == 0) {	rspeak(29);	return;    }    if (!ajar(iobj)) {	rspeak(335);	return;    }    if (iobj == CASK)	object++;    g.prop[iobj] = 1;    extract(object);    g.place[object] = 0;    msg = 77;    if (iobj == CASK) {	object--;	msg = 104;    }    if (at(PLANT) || at(DOOR) || (at(SWORD) && g.prop[SWORD] != 0)) {	if (at(DOOR)) {	    g.prop[DOOR] = 0;	    if (object == OIL) {		g.prop[DOOR] = 1;		bitoff(DOOR, LOCKBT);		biton(DOOR, OPENBT);	    }	    msg = 113 + g.prop[DOOR];	} else if (at(SWORD)) {	    /* If sword is alread oily, don't let him clean it. No	       soap. */	    if (g.prop[SWORD] != 5) {		g.prop[SWORD] = 4;		if (object == OIL) {		    g.prop[SWORD] = 5;		    g.fixed[SWORD] = -1;		}		msg = 206 + g.prop[SWORD] - 4;	    }	} else {	    msg = 112;	    if (object == WATER) {		if (g.prop[PLANT] < 0)		    g.prop[PLANT] = -g.prop[PLANT] - 1;		pspeak(PLANT, g.prop[PLANT] + 1);		g.prop[PLANT] = (g.prop[PLANT] + 2) % 6;		g.prop[PLANT2] = g.prop[PLANT] / 2;		newtravel = TRUE;		return;	    }	}    }    rspeak(msg);    return;}/*  EAT  If he ate the right thing and is in the right place, move him to  the other place with all his junk.  Otherwise, narky message.*/void veat(){    int msg, i, k, ll, kk;    switch (object) {    case HONEY:	g.tally2++;    case FOOD:	destroy(object);	msg = 72;	break;    case BIRD:    case SNAKE:    case CLAM:    case OYSTER:    case FLOWER:	msg = 301;	break;    case DWARF:    case DRAGON:    case TROLL:    case DOG:    case WUMPUS:    case BEAR:    case GNOME:	msg = 250;	break;    case MUSHRM:    case CAKES:	k = object - MUSHRM;	ll = 229 + k;	k = 159 - k;	kk = SKEY;	if (object == MUSHRM) {	    kk = TDOOR;	    if (g.loc != 158)		g.tally2++;	}	destroy(object);	msg = 228;	if (!(here(kk) || g.fixed[kk] == g.loc))	    break;	msg = ll;	/* If he hasn't taken tiny key off shelf, don't let him get it	   for free! */	for (i = 1; i < MAXOBJ; i++) {	    if (i == SKEY && g.prop[SKEY] == 1)		continue;	    if (g.place[i] == plac[kk] && g.fixed[i] == 0)		move(i, k);	}	if (g.loc == plac[SKEY] && g.place[SKEY] == plac[SKEY])	    g.tally2++;	g.loc = k;	g.newloc = k;	newtravel = TRUE;	break;    default:	actspk(verb);	return;    }    rspeak(msg);    return;}/*  DRINK*/void vdrink(){    int msg, k, j;    if (object == 0 && (iobj == BOTTLE || iobj == CASK))	object = liq(iobj);    msg = 110;    if (object == OIL)	msg = 301;    if (object != WATER && object != WINE) {	rspeak(msg);	return;    }    if (iobj == 0) {	if (object == liqloc(g.loc))	    iobj = -1;	if (athand(CASK) && object == liq(CASK))	    iobj = CASK;	if (athand(BOTTLE) && object == liq(BOTTLE))	    iobj = BOTTLE;    }    msg = 73;    if (iobj != -1) {	if (iobj == CASK)	    object++;	extract(object);	g.place[object] = 0;	g.prop[iobj] = 1;	msg = (iobj == CASK) ? 299 : 74;    }    if (object == WATER || object == (WATER + 1)) {	rspeak(msg);	return;    }    /* UH-OH. He's a wino. Let him reap the rewards of incontinence.       He'll wander around for awhile, then wake up somewhere or other,       having dropped most of his stuff. */    rspeak(300);    if (g.prop[LAMP] == 1)	g.limit -= ranz(g.limit) / 2;    if (g.limit < 10)	g.limit = 25;    k = 0;    if (pct(15))	k = 49;    if (k == 0 && pct(15))	k = 53;    if (k == 0 && pct(25))	k = 132;    if (k == 0)	k = 175;    if (outside(g.loc))	k = 5;    if (k == g.loc) {	rspeak(msg);	return;    }    if (holding(AXE))	move(AXE, k);    if (holding(LAMP))	move(LAMP, k);    for (j = 1; j < MAXOBJ; j++) {	if (wearng(j))	    bitoff(j, WEARBT);	if (holding(j))	    drop(j, g.loc);    }    g.loc = k;    g.newloc = k;}/*  THROW etc.*/void vthrow(){    int msg, i, k, dwarfn;    if (holding(ROD2) && object == ROD && !holding(ROD))	object = ROD2;    if (!holding(object)) {	actspk(verb);	return;    }    if (object == BOAT || object == BEAR) {	rspeak(noway());	return;    }    dwarfn = dcheck();    if (iobj == 0) {	/* No indirect object was specified.  If a dwarf is present,	   assume it is the object. If not, look for other living	   thing. If no living things present, treat 'THROW' as 'DROP'. */	if (dwarfn)	    iobj = DWARF;	else {	    /* No dwarves present; figure out pausible object. */	    k = 0;	    for (i = 1; i < MAXOBJ; i++) {		if (at(i) && living(i)) {		    iobj = i;		    k++;		}	    }	    if (k == 0) {		vdrop();		return;	    }	    /* It is a beastie of some sort.  Is there more than one?	       Don't kill the bird by default. */	    if (k > 1) {		rspeak(43);		return;	    } else {		if (iobj == BIRD) {		    vdrop();		    return;		}		if (treasr(object) && at(TROLL))		    iobj = TROLL;	    }	}    }    if (object == SWORD || object == BOTTLE) {	vbreak();	return;    }    if (object == FLOWER && iobj == HIVE)	iobj = BEES;    if (edible(object) && living(iobj)) {	vfeed();	return;    }    /* If not axe, same as drop... */    if (object != AXE && iobj != TROLL) {	vdrop();	return;    }    /* AXE is THROWN */    msg = 48;    switch (iobj) {    case DRAGON:	if (g.prop[DRAGON] == 0)	    msg = 152;	break;    case DWARF:	/* At a dwarf... */	if (pct(75)) {	    g.dseen[dwarfn] = g.dloc[dwarfn] = 0;	    msg = 47;	    ++g.dkill;	    if (g.dkill == 1)		msg = 149;	}	break;    case BEAR:	/* This'll teach him to throw axe at the bear */	if (g.prop[BEAR] == 0) {	    msg = 164;	    drop(AXE, g.loc);	    g.fixed[AXE] = -1;	    g.prop[AXE] = 1;	    juggle(BEAR);	}	rspeak(msg);	return;    case WUMPUS:	/* Or the WUMPUS! */	if (g.prop[WUMPUS] == 6) {	    vdrop();	    return;	} else {	    msg = 245;	    g.prop[AXE] = 2;	    if (g.prop[WUMPUS] == 0) {		drop(AXE, g.loc);		g.fixed[AXE] = -1;		juggle(iobj);	    } else {		msg = 243;		destroy(AXE);	    }	}	rspeak(msg);	return;    case DOG:	/* Or the nice doggie! */	if (g.prop[DOG] != 1) {	    msg = 248;	    g.prop[AXE] = 3;	    drop(AXE, g.loc);	    g.fixed[AXE] = -1;	    juggle(iobj);	}	rspeak(msg);	return;    case TROLL:	/* Snarf a treasure for the troll */	if (object == AXE) {	    msg = 158;	} else if (!treasr(object) ||		   (object == CASK && (liq(CASK) != WINE))) {	    vdrop();	    return;	} else {	    msg = 159;	    drop(object, 0);	    if (object == CASK)		g.place[WINE + 1] = 0;	    move(TROLL, 0);	    move((TROLL + MAXOBJ), 0);	    drop(TROLL2, plac[TROLL]);	    drop((TROLL2 + MAXOBJ), fixd[TROLL]);	    juggle(CHASM);	    rspeak(msg);	    return;	}	break;    default:	/* Otherwise it is an attack */	verb = KILL;	object = iobj;	iobj = objs[objx];	vkill();	return;    }    rspeak(msg);    drop(AXE, g.loc);    g.newloc = g.loc;    describe();}/*  FIND might be carrying it, or it might be here. else give caveat.*/void vfind(){    int msg;    if (at(object) ||	(liq(BOTTLE) == object && at(BOTTLE)) ||	object == liqloc(g.loc))	msg = 94;    else if (dcheck() && g.dflag >= 2 && object == DWARF)	msg = 94;    else if (g.closed)	msg = 138;    else if (at(object))	msg = 24;    else {	actspk(verb);	return;    }    rspeak(msg);    return;}/*  FEED*/void vfeed(){    int msg;    if (iobj == 0 || !living(iobj)) {	int i, k, kk;	if (object == BIRD) {	    rspeak(100);	    return;	}	if (!living(object)) {	    rspeak(noway());	    return;	}	/* See if there is anything edible around here. */	kk = 0;	k = 0;	for (i = 1; i < MAXOBJ; i++)	    if (here(i) && edible(i)) {		k++;		kk = i;	    }	iobj = object;	object = kk;	if (k != 1 && !dead(iobj)) {	    printf("What do you want to feed the %s\n", otxt[objx]);	    objs[1] = 0;	    objx = 0;	    return;	}    }    /* Feed object ot indirect object */    msg = 102;    switch (iobj) {    case DRAGON:	if (g.prop[DRAGON] != 0)	    msg = noway();	break;    case TROLL:	msg = 182;	break;    case SNAKE:	if (object == BIRD && !g.closed) {	    msg = 101;	    destroy(BIRD);	    g.prop[BIRD] = 0;	    g.tally2++;	}	break;    case DWARF:	msg = 103;	g.dflag++;	break;    case BEAR:	if (g.prop[BEAR] == 3)	    msg = noway();	if (g.prop[BEAR] == 1 || g.prop[BEAR] == 2)	    msg = 264;	if (object == FOOD)	    msg = 278;	if (object == HONEY) {	    g.prop[BEAR] = 1;	    g.fixed[AXE] = 0;	    destroy(HONEY);	    msg = 168;	}	break;    case DOG:	msg = 291;	if (object == FOOD && g.prop[DOG] != 1) {	    msg = 249;	    destroy(FOOD);	}	break;    case WUMPUS:	if (g.prop[WUMPUS] == 6)	    msg = 326;	if (g.prop[WUMPUS] == 0)	    msg = 327;	if (object == FOOD)	    msg = 240;	break;    case BEES:	if (object == FLOWER) {	    if (enclosed(FLOWER))		extract(FLOWER);	    drop(FLOWER, g.loc);	    g.fixed[FLOWER] = -1;	    g.prop[FLOWER] = 1;	    drop(HONEY, g.loc);	    juggle(HONEY);	    msg = 267;	    g.prop[HIVE] = 1;	}    }    rspeak(msg);    return;}/*  FILL. object with iobj*/void vfill(){    int msg, k;    if (!vessel(object))	msg = 313;    else {	if (iobj == 0)	    iobj = liqloc(g.loc);	if (object == BOTTLE || object == CASK) {	    k = (object == CASK) ? 1 : 0;	    msg = 0;	    if (iobj == 0)		msg = 304 + k;	    if (liq(object) != 0)		msg = 302 + k;	    if (msg != 0) {		rspeak(msg);		return;	    }	    msg = 306 + k;	    if (iobj == OIL)		msg = 308 + k;	    if (iobj == WINE)		msg = 310 + k;	    g.prop[object] = (int) g.loc_attrib[g.loc] & 14;	    g.place[iobj + k] = -1;	    insert(iobj + k, object);	} else if (object == VASE) {	    if (iobj == 0 || !holding(VASE)) {		rspeak(144);		return;	    }	    msg = 145;	    g.prop[VASE] = 2;	    g.fixed[VASE] = -1;	    if (enclosed(object))		extract(object);	    drop(object, g.loc);	} else if (object == GRAIL)	    msg = 298;	else	    msg = 339;    }    rspeak(msg);}/*  READ. Magazine in dwarvish, message we've seen, and ... oyster?*/void vread(){    int msg;    if (blind()) {	actspk(verb);	return;    }    if (object && iobj) {	rspeak(confuz());	return;    }    msg = confuz();    if (!object)	object = iobj;    switch (object) {    case BOOK:    case BOOK2:	msg = 142;	break;    case BILLBD:	msg = 361;	break;    case CARVNG:	msg = 372;	break;    case MAGAZINE:	msg = 190;	break;    case MESSAGE:	msg = 191;	break;    case POSTER:	msg = 370;	break;    case TABLET:	msg = 196;	break;    case OYSTER:	if (g.hinted[2] && holding(OYSTER))	    msg = 194;	if (!g.hinted[2] && holding(OYSTER) && g.closed) {	    g.hinted[2] = yes(192, 193, 54);	    return;	}	break;    }    rspeak(msg);    return;}/*  BREAK. works for mirror in repository and, of course the  vase and bottle.  Also the sword is more brittle than it appears.*/void vbreak(){    int msg, k;    boolean it_broke;    it_broke = FALSE;    msg = 146;    switch (object) {    case MIRROR:	msg = 148;	if (g.closed) {	    rspeak(197);	    dwarfend();	    return;	}	break;    case VASE:	if (g.prop[VASE] == 0) {	    it_broke = TRUE;	    msg = 198;	    g.prop[VASE] = 2;	}	break;    case BOTTLE:	if (g.prop[BOTTLE] != 3) {	    it_broke = TRUE;	    k = liq(BOTTLE);	    msg = 231;	    g.prop[BOTTLE] = 3;	    if (k) {		extract(k);		g.place[k] = 0;	    }	}	break;    case SWORD:	msg = 29;	if (holding(SWORD)) {	    msg = 279;	    g.prop[SWORD] = 4;	    it_broke = TRUE;	}	break;    }    if (it_broke) {	if (enclosed(object))	    extract(object);	if (holding(object))	    drop(object, g.loc);	g.fixed[object] = -1;    }    rspeak(msg);    return;}/*  WAKE. only use is to disturb the dwarves or the Wumpus.  Other wumpus-wakers link here.*/void vwake(){    int msg;    msg = actmsg[verb];    if (at(WUMPUS)) {	g.chase = TRUE;	g.prop[WUMPUS] = 1;	msg = 276;    }    if (at(DOG) && g.prop[DOG] == 1)	msg = 291;    if (object == DWARF && g.closed) {	rspeak(199);	dwarfend();	return;    }    rspeak(msg);    return;}/*   YANK. A variant of 'CARRY'.  In general, not a good idea.   At most, it gets the cloak or a couple of snide comments. */void vyank(){    if (toting(object))	vdrop();    else if (object == BEAR && g.prop[CHAIN])	rspeak(205);    else if (object == CLOAK && g.prop[CLOAK] == 2) {	/* Cloak. big trouble ahead. */	g.prop[ROCKS] = 1;	g.prop[CLOAK] = 0;	g.fixed[CLOAK] = 0;	carry(CLOAK, g.loc);	rspeak(241);	if (at(WUMPUS) && g.prop[WUMPUS] == 0) {	    g.chase = 1;	    g.prop[WUMPUS] = 1;	    rspeak(276);	}    } else	vtake();    return;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -