示例#1
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);
}
示例#2
0
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);
}
示例#3
0
/*
 * (zerogue 0.4.3) Applies the effect of a potion to the rogue.
 */
void apply_potion( unsigned short pkind )
{
	char buf[80] ;

	switch( pkind )
	{
		case INCREASE_STRENGTH:
			message( "You feel stronger now, what bulging muscles!", 0 ) ;
			rogue.str_current++ ;
			rogue.str_max++ ; // (zerogue 0.4.1)
			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] ;
			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 ) ;
			confuse() ;
			break;
		case LEVITATION:
			message( "You start to float in the air.", 0 ) ;
			levitate += get_rand( 15, 30 ) ;
			being_held = 0 ;
		   	bear_trap = 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 ;
		case RESTORE_LEVEL:
			if( expmod < 0 )
			{
				// Restore lost hit points.
				short i ;
				for( i = 0 ; i > expmod ; i-- )
					rogue.hp_max += hp_raise() ;
				expmod = 0 ;  // Clear negative levels.
				message( "You feel your lost vitality returning.", 0 ) ;
			}
			else
				message( "Your thirst is thoroughly quenched.", 0 ) ;
			break ;
		default:
			message( "Nothing happens.", 0 ) ;
	}

	return ;
}