コード例 #1
0
ファイル: use.c プロジェクト: AhmadTux/DragonFlyBSD
static void
idntfy(void)
{
	short ch;
	object *obj;
	struct id *id_table;
	char desc[DCOLS];
AGAIN:
	ch = pack_letter("what would you like to identify?", ALL_OBJECTS);

	if (ch == CANCEL) {
		return;
	}
	if (!(obj = get_letter_object(ch))) {
		message("no such item, try again", 0);
		message("", 0);
		check_message();
		goto AGAIN;
	}
	obj->identified = 1;
	if (obj->what_is & (SCROL | POTION | WEAPON | ARMOR | WAND | RING)) {
		id_table = get_id_table(obj);
		id_table[obj->which_kind].id_status = IDENTIFIED;
	}
	get_desc(obj, desc);
	message(desc, 0);
}
コード例 #2
0
ファイル: use.c プロジェクト: masoo/rogueclone2s
void
idntfy(void)
{
    short ch;
    object *obj;
    struct id *id_table;
    char desc[ROGUE_COLUMNS];
AGAIN:
    ch = pack_letter(mesg[260], ALL_OBJECTS);
    if (ch == CANCEL) {
	return;
    }
    if (!(obj = get_letter_object(ch))) {
	message(mesg[261], 0);
	message("", 0);
	check_message();
	goto AGAIN;
    }
    obj->identified = 1;
    if (obj->what_is & (SCROL | POTION | WEAPON | ARMOR | WAND | RING)) {
	id_table = get_id_table(obj);
	id_table[obj->which_kind].id_status = IDENTIFIED;
    }
    get_desc(obj, desc, 1);
    message(desc, 0);
}
コード例 #3
0
ファイル: use.c プロジェクト: zerobandwidth-net/zerogue
void quaff(void)
{
	short ch;
	object *obj;

	ch = pack_letter("Quaff what?", POTION);

	if( ch == ROGUE_KEY_CANCEL ) return ;

	if( !(obj = get_letter_object(ch)) )
	{
		message( "No such item.", 0 ) ;
		return ;
	}
	if( obj->what_is != POTION )
	{
		message( "You can't drink that!", 0 ) ;
		return ;
	}

	apply_potion( obj->which_kind ) ; // (zerogue 0.4.3)

	print_stats( ( STAT_STRENGTH | STAT_HP | STAT_EXP ) ) ;

	if( id_potions[obj->which_kind].id_status != CALLED )
		id_potions[obj->which_kind].id_status = IDENTIFIED ;

	vanish( obj, 1, &rogue.pack ) ;
}
コード例 #4
0
ファイル: use.c プロジェクト: zerobandwidth-net/zerogue
void identify_item( short ichar )
{
	short ch = 0 ;
	object *obj;
	struct id *id_table;
	char desc[DCOLS];

	if( ichar ) ch = ichar ;

    while( !ch ) /* Until valid input is given...*/
    {
		ch = pack_letter( "What would you like to identify?", ALL_OBJECTS ) ;
 
		if( ch == ROGUE_KEY_CANCEL )
		{
			return ;
		}
		if( !(obj = get_letter_object(ch)) )
		{
			message( "No such item. Try again.", 0 ) ;
			message( "", 0 ) ;
			check_message() ;
			ch = 0 ;
		}
	}

	obj->identified = 1;
	if (obj->what_is & (SCROLL | POTION | WEAPON | ARMOR | WAND | RING))
	{
		id_table = get_id_table(obj);
		id_table[obj->which_kind].id_status = IDENTIFIED;
	}
	get_desc( obj, desc, 1 ) ;
	message(desc, 0);
}
コード例 #5
0
ファイル: use.c プロジェクト: zerobandwidth-net/zerogue
void eat(void)
{
	short ch;
	short moves;
	object *obj;
	char buf[70];

	ch = pack_letter("Eat what?", FOOD);

	if (ch == ROGUE_KEY_CANCEL)
	{
		return;
	}
	if (!(obj = get_letter_object(ch)))
	{
		message("No such item.", 0);
		return;
	}
	if (obj->what_is != FOOD)
	{
		message("You can't eat that!", 0);
		return;
	}
	if ((obj->which_kind == FRUIT) || rand_percent(60))
	{
		moves = get_rand(900, 1100);
		if (obj->which_kind == RATION)
		{
			message("Yum, that tasted good.", 0);
		}
		else
		{
			sprintf(buf, "My, that was a yummy %s\b.", fruit);
			message(buf, 0);
		}
	}
	else
	{
		moves = get_rand(700, 900);
		message("Yuk, that food tasted awful.", 0);
		add_exp(2, 1);
	}
	rogue.moves_left /= 3;
	rogue.moves_left += moves;
	hunger_str[0] = 0;
	print_stats(STAT_HUNGER);

	vanish(obj, 1, &rogue.pack);
}
コード例 #6
0
ファイル: use.c プロジェクト: masoo/rogueclone2s
void
eat(void)
{
    short ch;
    short moves;
    object *obj;
    char buf[70];

    ch = pack_letter(mesg[262], FOOD);
    if (ch == CANCEL) {
	return;
    }
    if (!(obj = get_letter_object(ch))) {
	message(mesg[263], 0);
	return;
    }
    if (obj->what_is != FOOD) {
	message(mesg[264], 0);
	return;
    }
    if ((obj->which_kind == FRUIT) || rand_percent(60)) {
	moves = get_rand(900, 1100);
	if (obj->which_kind == RATION) {
	    if (get_rand(1, 10) == 1) {
		message(mesg[265], 0);
	    } else
		message(mesg[266], 0);
	} else {
	    sprintf(buf, mesg[267], fruit);
	    message(buf, 0);
	}
    } else {
	moves = get_rand(700, 900);
	message(mesg[268], 0);
	add_exp(2, 1);
    }
    rogue.moves_left /= 3;
    rogue.moves_left += moves;
    hunger_str[0] = 0;
    print_stats(STAT_HUNGER);

    vanish(obj, 1, &rogue.pack);
}
コード例 #7
0
ファイル: inventory.c プロジェクト: zerobandwidth-net/zerogue
void single_inv(short ichar)
{
	short ch;
	char desc[DCOLS];
	object *obj;

	ch = ichar ? ichar : pack_letter("Inventory what?", ALL_OBJECTS);

	if (ch == ROGUE_KEY_CANCEL)
	{
		return;
	}
	if (!(obj = get_letter_object(ch)))
	{
		message("No such item.", 0);
		return;
	}
	desc[0] = ch;
	desc[1] = ((obj->what_is & ARMOR) && obj->is_protected) ? '}' : ')';
	desc[2] = ' ';
	desc[3] = 0;
	get_desc( obj, desc+3, 1 );
	message(desc, 0);
}
コード例 #8
0
ファイル: use.c プロジェクト: AhmadTux/DragonFlyBSD
void
quaff(void)
{
	short ch;
	char buf[80];
	object *obj;

	ch = pack_letter("quaff what?", POTION);

	if (ch == CANCEL) {
		return;
	}
	if (!(obj = get_letter_object(ch))) {
		message("no such item.", 0);
		return;
	}
	if (obj->what_is != POTION) {
		message("you can't drink that", 0);
		return;
	}
	switch(obj->which_kind) {
		case INCREASE_STRENGTH:
			message("you feel stronger now, what bulging muscles!",
			0);
			rogue.str_current++;
			if (rogue.str_current > rogue.str_max) {
				rogue.str_max = rogue.str_current;
			}
			break;
		case RESTORE_STRENGTH:
			rogue.str_current = rogue.str_max;
			message("this tastes great, you feel warm all over", 0);
			break;
		case HEALING:
			message("you begin to feel better", 0);
			potion_heal(0);
			break;
		case EXTRA_HEALING:
			message("you begin to feel much better", 0);
			potion_heal(1);
			break;
		case POISON:
			if (!sustain_strength) {
				rogue.str_current -= get_rand(1, 3);
				if (rogue.str_current < 1) {
					rogue.str_current = 1;
				}
			}
			message("you feel very sick now", 0);
			if (halluc) {
				unhallucinate();
			}
			break;
		case RAISE_LEVEL:
			rogue.exp_points = level_points[rogue.exp - 1];
			message("you suddenly feel much more skillful", 0);
			add_exp(1, 1);
			break;
		case BLINDNESS:
			go_blind();
			break;
		case HALLUCINATION:
			message("oh wow, everything seems so cosmic", 0);
			halluc += get_rand(500, 800);
			break;
		case DETECT_MONSTER:
			show_monsters();
			if (!(level_monsters.next_monster)) {
				message(strange_feeling, 0);
			}
			break;
		case DETECT_OBJECTS:
			if (level_objects.next_object) {
				if (!blind) {
					show_objects();
				}
			} else {
				message(strange_feeling, 0);
			}
			break;
		case CONFUSION:
			message((halluc ? "what a trippy feeling" :
			"you feel confused"), 0);
			cnfs();
			break;
		case LEVITATION:
			message("you start to float in the air", 0);
			levitate += get_rand(15, 30);
			bear_trap = being_held = 0;
			break;
		case HASTE_SELF:
			message("you feel yourself moving much faster", 0);
			haste_self += get_rand(11, 21);
			if (!(haste_self % 2)) {
				haste_self++;
			}
			break;
		case SEE_INVISIBLE:
			sprintf(buf, "hmm, this potion tastes like %sjuice", fruit);
			message(buf, 0);
			if (blind) {
				unblind();
			}
			see_invisible = 1;
			relight();
			break;
	}
	print_stats((STAT_STRENGTH | STAT_HP));
	if (id_potions[obj->which_kind].id_status != CALLED) {
		id_potions[obj->which_kind].id_status = IDENTIFIED;
	}
	vanish(obj, 1, &rogue.pack);
}
コード例 #9
0
ファイル: use.c プロジェクト: AhmadTux/DragonFlyBSD
void
read_scroll(void)
{
	short ch;
	object *obj;
	char msg[DCOLS];

	ch = pack_letter("read what?", SCROL);

	if (ch == CANCEL) {
		return;
	}
	if (!(obj = get_letter_object(ch))) {
		message("no such item.", 0);
		return;
	}
	if (obj->what_is != SCROL) {
		message("you can't read that", 0);
		return;
	}
	switch(obj->which_kind) {
		case SCARE_MONSTER:
			message("you hear a maniacal laughter in the distance",
			0);
			break;
		case HOLD_MONSTER:
			hold_monster();
			break;
		case ENCH_WEAPON:
			if (rogue.weapon) {
				if (rogue.weapon->what_is == WEAPON) {
					sprintf(msg, "your %sglow%s %sfor a moment",
					name_of(rogue.weapon),
					((rogue.weapon->quantity <= 1) ? "s" : ""),
					get_ench_color());
					message(msg, 0);
					if (coin_toss()) {
						rogue.weapon->hit_enchant++;
					} else {
						rogue.weapon->d_enchant++;
					}
				}
				rogue.weapon->is_cursed = 0;
			} else {
				message("your hands tingle", 0);
			}
			break;
		case ENCH_ARMOR:
			if (rogue.armor) {
				sprintf(msg, "your armor glows %sfor a moment",
				get_ench_color());
				message(msg, 0);
				rogue.armor->d_enchant++;
				rogue.armor->is_cursed = 0;
				print_stats(STAT_ARMOR);
			} else {
				message("your skin crawls", 0);
			}
			break;
		case IDENTIFY:
			message("this is a scroll of identify", 0);
			obj->identified = 1;
			id_scrolls[obj->which_kind].id_status = IDENTIFIED;
			idntfy();
			break;
		case TELEPORT:
			tele();
			break;
		case SLEEP:
			message("you fall asleep", 0);
			take_a_nap();
			break;
		case PROTECT_ARMOR:
			if (rogue.armor) {
				message( "your armor is covered by a shimmering gold shield",0);
				rogue.armor->is_protected = 1;
				rogue.armor->is_cursed = 0;
			} else {
				message("your acne seems to have disappeared", 0);
			}
			break;
		case REMOVE_CURSE:
				message((!halluc) ?
					"you feel as though someone is watching over you" :
					"you feel in touch with the universal oneness", 0);
			uncurse_all();
			break;
		case CREATE_MONSTER:
			create_monster();
			break;
		case AGGRAVATE_MONSTER:
			aggravate();
			break;
		case MAGIC_MAPPING:
			message("this scroll seems to have a map on it", 0);
			draw_magic_map();
			break;
		case CON_MON:
			con_mon = 1;
			sprintf(msg, "your hands glow %sfor a moment", get_ench_color());
			message(msg, 0);
			break;
	}
	if (id_scrolls[obj->which_kind].id_status != CALLED) {
		id_scrolls[obj->which_kind].id_status = IDENTIFIED;
	}
	vanish(obj, (obj->which_kind != SLEEP), &rogue.pack);
}
コード例 #10
0
ファイル: use.c プロジェクト: masoo/rogueclone2s
void
quaff(void)
{
    short ch;
    char buf[80];
    object *obj;

    ch = pack_letter(mesg[231], POTION);
    if (ch == CANCEL) {
	return;
    }
    if (!(obj = get_letter_object(ch))) {
	message(mesg[232], 0);
	return;
    }
    if (obj->what_is != POTION) {
	message(mesg[233], 0);
	return;
    }
    switch (obj->which_kind) {
    case INCREASE_STRENGTH:
	message(mesg[234], 0);
	rogue.str_current++;
	if (rogue.str_current > rogue.str_max) {
	    rogue.str_max = rogue.str_current;
	}
	break;
    case RESTORE_STRENGTH:
	rogue.str_current = rogue.str_max;
	message(mesg[235], 0);
	break;
    case HEALING:
	message(mesg[236], 0);
	potion_heal(0);
	break;
    case EXTRA_HEALING:
	message(mesg[237], 0);
	potion_heal(1);
	break;
    case POISON:
	if (!sustain_strength) {
	    rogue.str_current -= get_rand(1, 3);
	    if (rogue.str_current < 1) {
		rogue.str_current = 1;
	    }
	}
	message(mesg[238], 0);
	if (halluc) {
	    unhallucinate();
	}
	break;
    case RAISE_LEVEL:
	rogue.exp_points = level_points[rogue.exp - 1];
	add_exp(1, 1);
	break;
    case BLINDNESS:
	go_blind();
	break;
    case HALLUCINATION:
	message(mesg[239], 0);
	halluc += get_rand(500, 800);
	break;
    case DETECT_MONSTER:
	show_monsters();
	if (!(level_monsters.next_monster)) {
	    message(strange_feeling, 0);
	}
	break;
    case DETECT_OBJECTS:
	if (level_objects.next_object) {
	    if (!blind) {
		show_objects();
	    }
	} else {
	    message(strange_feeling, 0);
	}
	break;
    case CONFUSION:
	message((halluc ? mesg[240]
		 : mesg[241]), 0);
	confuse();
	break;
    case LEVITATION:
	message(mesg[242], 0);
	levitate += get_rand(15, 30);
	being_held = bear_trap = 0;
	break;
    case HASTE_SELF:
	message(mesg[243], 0);
	haste_self += get_rand(11, 21);
	if (!(haste_self % 2)) {
	    haste_self++;
	}
	break;
    case SEE_INVISIBLE:
	sprintf(buf, mesg[244], fruit);
	message(buf, 0);
	if (blind) {
	    unblind();
	}
	see_invisible = true;
	relight();
	break;
    }
    print_stats((STAT_STRENGTH | STAT_HP));
#if !defined( ORIGINAL )
    id_potions[obj->which_kind].id_status = IDENTIFIED;
#else /* ORIGINAL */
    if (id_potions[obj->which_kind].id_status != CALLED) {
	id_potions[obj->which_kind].id_status = IDENTIFIED;
    }
#endif /* ORIGINAL */
    vanish(obj, 1, &rogue.pack);
}
コード例 #11
0
ファイル: use.c プロジェクト: masoo/rogueclone2s
void
read_scroll(void)
{
    short ch;
    object *obj;
    char msg[ROGUE_COLUMNS];

    ch = pack_letter(mesg[245], SCROL);

    if (ch == CANCEL) {
	return;
    }
    if (!(obj = get_letter_object(ch))) {
	message(mesg[246], 0);
	return;
    }
    if (obj->what_is != SCROL) {
	message(mesg[247], 0);
	return;
    }
    switch (obj->which_kind) {
    case SCARE_MONSTER:
	message(mesg[248], 0);
	break;
    case HOLD_MONSTER:
	hold_monster();
	break;
    case ENCH_WEAPON:
	if (rogue.weapon) {
	    if (rogue.weapon->what_is == WEAPON) {
		sprintf(msg, mesg[249],
			name_of(rogue.weapon), get_ench_color());
		message(msg, 0);
		if (coin_toss()) {
		    rogue.weapon->hit_enchant++;
		} else {
		    rogue.weapon->d_enchant++;
		}
	    }
	    rogue.weapon->is_cursed = 0;
	} else {
	    message(mesg[250], 0);
	}
	break;
    case ENCH_ARMOR:
	if (rogue.armor) {
	    sprintf(msg, mesg[251], get_ench_color());
	    message(msg, 0);
	    rogue.armor->d_enchant++;
	    rogue.armor->is_cursed = 0;
	    print_stats(STAT_ARMOR);
	} else {
	    message(mesg[252], 0);
	}
	break;
    case IDENTIFY:
	message(mesg[253], 0);
	obj->identified = 1;
	id_scrolls[obj->which_kind].id_status = IDENTIFIED;
	idntfy();
	break;
    case TELEPORT:
	tele();
	break;
    case SLEEP:
	message(mesg[254], 0);
	take_a_nap();
	break;
    case PROTECT_ARMOR:
	if (rogue.armor) {
	    message(mesg[255], 0);
	    rogue.armor->is_protected = 1;
	    rogue.armor->is_cursed = 0;
	} else {
	    message(mesg[256], 0);
	}
	break;
    case REMOVE_CURSE:
	message((!halluc) ? mesg[257] : mesg[258], 0);
	uncurse_all();
	break;
    case CREATE_MONSTER:
	create_monster();
	break;
    case AGGRAVATE_MONSTER:
	aggravate();
	break;
    case MAGIC_MAPPING:
	message(mesg[259], 0);
	draw_magic_map();
	break;
    }
#if !defined( ORIGINAL )
    id_scrolls[obj->which_kind].id_status = IDENTIFIED;
#else /* ORIGINAL */
    if (id_scrolls[obj->which_kind].id_status != CALLED) {
	id_scrolls[obj->which_kind].id_status = IDENTIFIED;
    }
#endif /* ORIGINAL */
    vanish(obj, (obj->which_kind != SLEEP), &rogue.pack);
}
コード例 #12
0
ファイル: use.c プロジェクト: zerobandwidth-net/zerogue
void read_scroll(void)
{
	short ch;
	object *obj;
	char msg[DCOLS];

	if(blind)
	{
		message("You can't see to read the scroll.",0);
		return;
	}

	ch = pack_letter("Read what?", SCROLL);

	if (ch == ROGUE_KEY_CANCEL)
	{
		return;
	}
	if (!(obj = get_letter_object(ch)))
	{
		message("No such item.", 0);
		return;
	}
	if (obj->what_is != SCROLL)
	{
		message("You can't read that!", 0);
		return;
	}
	switch(obj->which_kind)
	{
		case SCARE_MONSTER:
			message("You hear a maniacal laughter in the distance.", 0);
			break;
		case HOLD_MONSTER:
			hold_monster();
			break;
		case ENCH_WEAPON:
			if (rogue.weapon)
			{
				if (rogue.weapon->what_is == WEAPON)
				{
					sprintf(msg, "Your %sglow%s %sfor a moment.",
					name_of(rogue.weapon),
					((rogue.weapon->quantity <= 1) ? "s" : ""),
					get_ench_color());
					message(msg, 0);
					if (coin_toss())
					{
						rogue.weapon->hit_enchant++;
					}
					else
					{
						rogue.weapon->d_enchant++;
					}
				}
				rogue.weapon->is_cursed = 0;
			}
			else
			{
				message("Your hands tingle.", 0);
			}
			break;
		case ENCH_ARMOR:
			if (rogue.armor)
			{
				sprintf(msg, "Your armor glows %sfor a moment.",
				get_ench_color());
				message(msg, 0);
				rogue.armor->d_enchant++;
				rogue.armor->is_cursed = 0;
				print_stats(STAT_ARMOR);
			}
			else
			{
				message("Your skin crawls.", 0);
			}
			break;
		case IDENTIFY:
			message("This is a scroll of identify.", 0);
			obj->identified = 1;
			id_scrolls[obj->which_kind].id_status = IDENTIFIED;
			identify_item(0) ;
			break;
		case TELEPORT:
			tele();
			/* (zerogue 0.4.0) The first time a rogue uses this scroll,
			 * he is briefly confused.
			 */
			if( ! obj->identified && id_scrolls[obj->which_kind].id_status != IDENTIFIED )
				confused += get_rand(0,5) ;
			break;
		case SLEEP:
			sleepify(obj) ;
			break ;
		case PROTECT_ARMOR:
			if (rogue.armor)
			{
				message("Your armor is covered by a shimmering gold shield.", 0);
				rogue.armor->is_protected = 1;
				rogue.armor->is_cursed = 0;
			}
			else
			{
				message("Your acne seems to have disappeared.", 0);
			}
			break;
		case REMOVE_CURSE:
				message((!halluc) ?
					"You feel as though someone is watching over you." :
					"You feel in touch with the universal oneness.", 0);
			uncurse_all();
			break;
		case CREATE_MONSTER:
			/* (zerogue 0.4.0) A summoned monster is briefly confused. */
			create_monster(1) ;
			break;
		case AGGRAVATE_MONSTER:
			aggravate();
			break;
		case MAGIC_MAPPING:
			message("This scroll seems to have a map on it.", 0);
			draw_magic_map();
			break;
	}
	if (id_scrolls[obj->which_kind].id_status != CALLED)
	{
		id_scrolls[obj->which_kind].id_status = IDENTIFIED;
	}
	vanish(obj, (obj->which_kind != SLEEP), &rogue.pack);
}