All pastes #30204 Raw Edit

cavehippo

public text v1 · immutable
#30204 ·published 2005-11-22 03:43 UTC
rendered paste body
Index: server/spell_effect.c
===================================================================
RCS file: /cvsroot/crossfire/crossfire/server/spell_effect.c,v
retrieving revision 1.144
diff -C5 -r1.144 spell_effect.c
*** server/spell_effect.c       16 Nov 2005 08:16:09 -0000      1.144
--- server/spell_effect.c       22 Nov 2005 03:42:27 -0000
***************
*** 1866,1905 ****
  /* This function removes the cursed/damned status on equipped
   * items.
   */
  int remove_curse(object *op, object *caster, object *spell) {
      object *tmp;
!     int success = 0, was_one = 0;

!     for (tmp = op->inv; tmp; tmp = tmp->below)
!       if (QUERY_FLAG(tmp, FLAG_APPLIED) &&
!          ((QUERY_FLAG(tmp, FLAG_CURSED) && QUERY_FLAG(spell, FLAG_CURSED)) ||
!           (QUERY_FLAG(tmp, FLAG_DAMNED) && QUERY_FLAG(spell, FLAG_DAMNED)))) {
!
!           was_one++;
!           if (tmp->level <= caster_level(caster, spell)) {
!               success++;
                if (QUERY_FLAG(spell, FLAG_DAMNED))
                    CLEAR_FLAG(tmp, FLAG_DAMNED);
-
                CLEAR_FLAG(tmp, FLAG_CURSED);
                CLEAR_FLAG(tmp, FLAG_KNOWN_CURSED);
-               tmp->value = 0; /* Still can't sell it */
                if (op->type == PLAYER)
                    esrv_send_item(op, tmp);
            }
        }
!
      if (op->type==PLAYER) {
        if (success) {
            new_draw_info(NDI_UNIQUE, 0,op, "You feel like some of your items are looser now.");
!       } else {
!           if (was_one)
!               new_draw_info(NDI_UNIQUE, 0,op, "You failed to remove the curse.");
!           else
!               new_draw_info(NDI_UNIQUE, 0,op, "You are not using any cursed items.");
!       }
      }
      return success;
  }

  /* Identifies objects in the players inventory/on the ground */
--- 1866,1920 ----
  /* This function removes the cursed/damned status on equipped
   * items.
   */
  int remove_curse(object *op, object *caster, object *spell) {
      object *tmp;
!     int success = 0, num_uncurse = 0;

!     num_uncurse = spell->stats.dam + SP_level_dam_adjust(caster, spell);
!     if (num_uncurse < 1) num_uncurse=1;
!
!     for (tmp = op->inv; tmp; tmp = tmp->below) {
!       if ((QUERY_FLAG(tmp, FLAG_CURSED) && QUERY_FLAG(spell, FLAG_CURSED)) ||
!           (QUERY_FLAG(tmp, FLAG_DAMNED) && QUERY_FLAG(spell, FLAG_DAMNED))) {
!           num_uncurse--;
!           success=1;
!           if (QUERY_FLAG(spell, FLAG_DAMNED))
!               CLEAR_FLAG(tmp, FLAG_DAMNED);
!           CLEAR_FLAG(tmp, FLAG_CURSED);
!           CLEAR_FLAG(tmp, FLAG_KNOWN_CURSED);
!           if (op->type == PLAYER)
!               esrv_send_item(op, tmp);
!           if (!num_uncurse) break;
!       }
!     }
!
!     /* If all the power of the spell has been used up, don't go and uncurse
!      * stuff on the floor.  Only uncurse stuff on the floor if the spell
!      * was not fully used.
!      */
!     if (num_uncurse) {
!       for(tmp = get_map_ob(op->map,op->x,op->y);tmp!=NULL;tmp=tmp->above) {
!           if ((QUERY_FLAG(tmp, FLAG_CURSED) && QUERY_FLAG(spell, FLAG_CURSED)) ||
!               (QUERY_FLAG(tmp, FLAG_DAMNED) && QUERY_FLAG(spell, FLAG_DAMNED))) {
!               num_uncurse--;
!               success=1;
                if (QUERY_FLAG(spell, FLAG_DAMNED))
                    CLEAR_FLAG(tmp, FLAG_DAMNED);
                CLEAR_FLAG(tmp, FLAG_CURSED);
                CLEAR_FLAG(tmp, FLAG_KNOWN_CURSED);
                if (op->type == PLAYER)
                    esrv_send_item(op, tmp);
+               if (!num_uncurse) break;
            }
        }
!     }
      if (op->type==PLAYER) {
        if (success) {
            new_draw_info(NDI_UNIQUE, 0,op, "You feel like some of your items are looser now.");
!       } else
!           new_draw_info(NDI_UNIQUE, 0,op, "You can't reach any cursed items.");
      }
      return success;
  }

  /* Identifies objects in the players inventory/on the ground */