Exemplo n.º 1
0
void
ring_off()
{
    int ring;
    THING *obj;

    if (cur_ring[LEFT] == NULL && cur_ring[RIGHT] == NULL)
    {
	if (terse)
	    msg("no rings");
	else
	    msg("you aren't wearing any rings");
	return;
    }
    else if (cur_ring[LEFT] == NULL)
	ring = RIGHT;
    else if (cur_ring[RIGHT] == NULL)
	ring = LEFT;
    else
	if ((ring = gethand()) < 0)
	    return;
    mpos = 0;
    obj = cur_ring[ring];
    if (obj == NULL)
    {
	msg("not wearing such a ring");
	return;
    }
    if (dropcheck(obj))
	msg("was wearing %s(%c)", inv_name(obj, TRUE), obj->o_packch);
}
Exemplo n.º 2
0
/*
 * ring_on:
 *	Put on a ring
 */
int ring_on()
{
  struct object *obj;
  struct linked_list *item;
  int ring, wh;
  char buf[LINLEN];
  bool okring;

  if (cur_ring[LEFT] != NULL && cur_ring[RIGHT] != NULL) {
    msg("Already wearing two rings.");
    after = FALSE;
    return 0;
  }
  /*
   * Make certain that it is somethings that we want to wear
   */
  if ((item = get_item("put on", RING)) == NULL)
    return 0;
  obj = OBJPTR(item);
  if (obj->o_type != RING) {
    msg("That won't fit on your finger.");
    return 0;
  }
  /*
   * find out which hand to put it on
   */
  if (is_current(obj))
    return 0;
  if (cur_ring[LEFT] == NULL && cur_ring[RIGHT] == NULL) {
    if ((ring = gethand(FALSE)) < 0)
      return 0;
  } else if (cur_ring[LEFT] == NULL)
    ring = LEFT;
  else
    ring = RIGHT;
  cur_ring[ring] = obj;
  wh = obj->o_which;
  /*
   * okring = FALSE when:
   * 1) ring is cursed and benefit = plus
   * 2) ring is blessed and benefit = minus
   */
  okring = !((obj->o_ac > 0 && o_on(obj, ISCURSED)) ||
             (obj->o_ac < 0 && o_on(obj, ISBLESS)));
  /*
   * Calculate the effect it has on the poor guy (if possible).
   */
  if (okring) {
    switch (wh) {
    case R_SPEED:
      if (--obj->o_ac < 0) {
        obj->o_ac = 0;
        setoflg(obj, ISCURSED);
      } else {
        add_haste(FALSE);
        msg("You find yourself moving must faster.");
      }
      when R_GIANT : /* to 24 */
                     him->s_ef.a_str = MAXSTR;
      when R_ADDSTR : chg_abil(STR, obj->o_ac, FROMRING);
      when R_KNOW : chg_abil(WIS, obj->o_ac, FROMRING);
      when R_DEX : chg_abil(DEX, obj->o_ac, FROMRING);
      when R_CONST : chg_abil(CON, obj->o_ac, FROMRING);
      when R_SEEINVIS : player.t_flags |= CANSEE;
      light(&hero);
      mvwaddch(cw, hero.y, hero.x, PLAYER);
      when R_AGGR : aggravate();
      when R_HEAVY : updpack(); /* new pack weight */
      when R_BLIND : r_know[R_BLIND] = TRUE;
      player.t_flags |= ISBLIND;
      look(FALSE);
      when R_SLOW : player.t_flags |= ISSLOW;
      when R_SAPEM : fuse(sapem, TRUE, 150);
      when R_LIGHT:
      {
        struct room *rop;

        r_know[R_LIGHT] = TRUE;
        if ((rop = player.t_room) != NULL) {
          rop->r_flags &= ~ISDARK;
          light(&hero);
          mvwaddch(cw, hero.y, hero.x, PLAYER);
        }
      }
    }
  }
  if (r_know[wh] && r_guess[wh]) {
    free(r_guess[wh]);
    r_guess[wh] = NULL;
  } else if (!r_know[wh] && r_guess[wh] == NULL) {
    mpos = 0;
    strcpy(buf, r_stones[wh]);
    msg(callit);
    if (get_str(buf, cw) == NORM) {
      r_guess[wh] = new (strlen(buf) + 1);
      strcpy(r_guess[wh], buf);
    }
Exemplo n.º 3
0
void
ring_on()
{
    THING *obj;
    int ring;

    obj = get_item("put on", RING);
    /*
     * Make certain that it is somethings that we want to wear
     */
    if (obj == NULL)
	return;
    if (obj->o_type != RING)
    {
	if (!terse)
	    msg("it would be difficult to wrap that around a finger");
	else
	    msg("not a ring");
	return;
    }

    /*
     * find out which hand to put it on
     */
    if (is_current(obj))
	return;

    if (cur_ring[LEFT] == NULL && cur_ring[RIGHT] == NULL)
    {
	if ((ring = gethand()) < 0)
	    return;
    }
    else if (cur_ring[LEFT] == NULL)
	ring = LEFT;
    else if (cur_ring[RIGHT] == NULL)
	ring = RIGHT;
    else
    {
	if (!terse)
	    msg("you already have a ring on each hand");
	else
	    msg("wearing two");
	return;
    }
    cur_ring[ring] = obj;

    /*
     * Calculate the effect it has on the poor guy.
     */
    switch (obj->o_which)
    {
	case R_ADDSTR:
	    chg_str(obj->o_arm);
	    break;
	case R_SEEINVIS:
	    invis_on();
	    break;
	case R_AGGR:
	    aggravate();
	    break;
    }

    if (!terse)
	addmsg("you are now wearing ");
    msg("%s (%c)", inv_name(obj, TRUE), obj->o_packch);
}