示例#1
0
void
trap_player(short row, short col)
{
    short t;

    if ((t = trap_at(row, col)) == NO_TRAP) {
	return;
    }
    dungeon[row][col] &= (~HIDDEN);
    if (rand_percent(rogue.exp + ring_exp)) {
	message(mesg[228], 1);
	return;
    }
    switch (t) {
    case TRAP_DOOR:
	trap_door = 1;
	new_level_message = trap_strings[(t * 2) + 1];
	break;
    case BEAR_TRAP:
	message(trap_strings[(t * 2) + 1], 1);
	bear_trap = get_rand(4, 7);
	break;
    case TELE_TRAP:
	mvaddch_rogue(rogue.row, rogue.col, '^');
	tele();
	break;
    case DART_TRAP:
	message(trap_strings[(t * 2) + 1], 1);
	rogue.hp_current -= get_damage("1d6", 1);
	if (rogue.hp_current <= 0) {
	    rogue.hp_current = 0;
	}
	if ((!sustain_strength) && rand_percent(40) &&
	    (rogue.str_current >= 3)) {
	    rogue.str_current--;
	}
	print_stats(STAT_HP | STAT_STRENGTH);
	if (rogue.hp_current <= 0) {
	    killed_by((object *) 0, POISON_DART);
	}
	break;
    case SLEEPING_GAS_TRAP:
	message(trap_strings[(t * 2) + 1], 1);
	take_a_nap();
	break;
    case RUST_TRAP:
	message(trap_strings[(t * 2) + 1], 1);
	rust((object *) 0);
	break;
    }
}
示例#2
0
void sleepify( object *scroll )
{
	/* (zerogue 0.4.0) Added mechanic where a scroll of sleep can be used to
	 * put nearby monsters to sleep.  Modelled after hold_monster().
	 */
	short mcount = 0 ;
	short row, col ;

	if( scroll->identified || id_scrolls[scroll->which_kind].id_status == IDENTIFIED )
	{
		for( row = (rogue.row - 2) ; row <= (rogue.row + 2) ; row++ )
		{
			for( col = (rogue.col - 2) ; col <= (rogue.col + 2) ; col++ )
			{
				if( (row<MIN_ROW) || (row>(DROWS-2)) || (col<0) || (col>(DCOLS-1)) )
					continue ;

				if( dungeon[row][col] & MONSTER )
				{
					object *monster = object_at( &level_monsters, row, col ) ;
					monster->m_flags |= ( ASLEEP | NAPPING ) ;
					monster->nap_length += get_rand( 3, ( get_rogue_level(1) + 2 ) ) ; // (zerogue 0.4.1)
					++mcount ;
				}
			}
		}
	}

	if( mcount == 0 )
	{
		message( "You fall asleep.", 0 ) ;
		take_a_nap() ;
	}
	else if( mcount == 1 )
		message( "The monster falls asleep!", 0 ) ;
	else
		message( "The monsters around you fall asleep!", 0 ) ;

	return ;
}
示例#3
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);
}
示例#4
0
文件: use.c 项目: masoo/rogueclone2s
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);
}