/** * 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)); } }
/** * Copy all the id_other flags an object is going to get to allflags */ void flags_other(object_type *o_ptr, bitflag *all_flags) { int j; if_wipe(all_flags); /* Resists */ for (j = 0; j < MAX_P_RES; j++) if (o_ptr->percent_res[j] != RES_LEVEL_BASE) if_on(all_flags, OBJECT_ID_BASE_RESIST + j); /* Slays */ for (j = 0; j < MAX_P_SLAY; j++) if (o_ptr->multiple_slay[j] != MULTIPLE_BASE) if_on(all_flags, OBJECT_ID_BASE_SLAY + j); /* Brands */ for (j = 0; j < MAX_P_BRAND; j++) if (o_ptr->multiple_brand[j] != MULTIPLE_BASE) if_on(all_flags, OBJECT_ID_BASE_BRAND + j); /* Others */ if ((o_ptr->to_h) || is_weapon(o_ptr) || of_has(o_ptr->flags_obj, OF_SHOW_MODS)) if_on(all_flags, IF_TO_H); if ((o_ptr->to_d) || is_weapon(o_ptr) || of_has(o_ptr->flags_obj, OF_SHOW_MODS)) if_on(all_flags, IF_TO_D); if ((o_ptr->to_a) || is_armour(o_ptr)) if_on(all_flags, IF_TO_A); if ((o_ptr->ac) || is_armour(o_ptr)) { if_on(all_flags, IF_AC); if_on(all_flags, IF_TO_A); } if_on(all_flags, IF_DD_DS); }
/** * Notice other properties */ void notice_other(int other_flag, int item) { int i, j; bool already_ego = FALSE; object_type *o_ptr; 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); /* Resists */ for (j = 0; j < MAX_P_RES; j++) { if (other_flag != OBJECT_ID_BASE_RESIST + j) continue; if (o_ptr->percent_res[j] != RES_LEVEL_BASE) { if_on(o_ptr->id_other, other_flag); } } /* Slays */ for (j = 0; j < MAX_P_SLAY; j++) { if (other_flag != OBJECT_ID_BASE_SLAY + j) continue; if (o_ptr->multiple_slay[j] != MULTIPLE_BASE) { if_on(o_ptr->id_other, other_flag); } } /* Brands */ for (j = 0; j < MAX_P_BRAND; j++) { if (other_flag != OBJECT_ID_BASE_BRAND + j) continue; if (o_ptr->multiple_brand[j] != MULTIPLE_BASE) { if_on(o_ptr->id_other, other_flag); } } /* Others */ if ((other_flag == IF_TO_H) && ((o_ptr->to_h) || is_weapon(o_ptr))) if_on(o_ptr->id_other, IF_TO_H); if ((other_flag == IF_TO_D) && ((o_ptr->to_d) || is_weapon(o_ptr))) if_on(o_ptr->id_other, IF_TO_D); if ((other_flag == IF_TO_A) && ((o_ptr->ac) || is_armour(o_ptr))) if_on(o_ptr->id_other, IF_TO_A); if ((other_flag == IF_AC) && ((o_ptr->ac) || is_armour(o_ptr))) if_on(o_ptr->id_other, IF_AC); if ((other_flag == IF_DD_DS)) if_on(o_ptr->id_other, IF_DD_DS); /* 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); /* Resists */ for (j = 0; j < MAX_P_RES; j++) { if (other_flag != OBJECT_ID_BASE_RESIST + j) continue; if (o_ptr->percent_res[j] != RES_LEVEL_BASE) { if_on(o_ptr->id_other, other_flag); if ((j == INVEN_RIGHT) || (j == INVEN_LEFT) || (j == INVEN_NECK)) { if_on(o_ptr->id_other, other_flag); } } } /* Slays */ for (j = 0; j < MAX_P_SLAY; j++) { if (other_flag != OBJECT_ID_BASE_SLAY + j) continue; if (o_ptr->multiple_slay[j] != MULTIPLE_BASE) { if_on(o_ptr->id_other, other_flag); if ((j == INVEN_RIGHT) || (j == INVEN_LEFT) || (j == INVEN_NECK)) { if_on(o_ptr->id_other, other_flag); } } } /* Brands */ for (j = 0; j < MAX_P_BRAND; j++) { if (other_flag != OBJECT_ID_BASE_BRAND + j) continue; if (o_ptr->multiple_brand[j] != MULTIPLE_BASE) { if_on(o_ptr->id_other, other_flag); if ((j == INVEN_RIGHT) || (j == INVEN_LEFT) || (j == INVEN_NECK)) { if_on(o_ptr->id_other, other_flag); } } } /* Others */ if ((other_flag == IF_TO_H) && ((o_ptr->to_h) || is_weapon(o_ptr))) if_on(o_ptr->id_other, IF_TO_H); if ((other_flag == IF_TO_D) && ((o_ptr->to_d) || is_weapon(o_ptr))) if_on(o_ptr->id_other, IF_TO_D); if ((other_flag == IF_TO_A) && ((o_ptr->ac) || is_armour(o_ptr))) if_on(o_ptr->id_other, IF_TO_A); if ((other_flag == IF_AC) && ((o_ptr->ac) || is_armour(o_ptr))) if_on(o_ptr->id_other, IF_AC); if ((other_flag == IF_DD_DS)) if_on(o_ptr->id_other, IF_DD_DS); /* 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); } }