Esempio n. 1
0
void
drain_life(void)
{
    short n;

    if (rand_percent(60) || (rogue.hp_max <= 30) || (rogue.hp_current < 10)) {
	return;
    }
    n = get_rand(1, 3);		/* 1 Hp, 2 Str, 3 both */

    if ((n != 2) || (!sustain_strength)) {
	message(mesg[208], 0);
    }
    if (n != 2) {
	rogue.hp_max--;
	rogue.hp_current--;
	less_hp++;
    }
    if (n != 1) {
	if ((rogue.str_current > 3) && (!sustain_strength)) {
	    rogue.str_current--;
	    if (coin_toss()) {
		rogue.str_max--;
	    }
	}
    }
    print_stats((STAT_STRENGTH | STAT_HP));
}
static int
move_confused(object *monster)
{
	short i, row, col;

	if (!(monster->m_flags & ASLEEP)) {
		if (--monster->moves_confused <= 0) {
			monster->m_flags &= (~CONFUSED);
		}
		if (monster->m_flags & STATIONARY) {
			return(coin_toss() ? 1 : 0);
		} else if (rand_percent(15)) {
			return(1);
		}
		row = monster->row;
		col = monster->col;

		for (i = 0; i < 9; i++) {
			rand_around(i, &row, &col);
			if ((row == rogue.row) && (col == rogue.col)) {
				return(0);
			}
			if (mtry(monster, row, col)) {
				return(1);
			}
		}
	}
	return(0);
}
Esempio n. 3
0
static void
fill_it(int rn, boolean do_rec_de)
{
    short i, tunnel_dir, door_dir, drow, dcol;
    short target_room, rooms_found = 0;
    short srow, scol, t;
    static short offsets[4] = {-1, 1, 3, -3};
    boolean did_this = 0;

    for (i = 0; i < 10; i++) {
        srow = get_rand(0, 3);
        scol = get_rand(0, 3);
        t = offsets[srow];
        offsets[srow] = offsets[scol];
        offsets[scol] = t;
    }
    for (i = 0; i < 4; i++) {

        target_room = rn + offsets[i];

        if (((target_room < 0) || (target_room >= MAXROOMS)) ||
                (!(same_row(rn,target_room) || same_col(rn,target_room))) ||
                (!(rooms[target_room].is_room & (R_ROOM | R_MAZE)))) {
            continue;
        }
        if (same_row(rn, target_room)) {
            tunnel_dir = (rooms[rn].left_col < rooms[target_room].left_col) ?
                         RIGHT : LEFT;
        } else {
            tunnel_dir = (rooms[rn].top_row < rooms[target_room].top_row) ?
                         DOWN : UPWARD;
        }
        door_dir = ((tunnel_dir + 4) % DIRS);
        if (rooms[target_room].doors[door_dir/2].oth_room != NO_ROOM) {
            continue;
        }
        if (((!do_rec_de) || did_this) ||
                (!mask_room(rn, &srow, &scol, TUNNEL))) {
            srow = (rooms[rn].top_row + rooms[rn].bottom_row) / 2;
            scol = (rooms[rn].left_col + rooms[rn].right_col) / 2;
        }
        put_door(&rooms[target_room], door_dir, &drow, &dcol);
        rooms_found++;
        draw_simple_passage(srow, scol, drow, dcol, tunnel_dir);
        rooms[rn].is_room = R_DEADEND;
        dungeon[srow][scol] = TUNNEL;

        if ((i < 3) && (!did_this)) {
            did_this = 1;
            if (coin_toss()) {
                continue;
            }
        }
        if ((rooms_found < 2) && do_rec_de) {
            recursive_deadend(rn, offsets, srow, scol);
        }
        break;
    }
}
void
put_mons(void)
{
	short i;
	short n;
	object *monster;
	short row, col;

	n = get_rand(4, 6);

	for (i = 0; i < n; i++) {
		monster = gr_monster(NULL, 0);
		if ((monster->m_flags & WANDERS) && coin_toss()) {
			wake_up(monster);
		}
		gr_row_col(&row, &col, (FLOOR | TUNNEL | STAIRS | OBJECT));
		put_m_at(row, col, monster);
	}
}
Esempio n. 5
0
int
flame_broil(object *monster)
{
    short row, col;

    if ((!mon_sees(monster, rogue.row, rogue.col)) || coin_toss()) {
	return 0;
    }
    row = rogue.row - monster->row;
    col = rogue.col - monster->col;
    if (row < 0) {
	row = -row;
    }
    if (col < 0) {
	col = -col;
    }
    if (((row != 0) && (col != 0) && (row != col)) || ((row > 7) || (col > 7))) {
	return 0;
    }
    if ((!blind) && (!rogue_is_around(monster->row, monster->col))) {
	row = monster->row;
	col = monster->col;
	get_closer(&row, &col, rogue.row, rogue.col);
	standout();
	do {
	    mvaddch_rogue(row, col, '~');
	    refresh();
	    get_closer(&row, &col, rogue.row, rogue.col);
	} while ((row != rogue.row) || (col != rogue.col));
	standend();
	row = monster->row;
	col = monster->col;
	get_closer(&row, &col, rogue.row, rogue.col);
	do {
	    mvaddch_rogue(row, col, get_dungeon_char(row, col));
	    refresh();
	    get_closer(&row, &col, rogue.row, rogue.col);
	} while ((row != rogue.row) || (col != rogue.col));
    }
    mon_hit(monster, flame_name, 1);
    return 1;
}
Esempio n. 6
0
static void
fill_out_level(void)
{
    short i, rn;

    mix_random_rooms();

    r_de = NO_ROOM;

    for (i = 0; i < MAXROOMS; i++) {
        rn = random_rooms[i];
        if ((rooms[rn].is_room & R_NOTHING) ||
                ((rooms[rn].is_room & R_CROSS) && coin_toss())) {
            fill_it(rn, 1);
        }
    }
    if (r_de != NO_ROOM) {
        fill_it(r_de, 0);
    }
}
Esempio n. 7
0
put_objects()
{
	short i, n;
	object *obj;

	if (cur_level < max_level) {
		return;
	}
	n = coin_toss() ? get_rand(2, 4) : get_rand(3, 5);
	while (rand_percent(33)) {
		n++;
	}
	if (party_room != NO_ROOM) {
		make_party();
	}
	for (i = 0; i < n; i++) {
		obj = gr_object();
		rand_place(obj);
	}
	put_gold();
}
Esempio n. 8
0
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);
}
Esempio n. 9
0
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);
}
Esempio n. 10
0
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);
}