/*
 * Returns whether the object is known to be an artifact
 */
bool object_type::is_known_artifact()
{
    if (!is_artifact()) return (FALSE);
    if (is_known()) return (TRUE);
    if (discount == INSCRIP_INDESTRUCTIBLE) return (TRUE);
    if (discount == INSCRIP_TERRIBLE) return (TRUE);
    if (discount == INSCRIP_SPECIAL) return (TRUE);
    return (FALSE);
}
示例#2
0
/*
 *  Sun Oct  4 17:36:03 1998 -- Scott Turner
 *
 *  Find any artifact matching.
 *
 */
int
has_artifact(int who, int type, int p1, int p2, int charges)
{
  struct item_ent *e;

  loop_inv(who, e) {
    struct entity_artifact *a = is_artifact(e->item);
    if (a) {
      if (a->type == type &&
          (!p1 || a->param1 == p1) &&
          (!p2 || a->param2 == p2) && (!charges || a->uses > 0))
        return e->item;
    };
  }
  next_inv;

  return 0;
};
示例#3
0
/*
 *  Thu Oct  8 17:41:24 1998 -- Scott Turner
 *
 *  Find a combat bonus.
 *
 */
int
combat_artifact_bonus(int who, int part)
{
  struct item_ent *e;
  int best = 0;

  loop_inv(who, e) {
    struct entity_artifact *a = is_artifact(e->item);
    if (a) {
      if (a->type == ART_COMBAT && (a->param2 & part) && a->param1 > best) {
        best = a->param1;
      };
    };
  }
  next_inv;

  return best;

};
示例#4
0
/*
 *  Sun Oct  4 17:29:15 1998 -- Scott Turner
 *
 *  Find the best artifact of a given type on a noble.
 *
 */
int
best_artifact(int who, int type, int param2, int uses)
{
  struct item_ent *e;
  int best = 0;
  int best_val = 0;

  loop_inv(who, e) {
    if (is_artifact(e->item)) {
      if (rp_item_artifact(e->item)->type == type &&
          rp_item_artifact(e->item)->param1 > best_val &&
          (!param2 || rp_item_artifact(e->item)->param2 == param2) &&
          (!uses || rp_item_artifact(e->item)->uses > 0)) {
        best_val = rp_item_artifact(e->item)->param1;
        best = e->item;
      };
    };
  }
  next_inv;

  return best;
};
/*
 * Return a "feeling" (or NULL) about an item.  Method 2 (Light).
 */
s16b object_type::pseudo_light()
{
    /* Cursed items (all of them) */
    if (is_cursed()) return (INSCRIP_CURSED);

    /* Broken items (all of them) */
    if (is_broken()) return (INSCRIP_BROKEN);

    /* Artifacts -- except cursed/broken ones */
    if (is_artifact()) return (INSCRIP_GOOD_WEAK);

    /* Ego-Items -- except cursed/broken ones */
    if (is_ego_item()) return (INSCRIP_GOOD_WEAK);

    /* Good armor bonus */
    if (to_a > 0) return (INSCRIP_GOOD_WEAK);

    /* Good weapon bonuses */
    if (to_h + to_d > 0) return (INSCRIP_GOOD_WEAK);

    /* Default to "average" */
    return (INSCRIP_AVERAGE);
}
/*
 * Return a "feeling" (or NULL) about an item.  Method 1 (Heavy).
 */
s16b object_type::pseudo_heavy()
{
    /* Artifacts */
    if (is_artifact())
    {
        /* Cursed/Broken */
        if (is_cursed() || is_broken()) return (INSCRIP_TERRIBLE);

        /* Normal */
        return (INSCRIP_SPECIAL);
    }

    /* Ego-Items */
    if (is_ego_item())
    {
        /* Cursed/Broken */
        if (is_cursed() || is_broken()) return (INSCRIP_WORTHLESS);

        /* Normal */
        return (INSCRIP_EXCELLENT);
    }

    /* Cursed items */
    if (is_cursed()) return (INSCRIP_CURSED);

    /* Broken items */
    if (is_broken()) return (INSCRIP_BROKEN);

    /* Good "armor" bonus */
    if (to_a > 0) return (INSCRIP_GOOD_STRONG);

    /* Good "weapon" bonus */
    if (to_h + to_d > 0) return (INSCRIP_GOOD_STRONG);

    /* Default to "average" */
    return (INSCRIP_AVERAGE);
}
/*
 * Returns whether the object can be filled with oil
 */
bool object_type::is_fuelable_lite()
{
    if (tval != TV_LIGHT)   return (FALSE);
    if (is_artifact())      return (FALSE);
    return (TRUE);
}