Exemple #1
0
/*!
 * @brief 指定された地点の地形IDを変更する /
 * Create desired feature
 * @return なし
 */
static void do_cmd_wiz_create_feature(void)
{
	static int   prev_feat = 0;
	static int   prev_mimic = 0;
	cave_type    *c_ptr;
	feature_type *f_ptr;
	char         tmp_val[160];
	int          tmp_feat, tmp_mimic;
	int          y, x;

	if (!tgt_pt(&x, &y)) return;

	c_ptr = &cave[y][x];

	/* Default */
	sprintf(tmp_val, "%d", prev_feat);

	/* Query */
	if (!get_string(_("地形: ", "Feature: "), tmp_val, 3)) return;

	/* Extract */
	tmp_feat = atoi(tmp_val);
	if (tmp_feat < 0) tmp_feat = 0;
	else if (tmp_feat >= max_f_idx) tmp_feat = max_f_idx - 1;

	/* Default */
	sprintf(tmp_val, "%d", prev_mimic);

	/* Query */
	if (!get_string(_("地形 (mimic): ", "Feature (mimic): "), tmp_val, 3)) return;

	/* Extract */
	tmp_mimic = atoi(tmp_val);
	if (tmp_mimic < 0) tmp_mimic = 0;
	else if (tmp_mimic >= max_f_idx) tmp_mimic = max_f_idx - 1;

	cave_set_feat(y, x, tmp_feat);
	c_ptr->mimic = tmp_mimic;

	f_ptr = &f_info[get_feat_mimic(c_ptr)];

	if (have_flag(f_ptr->flags, FF_GLYPH) ||
	    have_flag(f_ptr->flags, FF_MINOR_GLYPH))
		c_ptr->info |= (CAVE_OBJECT);
	else if (have_flag(f_ptr->flags, FF_MIRROR))
		c_ptr->info |= (CAVE_GLOW | CAVE_OBJECT);

	/* Notice */
	note_spot(y, x);

	/* Redraw */
	lite_spot(y, x);

	/* Update some things */
	p_ptr->update |= (PU_FLOW);

	prev_feat = tmp_feat;
	prev_mimic = tmp_mimic;
}
Exemple #2
0
/*!
 * @brief 必ず成功するウィザードモード用次元の扉処理 / Wizard Dimension Door
 * @return 実際にテレポートを行ったらTRUEを返す
 */
static bool wiz_dimension_door(void)
{
	int	x = 0, y = 0;

	if (!tgt_pt(&x, &y)) return FALSE;

	teleport_player_to(y, x, TELEPORT_NONMAGICAL);

	return (TRUE);
}
Exemple #3
0
/*
 * Mirror Master's Dimension Door
 */
bool mirror_tunnel(void)
{
    int x = 0, y = 0;

    /* Rerutn FALSE if cancelled */
    if (!tgt_pt(&x, &y)) return FALSE;

    if (dimension_door_aux(x, y, p_ptr->lev / 2 + 10)) return TRUE;

#ifdef JP
    msg_print("鏡の世界をうまく通れなかった!");
#else
    msg_print("You fail to pass the mirror plane correctly!");
#endif

    return TRUE;
}
static void _jump_spell(int cmd, variant *res)
{
    switch (cmd)
    {
    case SPELL_NAME:
        var_set_string(res, "Jump");
        break;
    case SPELL_DESC:
        var_set_string(res, "Leap a short distance, clearing any intervening monsters or obstacles.");
        break;
    case SPELL_CAST:
    {
        int x, y;
        int len = 2 + p_ptr->lev/35;

        var_set_bool(res, FALSE);

        if (!tgt_pt(&x, &y, len)) return;

        if (distance(y, x, py, px) > len)
        {
            msg_print("You can't jump that far.");
            return;
        }
        if (!los(py, px, y, x))
        {
            msg_print("You can't see that location.");
            return;
        }
        if (!cave_player_teleportable_bold(y, x, 0L))
        {
            msg_print("You can't leap there!");
            return;
        }
        teleport_player_to(y, x, 0L);

        var_set_bool(res, TRUE);
        break;
    }
    default:
        default_spell(cmd, res);
        break;
    }
}
static bool _elemental_travel(int flag)
{
    int  rng = p_ptr->lev / 2 + 10;
    int  x, y;

    if (!tgt_pt(&x, &y, rng)) return FALSE;
    if (!in_bounds(y, x)) return FALSE;

    if (!cave_have_flag_bold(y, x, flag))
    {
        msg_print("Failed! You are out of your element!");
        teleport_player((p_ptr->lev + 2) * 2, TELEPORT_PASSIVE);
    }
    else if (one_in_(7))
    {
        msg_print("You failed to travel correctly!");
        teleport_player((p_ptr->lev + 2) * 2, TELEPORT_PASSIVE);
    }
    else
        teleport_player_to(y, x, 0);

    return TRUE;
}
Exemple #6
0
/*
 * Turns a simple pet into a faithful companion
 */
void do_cmd_companion()
{
	monster_type *m_ptr;
	s32b ii, jj;

	if (!can_create_companion())
	{
		msg_print("You cannot get anymore companion.");
		return;
	}

	if (!tgt_pt(&ii, &jj))
	{
		msg_print("You must target a pet.");
		return;
	}

	if (cave[jj][ii].m_idx)
	{
		char m_name[100];

		m_ptr = get_monster(cave[jj][ii].m_idx);

		monster_desc(m_name, m_ptr, 0);
		if (m_ptr->faction == FACTION_PLAYER)
		{
			bool_flag(m_ptr, FLAG_PERMANENT);
			msg_format("%^s agrees to follow you.", m_name);
		}
		else
		{
			msg_format("%^s is not in your faction!", m_name);
		}
	}
	else
		msg_print("You must target a monster of your own faction.");
}
static void _mirror_tunnel_spell(int cmd, variant *res)
{
    switch (cmd)
    {
    case SPELL_NAME:
        var_set_string(res, "Mirror Tunnel");
        break;
    case SPELL_DESC:
        if (_on_mirror)
            var_set_string(res, "Quickly teleport to a given location.");
        else
            var_set_string(res, "Teleport to a given location.");
        break;
    case SPELL_CAST:
    {
        int x = 0, y = 0;
        var_set_bool(res, FALSE);

        msg_print("You go through the mirror world ...");
        if (!tgt_pt(&x, &y, p_ptr->lev / 2 + 10)) return;
        if (!dimension_door_aux(x, y, p_ptr->lev / 2 + 10))
            msg_print("You fail to pass into the mirror plane correctly!");

        var_set_bool(res, TRUE);
        break;
    }
    case SPELL_ENERGY:
        if (_on_mirror)
        {
            var_set_int(res, 50);
            break;
        }
    default:
        default_spell(cmd, res);
        break;
    }
}