void add_exp(int e, boolean promotion) { short new_exp; short i, hp; rogue.exp_points += e; if (rogue.exp_points >= level_points[rogue.exp-1]) { new_exp = get_exp_level(rogue.exp_points); if (rogue.exp_points > MAX_EXP) { rogue.exp_points = MAX_EXP + 1; } for (i = rogue.exp+1; i <= new_exp; i++) { messagef(0, "welcome to level %d", i); if (promotion) { hp = hp_raise(); rogue.hp_current += hp; rogue.hp_max += hp; } rogue.exp = i; print_stats(STAT_HP | STAT_EXP); } } else { print_stats(STAT_EXP); } }
void drop_level(void) { int hp; if (rand_percent(80) || (rogue.exp <= 5)) { return; } rogue.exp_points = level_points[rogue.exp - 2] - get_rand(9, 29); rogue.exp -= 2; hp = hp_raise(); if ((rogue.hp_current -= hp) <= 0) { rogue.hp_current = 1; } if ((rogue.hp_max -= hp) <= 0) { rogue.hp_max = 1; } add_exp(1, 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 ; }