Example #1
0
/**
 * Provide information on an ego-item type
 */
textblock *object_info_ego(struct ego_item * ego)
{
	object_kind *kind = NULL;
	object_type obj = { 0 };
	int i;

	for (i = 0; i < z_info->k_max; i++) {
		kind = &k_info[i];
		if (!kind->name)
			continue;
		if (kind->tval == ego->tval[0])
			break;
	}

	obj.kind = kind;
	obj.tval = kind->tval;
	obj.sval = kind->sval;
	obj.name2 = ego->eidx;
	of_union(obj.flags_obj, ego->flags_obj);
	cf_union(obj.flags_curse, ego->flags_curse);
	for (i = 0; i < MAX_P_RES; i++)
		obj.percent_res[i] = ego->percent_res[i];
	for (i = 0; i < A_MAX; i++)
		obj.bonus_stat[i] = ego->bonus_stat[i];
	for (i = 0; i < MAX_P_BONUS; i++)
		obj.bonus_other[i] = ego->bonus_other[i];
	for (i = 0; i < MAX_P_SLAY; i++)
		obj.multiple_slay[i] = ego->multiple_slay[i];
	for (i = 0; i < MAX_P_BRAND; i++)
		obj.multiple_brand[i] = ego->multiple_brand[i];

	return object_info_out(&obj, OINFO_FULL | OINFO_EGO | OINFO_DUMMY);
}
Example #2
0
/** 
 * Label an item as an ego item if it has the required flags
 */
void label_as_ego(object_type * o_ptr, int item)
{
    char o_name[120];
    int j;
    int temp_flag;
    ego_item_type *e_ptr = &e_info[o_ptr->name2];

    /* All ego object flags now known */
    of_union(o_ptr->id_obj, e_ptr->flags_obj);

    /* All shown curses are now known */
    if (of_has(e_ptr->flags_obj, OF_SHOW_CURSE))
	cf_union(o_ptr->id_curse, e_ptr->flags_curse);

    /* Know all ego resists */
    for (j = 0; j < MAX_P_RES; j++) {
	temp_flag = OBJECT_ID_BASE_RESIST + j;
	if (e_ptr->percent_res[j] != RES_LEVEL_BASE)
	    if_on(o_ptr->id_other, temp_flag);
    }

    /* Know all ego slays */
    for (j = 0; j < MAX_P_SLAY; j++) {
	temp_flag = OBJECT_ID_BASE_SLAY + j;
	if (e_ptr->multiple_slay[j] != MULTIPLE_BASE)
	    if_on(o_ptr->id_other, temp_flag);
    }

    /* Know all ego brands */
    for (j = 0; j < MAX_P_BRAND; j++) {
	temp_flag = OBJECT_ID_BASE_BRAND + j;
	if (e_ptr->multiple_brand[j] != MULTIPLE_BASE)
	    if_on(o_ptr->id_other, temp_flag);
    }

    /* Combine / Reorder the pack (later) */
    p_ptr->notice |= (PN_COMBINE | PN_REORDER);

    /* Redraw stuff */
    p_ptr->redraw |= (PR_INVEN | PR_EQUIP | PR_BASIC | PR_EXTRA);

    /* Handle stuff */
    handle_stuff(p_ptr);

    /* Description */
    object_desc(o_name, sizeof(o_name), o_ptr, ODESC_PREFIX | ODESC_FULL);

    /* Describe */
    if (item - 1 >= INVEN_WIELD) {
	char *m = format("%s: %s (%c).", describe_use(item - 1), o_name, 
			 index_to_label(item - 1));
	my_strcap(m);
	msg(m);
    } else if (item - 1 >= 0) {
	msg("In your pack: %s (%c).", o_name, index_to_label(item));
    }
}
Example #3
0
/**
 * Hack - Know inventory and home items upon death
 */
static void death_knowledge(void)
{
    int i, which = 0;

    object_type *o_ptr;

    store_type *st_ptr = NULL;

    /* Get the store number of the home */
    if (OPT(adult_dungeon))
	which = NUM_TOWNS_SMALL * 4 + STORE_HOME;
    else {
	for (i = 0; i < NUM_TOWNS; i++) {
	    /* Found the town */
	    if (p_ptr->home == towns[i]) {
		which += (i < NUM_TOWNS_SMALL ? 3 : STORE_HOME);
		break;
	    }
	    /* Next town */
	    else
		which +=
		    (i < NUM_TOWNS_SMALL ? MAX_STORES_SMALL : MAX_STORES_BIG);
	}
    }

    /* Hack -- Know everything in the inven/equip */
    for (i = 0; i < ALL_INVEN_TOTAL; i++) {
	o_ptr = &p_ptr->inventory[i];

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

	/* Aware and Known */
	object_aware(o_ptr);
	object_known(o_ptr);

	/* Fully known */
	cf_union(o_ptr->id_curse, o_ptr->flags_curse);
    }

    /* Thralls sometimes (often!) don't have a home */
    if (p_ptr->home) {
	/* Activate the store */
	st_ptr = &store[which];


	/* Hack -- Know everything in the home */
	for (i = 0; i < st_ptr->stock_num; i++) {
	    o_ptr = &st_ptr->stock[i];

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

	    /* Aware and Known */
	    object_aware(o_ptr);
	    object_known(o_ptr);

	    /* Fully known */
	    cf_union(o_ptr->id_curse, o_ptr->flags_curse);
	}
    }

    history_unmask_unknown();

    /* Hack -- Recalculate bonuses */
    p_ptr->update |= (PU_BONUS);

    /* Handle stuff */
    handle_stuff();
}