/** * Try to find an ego-item for an object, setting o_ptr->ego if successful and * applying various bonuses. */ static void make_ego_item(object_type *o_ptr, int level) { /* Cannot further improve artifacts or ego items */ if (o_ptr->artifact || o_ptr->ego) return; /* Occasionally boost the generation level of an item */ if (level > 0 && one_in_(GREAT_EGO)) level = 1 + (level * MAX_DEPTH / randint1(MAX_DEPTH)); /* Try to get a legal ego type for this item */ o_ptr->ego = ego_find_random(o_ptr, level); /* Actually apply the ego template to the item */ if (o_ptr->ego) ego_apply_magic(o_ptr, level); return; }
/** * Try to find an ego-item for an object, setting o_ptr->ego if successful and * applying various bonuses. */ static void make_ego_item(struct object *o_ptr, int level) { /* Cannot further improve artifacts or ego items */ if (o_ptr->artifact || o_ptr->ego) return; /* Occasionally boost the generation level of an item */ if (level > 0 && one_in_(z_info->great_ego)) level = 1 + (level * z_info->max_depth / randint1(z_info->max_depth)); /* Try to get a legal ego type for this item */ o_ptr->ego = ego_find_random(o_ptr, level); /* Actually apply the ego template to the item */ if (o_ptr->ego) ego_apply_magic(o_ptr, level); /* Ego lights are always known as such (why? - NRM) */ if (tval_is_light(o_ptr)) id_on(o_ptr->id_flags, ID_EGO_ITEM); return; }
/** * Try to find an ego-item for an object, setting obj->ego if successful and * applying various bonuses. */ static void make_ego_item(struct object *obj, int level) { /* Cannot further improve artifacts or ego items */ if (obj->artifact || obj->ego) return; /* Occasionally boost the generation level of an item */ if (level > 0 && one_in_(z_info->great_ego)) { level = 1 + (level * z_info->max_depth / randint1(z_info->max_depth)); /* Ensure valid allocation level */ if (level >= z_info->max_depth) level = z_info->max_depth - 1; } /* Try to get a legal ego type for this item */ obj->ego = ego_find_random(obj, level); /* Actually apply the ego template to the item */ if (obj->ego) ego_apply_magic(obj, level); return; }