コード例 #1
0
ファイル: squelch.c プロジェクト: NickMcConnell/Beleriand
/**
 * Drop all {squelch}able items.
 */
extern void squelch_drop(void)
{
	int n;

	/* Scan through the slots backwards */
	for (n = INVEN_PACK - 1; n >= 0; n--) {
		object_type *o_ptr = &p_ptr->inventory[n];

		/* Skip non-objects and unsquelchable objects */
		if (!o_ptr->k_idx)
			continue;
		if (!squelch_item_ok(o_ptr))
			continue;

		/* Check for curses */
		if (cf_has(o_ptr->flags_curse, CF_STICKY_CARRY))
			continue;

		/* Check for !d (no drop) inscription */
		if (!check_for_inscrip(o_ptr, "!d")
			&& !check_for_inscrip(o_ptr, "!*")) {
			/* We're allowed to drop it. */
			inven_drop(n, o_ptr->number);
		}
	}

	/* Combine/reorder the pack */
	p_ptr->notice |= (PN_COMBINE | PN_REORDER);
}
コード例 #2
0
ファイル: xtra1.c プロジェクト: jcubic/ToME
/*
 * Calc which body parts the player have, based on the
 * monster he incarnate, note that that's bnot a hack
 * since body parts of the player when in it's own body
 * are also defined in r_info(monster 0)
 */
void calc_body()
{
	monster_type *body  = &p_ptr->body_monster;
	monster_race *r_ptr = &r_info[body->r_idx];
	s32b i;

	if (p_ptr->body_monster.r_idx == 0)
	{
		/* Setup for player race */
		for (i = 0; i < INVEN_TOTAL; i++)
		{
			/* Get the race/subrace slots */
			s32b max = flag_get(&p_ptr->descriptor.body_parts, i);
			if (max < 0) max = 0;

			flag_set(get_inven(p_ptr, i), INVEN_LIMIT_KEY, max);
		}
	}
	else
	{
		/* Setup for monster race */
		for (i = 0; i < INVEN_TOTAL; i++)
		{
			s32b max = flag_get(&r_ptr->body_parts, i);
			if (max < 0) max = 0;

			flag_set(get_inven(p_ptr, i), INVEN_LIMIT_KEY, max);
		}
	}

	/* Do we need more parts ? ;) */
	process_hooks(HOOK_BODY_PARTS, "()");

	/* Ok now if the player lost a body part, he must drop the object he had on it */
	for (i = 0; i < INVEN_TOTAL; i++)
	{
		flags_type *inven = get_inven(p_ptr, i);
		s32b j;

		/* For all objects that are in excess, drop them */
		for (j = flag_max_key(inven); j > inventory_limit_inven(inven); j--)
		{
			/* Drop it NOW ! */
			if (i > INVEN_INVEN)
				inven_takeoff(compute_slot(i, j), 255, TRUE, FALSE);
			else
				inven_drop(compute_slot(i, j), 255, p_ptr->py, p_ptr->px, FALSE);
		}
	}
}
コード例 #3
0
ファイル: cmd3.c プロジェクト: BackupTheBerlios/nangband
/*
 * Drop an item
 */
void do_cmd_drop(void)
{
	int item, amt;

	object_type *o_ptr;

	cptr q, s;


	/* Get an item */
	q = "Drop which item? ";
	s = "You have nothing to drop.";
	if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN))) return;

	/* Get the item (in the pack) */
	if (item >= 0)
	{
		o_ptr = &inventory[item];
	}

	/* Get the item (on the floor) */
	else
	{
		o_ptr = &o_list[0 - item];
	}

	/* Get a quantity */
	amt = get_quantity(NULL, o_ptr->number);

	/* Allow user abort */
	if (amt <= 0) return;

	/* Hack -- Cannot remove cursed items */
	if ((item >= INVEN_WIELD) && cursed_p(o_ptr))
	{
		/* Oops */
		msg_print("Hmmm, it seems to be cursed.");

		/* Nope */
		return;
	}

	/* Take a partial turn */
	p_ptr->energy_use = 50;

	/* Drop (some of) the item */
	inven_drop(item, amt);
}
コード例 #4
0
ファイル: cmd-obj.c プロジェクト: Hrrunstar/angband
/* Drop an item */
void do_cmd_drop(cmd_code code, cmd_arg args[])
{
	int item = args[0].item;
	object_type *o_ptr = object_from_item_idx(item);
	int amt = args[1].number;

	if (!item_is_available(item, NULL, USE_INVEN | USE_EQUIP))
	{
		msg("You do not have that item to drop it.");
		return;
	}

	/* Hack -- Cannot remove cursed items */
	if ((item >= INVEN_WIELD) && cursed_p(o_ptr->flags))
	{
		msg("Hmmm, it seems to be cursed.");
		return;
	}

	inven_drop(item, amt);
	p_ptr->energy_use = 50;
}
コード例 #5
0
ファイル: cmd3.c プロジェクト: NickMcConnell/poschengband
/*
 * Drop an item
 */
void do_cmd_drop(void)
{
    int item, amt = 1;

    object_type *o_ptr;

    cptr q, s;

    if (p_ptr->special_defense & KATA_MUSOU)
    {
        set_action(ACTION_NONE);
    }

    item_tester_no_ryoute = TRUE;
    /* Get an item */
    q = "Drop which item? ";
    s = "You have nothing to drop.";

    if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN))) return;

    /* Get the item (in the pack) */
    if (item >= 0)
    {
        o_ptr = &inventory[item];

        /* Ugly hack! */
        if ( object_is_melee_weapon(o_ptr) 
          && equip_is_valid_slot(item)
          && p_ptr->pclass == CLASS_PSION
          && psion_weapon_graft() )
        {
            msg_print("Failed!  Your weapon is currently grafted to your arm!");
            return;
        }
    }

    /* Get the item (on the floor) */
    else
    {
        o_ptr = &o_list[0 - item];
    }


    /* Hack -- Cannot remove cursed items */
    if (equip_is_valid_slot(item))
    {
        if (object_is_cursed(o_ptr))
        {
            msg_print("Hmmm, it seems to be cursed.");
            return;
        }
        if (have_flag(o_ptr->art_flags, TR_NO_REMOVE))
        {
            msg_print("You can't drop yourself, silly!");
            return;
        }
    }

    if (o_ptr->tval == TV_POTION && o_ptr->sval == SV_POTION_BLOOD)
    {
        msg_print("You can't do that!  Your blood will go sour!");
        return;
    }

    /* See how many items */
    if (o_ptr->number > 1)
    {
        /* Get a quantity */
        amt = get_quantity(NULL, o_ptr->number);

        /* Allow user abort */
        if (amt <= 0) return;
    }


    /* Take a partial turn */
    energy_use = 50;

    /* Drop (some of) the item */
    inven_drop(item, amt);

    if (equip_is_valid_slot(item))
        calc_android_exp();

    p_ptr->redraw |= (PR_EQUIPPY);
}
コード例 #6
0
ファイル: cmd3.c プロジェクト: fph/mortsil
/*
 * Drop an item
 */
void do_cmd_drop(void)
{
	int item, amt;

	object_type *o_ptr;

	cptr q, s;

	/* Get an item */
	q = "Drop which item? ";
	s = "You have nothing to drop.";
	if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN))) return;

	/* Get the item (in the pack) */
	if (item >= 0)
	{
		o_ptr = &inventory[item];
	}

	/* Get the item (on the floor) */
	else
	{
		o_ptr = &o_list[0 - item];
	}

	/* Get a quantity */
	amt = get_quantity(NULL, o_ptr->number);

	/* Allow user abort */
	if (amt <= 0) return;

	/* Hack -- Cannot remove cursed items */
	if ((item >= INVEN_WIELD) && cursed_p(o_ptr))
	{
		if (p_ptr->active_ability[S_WIL][WIL_CURSE_BREAKING])
		{
			/* Message */
			msg_print("With a great strength of will, you break the curse!");
			
			/* Uncurse the object */
			uncurse_object(o_ptr);						
		}
		else
		{
			/* Oops */
			msg_print("It seems to be cursed, preventing you from removing it.");
			
			/* Nope */
			return;
		}
	}

	/* Take a turn */
	p_ptr->energy_use = 100;

	// store the action type
	p_ptr->previous_action[0] = ACTION_MISC;
	
	/* Drop (some of) the item */
	inven_drop(item, amt);
}
コード例 #7
0
ファイル: cmd3.c プロジェクト: iks3/tinyangband
/*
 * Drop an item
 */
void do_cmd_drop(void)
{
	int item, amt = 1;

	object_type *o_ptr;

	cptr q, s;

	/* Get an item */
#ifdef JP
	q = "どのアイテムを落としますか? ";
	s = "落とせるアイテムを持っていない。";
#else
	q = "Drop which item? ";
	s = "You have nothing to drop.";
#endif

	if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN))) return;

	/* Get the item (in the pack) */
	if (item >= 0)
	{
		o_ptr = &inventory[item];
	}

	/* Get the item (on the floor) */
	else
	{
		o_ptr = &o_list[0 - item];
	}


	/* Hack -- Cannot remove cursed items */
	if ((item >= INVEN_WIELD) && cursed_p(o_ptr))
	{
		/* Oops */
#ifdef JP
		msg_print("ふーむ、どうやら呪われているようだ。");
#else
		msg_print("Hmmm, it seems to be cursed.");
#endif


		/* Nope */
		return;
	}


	/* See how many items */
	if (o_ptr->number > 1)
	{
		/* Get a quantity */
		amt = get_quantity(NULL, o_ptr->number);

		/* Allow user abort */
		if (amt <= 0) return;
	}


	/* Take a partial turn */
	energy_use = 50;

	/* Drop (some of) the item */
	inven_drop(item, amt);

	p_ptr->redraw |= (PR_EQUIPPY);
}