Changeset 420

Show
Ignore:
Timestamp:
08/01/07 10:07:00 (1 year ago)
Author:
takkaria
Message:
  • Make CLW, CSW, CCW potions heal % of HP, not just xdy. (#313) This should be extended to spells, too.
  • Fix unrelated warning in obj-info.c, fallout from [404].
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/effects.c

    r419 r420  
    248248                case EF_CURE_LIGHT: 
    249249                { 
    250                         if (hp_player(damroll(2, 8))) *ident = TRUE; 
     250                        if (heal_player(5, 10)) *ident = TRUE; 
    251251                        if (clear_timed(TMD_BLIND)) *ident = TRUE; 
    252252                        if (dec_timed(TMD_CUT, 10)) *ident = TRUE; 
     
    256256                case EF_CURE_SERIOUS: 
    257257                { 
    258                         if (hp_player(damroll(4, 8))) *ident = TRUE; 
     258                        if (heal_player(15, 21)) *ident = TRUE; 
    259259                        if (set_timed(TMD_CUT, (p_ptr->timed[TMD_CUT] / 2) - 50)) *ident = TRUE; 
    260260                        if (clear_timed(TMD_BLIND)) *ident = TRUE; 
     
    266266                case EF_CURE_CRITICAL: 
    267267                { 
    268                         if (hp_player(damroll(6, 8))) *ident = TRUE; 
     268                        if (heal_player(30, 30)) *ident = TRUE; 
    269269                        if (clear_timed(TMD_BLIND)) *ident = TRUE; 
    270270                        if (clear_timed(TMD_CONFUSED)) *ident = TRUE; 
  • trunk/src/effects.h

    r415 r420  
    6060        EFFECT(CURE_BODY,      FALSE, "heals cut damage, and cures stunning, poison and blindness") 
    6161 
    62         EFFECT(CURE_LIGHT,     FALSE, "restores 2d8 hit points, heals some cut damage and cures blindness") 
    63         EFFECT(CURE_SERIOUS,   FALSE, "restores 4d8 hit points, heals some cut damage and cures blindness and confusion") 
    64         EFFECT(CURE_CRITICAL,  FALSE, "restores 6d8 hit points, heals cut damage, and cures poison, blindness, and confusion") 
     62        EFFECT(CURE_LIGHT,     FALSE, "heals you a little (5% or 12HP), and heals some cut damage and cures blindness") 
     63        EFFECT(CURE_SERIOUS,   FALSE, "heals you a little (15% or 21HP), heals some cut damage and cures blindness and confusion") 
     64        EFFECT(CURE_CRITICAL,  FALSE, "heals you a little (30% or 30HP), heals cut damage, and cures poison, blindness, and confusion") 
    6565        EFFECT(CURE_FULL,      FALSE, "restores 300 hit points, heals cut damage, and cures stunning, poison, blindness, and confusion") 
    6666        EFFECT(CURE_FULL2,     FALSE, "restores 1200 hit points, heals cut damage, and cures stunning, poison, blindness, and confusion") 
  • trunk/src/externs.h

    r410 r420  
    516516/* spells2.c */ 
    517517extern bool hp_player(int num); 
     518extern bool heal_player(int perc, int min); 
    518519extern void warding_glyph(void); 
    519520extern bool do_dec_stat(int stat); 
  • trunk/src/obj-info.c

    r404 r420  
    519519 
    520520        int effect, base, dice, sides; 
    521         char temp[] = "x"; 
    522521 
    523522        if (o_ptr->name1) 
     
    566565        do 
    567566        { 
    568                 temp[0] = *desc; 
    569  
    570567                if (isdigit((unsigned char) *desc) || isdigit((unsigned char) *(desc + 1))) 
    571                         text_out_c(TERM_L_GREEN, temp); 
     568                        text_out_c(TERM_L_GREEN, "%c", *desc); 
    572569                else 
    573                         text_out(temp); 
     570                        text_out("%c", *desc); 
    574571        } while (*desc++); 
    575572 
     
    637634                        bool unique = (r_info[o_ptr->origin_xtra].flags1 & RF1_UNIQUE) ? TRUE : FALSE; 
    638635 
    639                         text_out("dropped by %s%s", is_a_vowel(name[0]) ? "an " : "a ", name); 
     636                        text_out("dropped by "); 
     637 
     638                        if (unique) 
     639                                text_out("%s", name); 
     640                        else 
     641                                text_out("%s%s", is_a_vowel(name[0]) ? "an " : "a ", name); 
    640642 
    641643                        break; 
  • trunk/src/spells2.c

    r399 r420  
    3939                p_ptr->window |= (PW_PLAYER_0 | PW_PLAYER_1); 
    4040 
    41                 /* Heal 0-4 */ 
     41                /* Print a nice message */ 
    4242                if (num < 5) 
    43                 { 
    4443                        msg_print("You feel a little better."); 
    45                 } 
    46  
    47                 /* Heal 5-14 */ 
    4844                else if (num < 15) 
    49                 { 
    5045                        msg_print("You feel better."); 
    51                 } 
    52  
    53                 /* Heal 15-34 */ 
    5446                else if (num < 35) 
    55                 { 
    5647                        msg_print("You feel much better."); 
    57                 } 
    58  
    59                 /* Heal 35+ */ 
    6048                else 
    61                 { 
    6249                        msg_print("You feel very good."); 
    63                 } 
    6450 
    6551                /* Notice */ 
     
    7056        return (FALSE); 
    7157} 
     58 
     59 
     60/* 
     61 * Heal the player by a given percentage of his wounds, or a minimum 
     62 * amount, whichever is larger. 
     63 * 
     64 * Copied wholesale from EyAngband. 
     65 */ 
     66bool heal_player(int perc, int min) 
     67{ 
     68        int i; 
     69 
     70        /* Paranoia */ 
     71        if ((perc <= 0) && (min <= 0)) return (FALSE); 
     72 
     73 
     74        /* No healing needed */ 
     75        if (p_ptr->chp >= p_ptr->mhp) return (FALSE); 
     76 
     77        /* Figure healing level */ 
     78        i = ((p_ptr->mhp - p_ptr->chp) * perc) / 100; 
     79 
     80        /* Enforce minimums */ 
     81        if (i < min) i = min; 
     82 
     83        /* Actual healing */ 
     84        return hp_player(i); 
     85} 
     86 
     87 
    7288 
    7389