예제 #1
0
void
id_trap(void)
{
	short dir, row, col, d, t;

	messagef(0, "direction? ");

	while (!is_direction(dir = rgetchar(), &d)) {
		beep();
	}
	check_message();

	if (dir == CANCEL) {
		return;
	}
	row = rogue.row;
	col = rogue.col;

	get_dir_rc(d, &row, &col, 0);

	if ((dungeon[row][col] & TRAP) && (!(dungeon[row][col] & HIDDEN))) {
		t = trap_at(row, col);
		messagef(0, "%s", trap_strings[t*2]);
	} else {
		messagef(0, "no trap there");
	}
}
예제 #2
0
파일: hit.c 프로젝트: AhmadTux/DragonFlyBSD
void
fight(boolean to_the_death)
{
	short ch, c, d;
	short row, col;
	boolean first_miss = 1;
	short possible_damage;
	object *monster;

	while (!is_direction(ch = rgetchar(), &d)) {
		sound_bell();
		if (first_miss) {
			message("direction?", 0);
			first_miss = 0;
		}
	}
	check_message();
	if (ch == CANCEL) {
		return;
	}
	row = rogue.row; col = rogue.col;
	get_dir_rc(d, &row, &col, 0);

	c = mvinch(row, col);
	if (((c < 'A') || (c > 'Z')) ||
		(!can_move(rogue.row, rogue.col, row, col))) {
		message("I see no monster there", 0);
		return;
	}
	if (!(fight_monster = object_at(&level_monsters, row, col))) {
		return;
	}
	if (!(fight_monster->m_flags & STATIONARY)) {
		possible_damage = ((get_damage(fight_monster->m_damage, 0) * 2) / 3);
	} else {
		possible_damage = fight_monster->stationary_damage - 1;
	}
	while (fight_monster) {
		one_move_rogue(ch, 0);
		if (((!to_the_death) && (rogue.hp_current <= possible_damage)) ||
			interrupted || (!(dungeon[row][col] & MONSTER))) {
			fight_monster = NULL;
		} else {
			monster = object_at(&level_monsters, row, col);
			if (monster != fight_monster) {
				fight_monster = NULL;
			}
		}
	}
}
예제 #3
0
void
id_trap(void)
{
    short dir, row, col;
    short t;

    dir = get_direction();
    if (dir == CANCEL) {
	return;
    }
    row = rogue.row;
    col = rogue.col;

    get_dir_rc(dir, &row, &col, 0);

    if ((dungeon[row][col] & TRAP) && (!(dungeon[row][col] & HIDDEN))) {
	t = trap_at(row, col);
	message(trap_strings[t * 2], 0);
    } else {
	message(mesg[229], 0);
    }
}