コード例 #1
0
ファイル: verb.c プロジェクト: Claruarius/stblinux-2.6.37
/*
	FEED
*/
vfeed()
{
	int msg;

	switch(object) {
	case BIRD:
		msg = 100;
		break;
	case DWARF:
		if (!here(FOOD)) {
			actspk(verb);
			return;
		}
		++dflag;
		msg = 103;
		break;
	case BEAR:
		if (!here(FOOD)) {
			if (prop[BEAR] == 0)
				msg = 102;
			else if (prop[BEAR] == 3)
				msg = 110;
			else {
				actspk(verb);
				return;
			}
		break;
		}
		dstroy(FOOD);
		prop[BEAR] = 1;
		fixed[AXE] = 0;
		prop[AXE] = 0;
		msg = 168;
		break;
	case DRAGON:
		msg = (prop[DRAGON] != 0 ? 110 : 102);
		break;
	case TROLL:
		msg = 182;
		break;
	case SNAKE:
		if (closed || !here(BIRD)) {
			msg = 102;
			break;
		}
		msg = 101;
		dstroy(BIRD);
		prop[BIRD] = 0;
		++tally2;
		break;
	default:
		msg = 14;
	}
	rspeak(msg);
}
コード例 #2
0
ファイル: verb.c プロジェクト: Claruarius/stblinux-2.6.37
/*
	READ etc.
*/
vread()
{
	int msg;

	msg = 0;
	if (dark()) {
		printf("I see no %s here.\n",probj(object));
		return;
	}
	switch(object) {
	case MAGAZINE:
		msg = 190;
		break;
	case TABLET:
		msg = 196;
		break;
	case MESSAGE:
		msg = 191;
		break;
	case OYSTER:
		if (!toting(OYSTER) || !closed)
			break;
		yes(192,193,54);
		return;
	default:
		;
	}
	if (msg)
		rspeak(msg);
	else
		actspk(verb);
}
コード例 #3
0
ファイル: verb.c プロジェクト: Claruarius/stblinux-2.6.37
/*
	POUR
*/
vpour()
{
	if (object == BOTTLE || object == 0)
		object = liq();
	if (object == 0) {
		needobj();
		return;
	}
	if (!toting(object)) {
		actspk(verb);
		return;
	}
	if (object != OIL && object != WATER) {
		rspeak(78);
		return;
	}
	prop[BOTTLE] = 1;
	place[object] = 0;
	if (at(PLANT)) {
		if (object != WATER)
			rspeak(112);
		else {
			pspeak(PLANT,prop[PLANT]+1);
			prop[PLANT] = (prop[PLANT]+2)%6;
			prop[PLANT2] = prop[PLANT]/2;
			describe();
		}
	}
	else if (at(DOOR)) {
		prop[DOOR] = (object == OIL ? 1 : 0);
		rspeak(113+prop[DOOR]);
	}
	else
		rspeak(77);
}
コード例 #4
0
ファイル: verb.c プロジェクト: Claruarius/stblinux-2.6.37
/*
	WAKE etc.
*/
vwake()
{
	if (object != DWARF || !closed)
		actspk(verb);
	else {
		rspeak(199);
		dwarfend();
	}
}
コード例 #5
0
ファイル: verb.c プロジェクト: Claruarius/stblinux-2.6.37
/*
	OFF etc.
*/
voff()
{
	if (!here(LAMP))
		actspk(verb);
	else {
		prop[LAMP] = 0;
		rspeak(40);
	}
}
コード例 #6
0
ファイル: verb.c プロジェクト: Claruarius/stblinux-2.6.37
/*
	DRINK
*/
vdrink()
{
	if (object != WATER)
		rspeak(110);
	else if (liq() != WATER || !here(BOTTLE))
		actspk(verb);
	else {
		prop[BOTTLE] = 1;
		place[WATER] = 0;
		rspeak(74);
	}
}
コード例 #7
0
ファイル: verb.c プロジェクト: Claruarius/stblinux-2.6.37
/*
	WAVE etc.
*/
vwave()
{
	if (!toting(object) &&
	   (object != ROD || !toting(ROD2)))
		rspeak(29);
	else if (object != ROD || !at(FISSURE) ||
		!toting(object) || closing)
		actspk(verb);
	else {
		prop[FISSURE] = 1-prop[FISSURE];
		pspeak(FISSURE,2-prop[FISSURE]);
	}
}
コード例 #8
0
ファイル: verb.c プロジェクト: Claruarius/stblinux-2.6.37
/*
	BLAST etc.
*/
vblast()
{
	if (prop[ROD2] < 0 || !closed)
		actspk(verb);
	else {
		bonus = 133;
		if (loc == 115)
			bonus = 134;
		if (here(ROD2))
			bonus = 135;
		rspeak(bonus);
		normend();
	}
}
コード例 #9
0
/*
  BLAST etc.
*/
void ivblast()
{
    if (!g.closed)
	actspk(verb);
    else {
	g.bonus = 135;
	if (g.place[ROD2] == 212 && g.loc == 116)
	    g.bonus = 133;
	if (g.place[ROD2] == 116 && g.loc != 116)
	    g.bonus = 134;
	rspeak(g.bonus);
	normend();
    }
    return;
}
コード例 #10
0
ファイル: verb.c プロジェクト: Claruarius/stblinux-2.6.37
/*
	ON etc.
*/
von()
{
	if (!here(LAMP))
		actspk(verb);
	else if (limit<0)
		rspeak(184);
	else {
		prop[LAMP] = 1;
		rspeak(39);
		if (wzdark) {
			wzdark = 0;
			describe();
		}
	}
}
コード例 #11
0
ファイル: verb.c プロジェクト: Claruarius/stblinux-2.6.37
/*
	INVENTORY, FIND etc.
*/
vfind()
{
	int msg;
	if (toting(object))
		msg = 24;
	else if (closed)
		msg = 138;
	else if (dcheck() && dflag >= 2 && object == DWARF)
		msg = 94;
	else if (at(object) ||
		(liq() == object && here(BOTTLE)) ||
		object == liqloc(loc))
		msg = 94;
	else {
		actspk(verb);
		return;
	}
	rspeak(msg);
}
コード例 #12
0
ファイル: verb.c プロジェクト: Claruarius/stblinux-2.6.37
/*
	EAT
*/
veat()
{
	int msg;

	switch(object) {
	case FOOD:
		dstroy(FOOD);
		msg = 72;
		break;
	case BIRD: case SNAKE: case CLAM: case OYSTER:
	case DWARF: case DRAGON: case TROLL: case BEAR:
		msg = 71;
		break;
	default:
		actspk(verb);
		return;
	}
	rspeak(msg);
}
コード例 #13
0
ファイル: verb.c プロジェクト: Claruarius/stblinux-2.6.37
/*
	BREAK etc.
*/
vbreak()
{
	int msg;
	if (object == MIRROR) {
		msg = 148;
		if (closed) {
			rspeak(197);
			dwarfend();
		}
	}
	else if (object == VASE && prop[VASE] == 0) {
		msg = 198;
		if (toting(VASE))
			drop(VASE,loc);
		prop[VASE] = 2;
		fixed[VASE] = -1;
	}
	else {
		actspk(verb);
		return;
	}
	rspeak(msg);
}
コード例 #14
0
/*
  Routines to process intransitive verbs
*/
void itverb()
{
    int i;

    newtravel = FALSE;
    switch (verb) {
    case DROP:
    case SAY:
    case WAVE:
    case CALM:
    case RUB:
    case THROW:
    case FIND:
    case FEED:
    case BREAK:
    case WAKE:
    case WEAR:
    case HIT:
    case DIAL:
    case PLAY:
    case PICK:
    case PUT:
    case TURN:		needobj();	break;
    case TAKE:
    case YANK:
    case GET:
    case INSRT:
    case REMOVE:
    case BURN:		ivtake();	break;
    case OPEN:
    case CLOSE:
    case LOCK:
    case UNLOCK:	ivopen();	break;
    case NOTHING:	rspeak(54);	break;
    case ON:
    case OFF:		trverb();	break;
    case WALK:		actspk(verb);	break;
    case KILL:		ivkill();	break;
    case POUR:		ivpour();	break;
    case EAT:		iveat();	break;
    case DRINK:		ivdrink();	break;
    case QUIT:		ivquit();	break;
    case INVENTORY:	inventory();	break;
    case FILL:		ivfill();	break;
    case BLAST:		ivblast();	break;
    case SCORE:		score(TRUE);	break;
    case FOO:		ivfoo();	break;
    case BRIEF:		ivbrief();	break;
    case READ:		ivread();	break;
    case SUSPEND:
	if (g.closing)
	    rspeak(378);
	else
	    saveadv("advent.sav");
	break;
    case RESTORE:	restore("advent.sav");	break;
    case ANSWER:
	if ((g.loc != 189) || (g.prop[PHONE] != 0))
	    needobj();
	else {
	    object = PHONE;
	    itverb();
	}
	break;
    case BLOW:		rspeak(268);	break;
	/* Action verb 'LEAVE' has no object */
    case LEAVE:		bug(29);	break;
	/* Call if no phone is handy, yell. */
    case YELL:
	if (!here(PHONE))
	    needobj();
	else if (!g.closed)
	    rspeak(271);
	else {
	    rspeak(283);
	    normend();
	}
	break;
	/* Health. give him a diagnosis. */
    case HEALTH:
	if (g.numdie)
	    fprintf(stdout, "You have been killed %d times otherwise\n",
		    g.numdie);
	if (g.health >= 95) {
	    if (pct(50))
		rspeak(348);
	    else
		rspeak(349);
	} else {
	    fprintf(stdout,
	       "Your health rating is %2d out of a possible 100.\n",
		    g.health);
	    rspeak(381 + (100 - g.health) / 20);
	}
	break;
    case LOOK:		ivlook();	break;
    case COMBO:
	if (at(SAFE))
	    ivcombo();
	break;
    case SWEEP:
	/* Dust/sweep */
	if (!at(CARVNG) || !athand(BRUSH) || (g.prop[CARVNG] == 1))
	    rspeak(342);
	else {
	    g.prop[CARVNG] = 1;
	    rspeak(363);
	    rspeak(372);
	}
	break;
    case TERSE:
	/* Terse/unterse. supress all long_form descriptions. */
	g.terse = !g.terse;
	g.detail = 3;
	rspeak(54);
	break;
    case WIZ:
	is_wiz = !is_wiz;
    case MAP:
	rspeak(54);
	break;
    case GATE:
	if (is_wiz) {
	    static char buf[INPUTBUFLEN];
	    sscanf(ask("Location ? ", buf, sizeof(buf)), "%d", &g.loc);
	}
	rspeak(54);
	break;
    case PIRLOC:
	if (is_wiz) {
	    fprintf(stdout, "The dwarfs are at locations:\n");
	    for (i = 1; i < DWARFMAX; i++)
		fprintf(stdout, "  %4d", g.dloc[i]);
	    fprintf(stdout, "\nThe pirate is at location %4d\n",
		    g.dloc[DWARFMAX]);
	}
	rspeak(54);
	break;
    default:
	printf("This intransitive not implemented yet\n");
    }
    return;
}
コード例 #15
0
ファイル: verb.c プロジェクト: Claruarius/stblinux-2.6.37
/*
	CARRY TAKE etc.
*/
vtake()
{
	int msg;
	int i;

	if (toting(object)) {
		actspk(verb);
		return;
	}
	/*
	   special case objects and fixed objects
	*/
	msg = 25;
	if (object == PLANT && prop[PLANT] <= 0)
		msg = 115;
	if (object == BEAR && prop[BEAR] == 1)
		msg = 169;
	if (object == CHAIN && prop[BEAR] != 0)
		msg = 170;
	if (fixed[object]) {
		rspeak(msg);
		return;
	}
	/*
	   special case for liquids
	*/
	if (object == WATER || object == OIL) {
		if (!here(BOTTLE) || liq() != object) {
			object = BOTTLE;
			if (toting(BOTTLE)&&prop[BOTTLE] == 1){
				vfill();
				return;
			}
			if (prop[BOTTLE] != 1)
				msg = 105;
			if (!toting(BOTTLE))
				msg = 104;
			rspeak(msg);
			return;
		}
		object = BOTTLE;
	}
	if (holding >= 7) {
		rspeak(92);
		return;
	}
	/*
	   special case for bird.
	*/
	if (object == BIRD && prop[BIRD] == 0) {
		if (toting(ROD)) {
			rspeak(26);
			return;
		}
		if (!toting(CAGE)) {
			rspeak(27);
			return;
		}
		prop[BIRD] = 1;
	}
	if ( (object == BIRD || object == CAGE) &&
		prop[BIRD] != 0)
		carry((BIRD+CAGE)-object,loc);
	carry(object,loc);
	/*
	   handle liquid in bottle
	*/
	i = liq();
	if (object == BOTTLE && i != 0)
		place[i] = -1;
	rspeak(54);
}
コード例 #16
0
ファイル: verb.c プロジェクト: Claruarius/stblinux-2.6.37
/*
	DROP etc.
*/
vdrop()
{
	int i;

	/*
	   check for dynamite
	*/
	if (toting(ROD2) && object == ROD && !toting(ROD))
		object = ROD2;
	if (!toting(object)){
		actspk(verb);
		return;
	}
	/*
	   snake and bird
	*/
	if (object == BIRD && here(SNAKE)) {
		rspeak(30);
		if (closed)
			dwarfend();
		dstroy(SNAKE);
		prop[SNAKE] = -1;
	}
	/*
	   coins and vending machine
	*/
	else if (object == COINS && here(VEND)) {
		dstroy(COINS);
		drop(BATTERIES,loc);
		pspeak(BATTERIES,0);
		return;
	}
	/*
	   bird and dragon (ouch!!)
	*/
	else if (object == BIRD && at(DRAGON) && prop[DRAGON] == 0){
		rspeak(154);
		dstroy(BIRD);
		prop[BIRD] = 0;
		if (place[SNAKE] != 0)
			++tally2;
		return;
	}
	/*
	   Bear and troll
	*/
	if (object == BEAR && at(TROLL)) {
		rspeak(163);
		move(TROLL,0);
		move((TROLL+MAXOBJ),0);
		move(TROLL2,117);
		move((TROLL2+MAXOBJ),122);
		juggle(CHASM);
		prop[TROLL] = 2;
	}
	/*
	   vase
	*/
	else if (object == VASE) {
		if (loc == 96)
			rspeak(54);
		else {
			prop[VASE] = at(PILLOW) ? 0 : 2;
			pspeak(VASE,prop[VASE]+1);
			if (prop[VASE] != 0)
				fixed[VASE] = -1;
		}
	}
	/*
	   handle liquid and bottle
	*/
	i = liq();
	if (i == object)
		object = BOTTLE;
	if (object == BOTTLE && i != 0)
		place[i] = 0;
	/*
	   handle bird and cage
	*/
	if (object == CAGE && prop[BIRD] != 0)
		drop(BIRD,loc);
	if (object == BIRD)
		prop[BIRD] = 0;
	drop(object,loc);
}
コード例 #17
0
ファイル: verb.c プロジェクト: Claruarius/stblinux-2.6.37
/*
	THROW etc.
*/
vthrow()
{
	int msg;
	int i;

	if (toting(ROD2) && object == ROD && !toting(ROD))
		object = ROD2;
	if (!toting(object)) {
		actspk(verb);
		return;
	}
	/*
	   treasure to troll
	*/
	if (at(TROLL) && object >= 50 && object<MAXOBJ) {
		rspeak(159);
		drop(object,0);
		move(TROLL,0);
		move((TROLL+MAXOBJ),0);
		drop(TROLL2,117);
		drop((TROLL2+MAXOBJ),122);
		juggle(CHASM);
		return;
	}
	/*
	   feed the bears...
	*/
	if (object == FOOD && here(BEAR)) {
		object = BEAR;
		vfeed();
		return;
	}
	/*
	   if not axe, same as drop...
	*/
	if (object != AXE) {
		vdrop();
		return;
	}
	/*
	   AXE is THROWN
	*/
	/*
	   at a dwarf...
	*/
	if (i = dcheck()) {
		msg = 48;
		if (pct(33)) {
			dseen[i] = dloc[i] = 0;
			msg = 47;
			++dkill;
			if (dkill == 1)
				msg = 149;
		}
	}
	/*
	   at a dragon...
	*/
	else if (at(DRAGON) && prop[DRAGON] == 0) 
		msg = 152;
	/*
	   at the troll...
	*/
	else if (at(TROLL))
		msg = 158;
	/*
	   at the bear...
	*/
	else if (here(BEAR) && prop[BEAR] == 0) {
		rspeak(164);
		drop(AXE,loc);
		fixed[AXE] = -1;
		prop[AXE] = 1;
		juggle(BEAR);
		return;
	}
	/*
	   otherwise it is an attack
	*/
	else {
		verb = KILL;
		object = 0;
		itverb();
		return;
	}
	/*
	   handle the left over axe...
	*/
	rspeak(msg);
	drop(AXE,loc);
	describe();
}
コード例 #18
0
ファイル: verb.c プロジェクト: Claruarius/stblinux-2.6.37
/*
	ATTACK, KILL etc.
*/
vkill()
{
	int msg;
	int i;

	switch(object) {
	case BIRD:
		if (closed)
			msg = 137;
		else {
			dstroy(BIRD);
			prop[BIRD] = 0;
			if (place[SNAKE] == 19)
				++tally2;
			msg = 45;
		}
		break;
	case 0:
		msg = 44;
		break;
	case CLAM:
	case OYSTER:
		msg = 150;
		break;
	case SNAKE:
		msg = 46;
		break;
	case DWARF:
		if (closed)
			dwarfend();
		msg = 49;
		break;
	case TROLL:
		msg = 157;
		break;
	case BEAR:
		msg = 165+(prop[BEAR]+1)/2;
		break;
	case DRAGON:
		if (prop[DRAGON] != 0) {
			msg = 167;
			break;
		}
		if (!yes(49,0,0))
			break;
		pspeak(DRAGON,1);
		prop[DRAGON] = 2;
		prop[RUG] = 0;
		move((DRAGON+MAXOBJ),-1);
		move((RUG+MAXOBJ),0);
		move(DRAGON,120);
		move(RUG,120);
		for(i = 1;i<MAXOBJ;++i)
			if (place[i] == 119 || place[i] == 121)
				move(i,120);
		newloc = 120;
		return;
	default:
		actspk(verb);
		return;
	}
	rspeak(msg);
}
コード例 #19
0
ファイル: verb.c プロジェクト: Claruarius/stblinux-2.6.37
/*
	Routine to process a transitive verb
*/
trverb()
{
	switch(verb){
	case CALM:
	case WALK:
	case QUIT:
	case SCORE:
	case FOO:
	case BRIEF:
	case SUSPEND:
	case HOURS:
	case LOG:
		actspk(verb);
		break;
	case TAKE:
		vtake();
		break;
	case DROP:
		vdrop();
		break;
	case OPEN:
	case LOCK:
		vopen();
		break;
	case SAY:
		vsay();
		break;
	case NOTHING:
		rspeak(54);
		break;
	case ON:
		von();
		break;
	case OFF:
		voff();
		break;
	case WAVE:
		vwave();
		break;
	case KILL:
		vkill();
		break;
	case POUR:
		vpour();
		break;
	case EAT:
		veat();
		break;
	case DRINK:
		vdrink();
		break;
	case RUB:
		if (object != LAMP)
			rspeak(76);
		else
			actspk(RUB);
		break;
	case THROW:
		vthrow();
		break;
	case FEED:
		vfeed();
		break;
	case FIND:
	case INVENTORY:
		vfind();
		break;
	case FILL:
		vfill();
		break;
	case READ:
		vread();
		break;
	case BLAST:
		vblast();
		break;
	case BREAK:
		vbreak();
		break;
	case WAKE:
		vwake();
		break;
	default:
		printf("This verb is not implemented yet.\n");
	}
}