Show
Ignore:
Timestamp:
05/16/08 12:16:53 (3 months ago)
Author:
takkaria
Message:

Add the IMPAIR_HP and IMPAIR_MANA, and change the regeneration algorithm:

  • Food level only affects HP regeneration
  • HP/mana impairment means halving the rate of regeneration.
Files:

Legend:

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

    r899 r901  
    744744        } 
    745745 
     746        /* Getting Faint */ 
     747        if (p_ptr->food < PY_FOOD_FAINT) 
     748        { 
     749                /* Faint occasionally */ 
     750                if (!p_ptr->timed[TMD_PARALYZED] && one_in_(10)) 
     751                { 
     752                        /* Message */ 
     753                        msg_print("You faint from the lack of food."); 
     754                        disturb(1, 0); 
     755 
     756                        /* Hack -- faint (bypass free action) */ 
     757                        (void)inc_timed(TMD_PARALYZED, 1 + randint0(5)); 
     758                } 
     759        } 
     760 
     761 
    746762        /* Starve to death (slowly) */ 
    747763        if (p_ptr->food < PY_FOOD_STARVE) 
     
    754770        } 
    755771 
     772        /** Regenerate HP **/ 
     773 
    756774        /* Default regeneration */ 
    757         regen_amount = PY_REGEN_NORMAL; 
    758  
    759         /* Getting Weak */ 
    760         if (p_ptr->food < PY_FOOD_WEAK) 
    761         { 
    762                 /* Lower regeneration */ 
    763                 if (p_ptr->food < PY_FOOD_STARVE) 
    764                 { 
    765                         regen_amount = 0; 
    766                 } 
    767                 else if (p_ptr->food < PY_FOOD_FAINT) 
    768                 { 
    769                         regen_amount = PY_REGEN_FAINT; 
    770                 } 
    771                 else 
    772                 { 
    773                         regen_amount = PY_REGEN_WEAK; 
    774                 } 
    775  
    776                 /* Getting Faint */ 
    777                 if (p_ptr->food < PY_FOOD_FAINT) 
    778                 { 
    779                         /* Faint occasionally */ 
    780                         if (!p_ptr->timed[TMD_PARALYZED] && one_in_(10)) 
    781                         { 
    782                                 /* Message */ 
    783                                 msg_print("You faint from the lack of food."); 
    784                                 disturb(1, 0); 
    785  
    786                                 /* Hack -- faint (bypass free action) */ 
    787                                 (void)inc_timed(TMD_PARALYZED, 1 + randint0(5)); 
    788                         } 
    789                 } 
    790         } 
    791  
    792         /* Regeneration ability */ 
     775        if (p_ptr->food >= PY_FOOD_WEAK) 
     776                regen_amount = PY_REGEN_NORMAL; 
     777        else if (p_ptr->food < PY_FOOD_STARVE) 
     778                regen_amount = 0; 
     779        else if (p_ptr->food < PY_FOOD_FAINT) 
     780                regen_amount = PY_REGEN_FAINT; 
     781        else /* if (p_ptr->food < PY_FOOD_WEAK) */ 
     782                regen_amount = PY_REGEN_WEAK; 
     783 
     784        /* Various things speed up regeneration */ 
    793785        if (p_ptr->regenerate) 
    794         { 
    795                 regen_amount = regen_amount * 2; 
    796         } 
    797  
    798         /* Searching or Resting */ 
     786                regen_amount *= 2; 
    799787        if (p_ptr->searching || p_ptr->resting) 
    800         { 
    801                 regen_amount = regen_amount * 2; 
    802         } 
    803  
    804         /* Regenerate the mana */ 
    805         if (p_ptr->csp < p_ptr->msp) 
    806         { 
    807                 regenmana(regen_amount); 
    808         } 
    809  
    810         /* Various things interfere with healing */ 
     788                regen_amount *= 2; 
     789 
     790        /* Some things slow it down */ 
     791        if (p_ptr->impair_hp) 
     792                regen_amount /= 2; 
     793 
     794        /* Various things interfere with physical healing */ 
    811795        if (p_ptr->timed[TMD_PARALYZED]) regen_amount = 0; 
    812796        if (p_ptr->timed[TMD_POISONED]) regen_amount = 0; 
     
    816800        /* Regenerate Hit Points if needed */ 
    817801        if (p_ptr->chp < p_ptr->mhp) 
    818         { 
    819802                regenhp(regen_amount); 
    820         } 
     803 
     804 
     805        /** Regenerate SP **/ 
     806 
     807        /* Default regeneration */ 
     808        regen_amount = PY_REGEN_NORMAL; 
     809 
     810        /* Various things speed up regeneration */ 
     811        if (p_ptr->regenerate) 
     812                regen_amount *= 2; 
     813        if (p_ptr->searching || p_ptr->resting) 
     814                regen_amount *= 2; 
     815 
     816        /* Some things slow it down */ 
     817        if (p_ptr->impair_mana) 
     818                regen_amount /= 2; 
     819 
     820        /* Regenerate mana */ 
     821        if (p_ptr->csp < p_ptr->msp) 
     822                regenmana(regen_amount); 
     823 
    821824 
    822825