/** * Notice random effect curses */ void notice_curse(int curse_flag, int item) { object_type *o_ptr; int i; bool already_ego = FALSE; if (item) { if (item > 0) o_ptr = &p_ptr->inventory[item - 1]; else o_ptr = &o_list[0 - item]; already_ego = has_ego_properties(o_ptr); if (cf_has(o_ptr->flags_curse, curse_flag)) { cf_on(o_ptr->id_curse, curse_flag); o_ptr->ident |= IDENT_CURSED; /* Ego item? */ if (already_ego != has_ego_properties(o_ptr)) label_as_ego(o_ptr, item); } /* Fully identified now? */ if (known_really(o_ptr)) identify_object(o_ptr); return; } for (i = INVEN_WIELD; i <= INVEN_FEET; i++) { o_ptr = &p_ptr->inventory[i]; already_ego = has_ego_properties(o_ptr); /* Look for curses */ if (cf_has(o_ptr->flags_curse, curse_flag)) { /* Found one */ cf_on(o_ptr->id_curse, curse_flag); o_ptr->ident |= IDENT_CURSED; /* Ego item? */ if (already_ego != has_ego_properties(o_ptr)) label_as_ego(o_ptr, item); } /* Fully identified now? */ if (known_really(o_ptr)) identify_object(o_ptr); } }
/** * 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); }
/* * Describe an item's curses. */ static bool describe_curses(textblock * tb, const object_type * o_ptr, oinfo_detail_t mode) { size_t i; bool printed = FALSE; bool full = mode & OINFO_FULL; bool terse = mode & OINFO_TERSE; bool dummy = mode & OINFO_DUMMY; for (i = 0; i < N_ELEMENTS(curses); i++) { if (cf_has (full ? o_ptr->flags_curse : o_ptr->id_curse, curses[i].flag)) { if (!printed) textblock_append(tb, "\nCurses: "); textblock_append(tb, "%s. ", curses[i].name); printed = TRUE; } } if (printed) { textblock_append(tb, "\n"); /* Say if the curse is permanent */ if (of_has(o_ptr->id_obj, OF_PERMA_CURSE)) textblock_append(tb, "It cannot be uncursed. "); /* Say if curse removal has been tried */ if (of_has(o_ptr->flags_obj, OF_FRAGILE)) textblock_append(tb, "Attempting to uncurse it may destroy it.\n"); } if (terse || dummy) return printed; /* Only look at wieldables */ if (wield_slot(o_ptr) >= INVEN_WIELD) { /* All normal properties known */ if (o_ptr->ident & IDENT_KNOWN) { /* Everything known */ if (o_ptr->ident & (IDENT_KNOW_CURSES | IDENT_UNCURSED)) { textblock_append(tb, "You know all about this object.\n"); printed = TRUE; } /* Some unknown curses */ else { textblock_append(tb, "You know all the enchantments on this object.\n"); printed = TRUE; } } /* Curses known */ else { /* Known uncursed */ if (o_ptr->ident & IDENT_UNCURSED) { textblock_append(tb, "It is not cursed.\n"); printed = TRUE; } /* Say if all curses are known */ else if (o_ptr->ident & IDENT_KNOW_CURSES) { textblock_append(tb, "You know all the curses on this object.\n"); printed = TRUE; } } } return printed; }