Exemple #1
0
void potion_heal(int extra)
{
	int ratio;
	short add = 0 ;

	if( rogue.hp_current < rogue.hp_max )
	{
		int i ;

		for( i = 0 ; i < get_rogue_level(1) ; i++ ) // (zerogue 0.4.1)
			add += get_rand(1,6) ;

		add += get_rogue_level(1) ; // (zerogue 0.4.1)

		if( ( rogue.hp_current + add > rogue.hp_max ) && ! extra )
			rogue.hp_current = rogue.hp_max ;
		else
			rogue.hp_current += add ;
	}

	if( blind ) unblind() ;
	
	if( confused && extra )
		unconfuse() ;
	else if (confused)
		confused = (confused / 2) + 1 ;

	if( halluc && extra )
		unhallucinate() ;
	else if( halluc )
		halluc = (halluc / 2) + 1 ;
}
Exemple #2
0
static void
potion_heal(boolean extra)
{
	float ratio;
	short add;

	rogue.hp_current += rogue.exp;

	ratio = ((float)rogue.hp_current) / rogue.hp_max;

	if (ratio >= 1.00) {
		rogue.hp_max += (extra ? 2 : 1);
		extra_hp += (extra ? 2 : 1);
		rogue.hp_current = rogue.hp_max;
	} else if (ratio >= 0.90) {
		rogue.hp_max += (extra ? 1 : 0);
		extra_hp += (extra ? 1 : 0);
		rogue.hp_current = rogue.hp_max;
	} else {
		if (ratio < 0.33) {
			ratio = 0.33;
		}
		if (extra) {
			ratio += ratio;
		}
		add = (short)(ratio * ((float)rogue.hp_max - rogue.hp_current));
		rogue.hp_current += add;
		if (rogue.hp_current > rogue.hp_max) {
			rogue.hp_current = rogue.hp_max;
		}
	}
	if (blind) {
		unblind();
	}
	if (confused && extra) {
		unconfuse();
	} else if (confused) {
		confused = (confused / 2) + 1;
	}
	if (halluc && extra) {
		unhallucinate();
	} else if (halluc) {
		halluc = (halluc / 2) + 1;
	}
}
Exemple #3
0
void
potion_heal(int extra)
{
    long ratio;
    short add;

    rogue.hp_current += rogue.exp;

    ratio = rogue.hp_current * 100L / rogue.hp_max;

    if (ratio >= 100L) {
	rogue.hp_max += (extra ? 2 : 1);
	extra_hp += (extra ? 2 : 1);
	rogue.hp_current = rogue.hp_max;
    } else if (ratio >= 90L) {
	rogue.hp_max += (extra ? 1 : 0);
	extra_hp += (extra ? 1 : 0);
	rogue.hp_current = rogue.hp_max;
    } else {
	if (ratio < 33L) {
	    ratio = 33L;
	}
	if (extra) {
	    ratio += ratio;
	}
	add = (short) (ratio * (rogue.hp_max - rogue.hp_current) / 100L);
	rogue.hp_current += add;
	if (rogue.hp_current > rogue.hp_max) {
	    rogue.hp_current = rogue.hp_max;
	}
    }
    if (blind) {
	unblind();
    }
    if (confused && extra) {
	unconfuse();
    } else if (confused) {
	confused = (confused / 2) + 1;
    }
    if (halluc && extra) {
	unhallucinate();
    } else if (halluc) {
	halluc = (halluc / 2) + 1;
    }
}
Exemple #4
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);
}
Exemple #5
0
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);
}
Exemple #6
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 ;
}