diff --git a/src/constants.cpp b/src/constants.cpp index 128afd116..0c22b4835 100644 --- a/src/constants.cpp +++ b/src/constants.cpp @@ -2200,7 +2200,7 @@ struct spell_types spells[] = { "Smoke Cloud", TRUE, MANIPULATION, AREA, -1, INSTANT, 1, PACK_VARIABLE_DRAIN_DAMAGE(2) }, { "Thunderbolt", TRUE, MANIPULATION, SINGLE, -1, INSTANT, 0, PACK_VARIABLE_DRAIN_DAMAGE(1) }, { "Thunderclap", TRUE, MANIPULATION, AREA, -1, INSTANT, 1, PACK_VARIABLE_DRAIN_DAMAGE(2) }, - { "Waterbolt", TRUE, MANIPULATION, SINGLE, -1, INSTANT, 0, PACK_VARIABLE_DRAIN_DAMAGE(1) }, // these were both VDD+0, but I can't find them in the book, so I'm matching them to the other elemental manips. -LS + { "Waterbolt", TRUE, MANIPULATION, SINGLE, -1, INSTANT, 0, PACK_VARIABLE_DRAIN_DAMAGE(0) }, // Target: Wastelands, pg 124 { "Splash", TRUE, MANIPULATION, AREA, -1, INSTANT, 0, PACK_VARIABLE_DRAIN_DAMAGE(2) }, { "Nightvision", TRUE, DETECTION, SINGLE, -1, SUSTAINED, 1, MODERATE }, { "Infravision", TRUE, DETECTION, SINGLE, -1, SUSTAINED, 1, MODERATE }, diff --git a/src/limits.cpp b/src/limits.cpp index 2b221793f..538067171 100644 --- a/src/limits.cpp +++ b/src/limits.cpp @@ -60,10 +60,12 @@ extern bool docwagon(struct char_data *ch); void mental_gain(struct char_data * ch) { int gain = 0; + struct obj_data *bio; if (IS_PROJECT(ch)) return; + // Base recovery switch (GET_POS(ch)) { case POS_SLEEPING: @@ -85,39 +87,62 @@ void mental_gain(struct char_data * ch) break; } - if (IS_NPC(ch)) { + // Character related bonuses + // NPCs recover faster + if (IS_NPC(ch)) gain *= 2; - } else { - gain *= get_drug_heal_multiplier(ch); + + // Augmentations + for (bio = ch->bioware; bio; bio = bio->next_content) { + if (GET_BIOWARE_TYPE(bio) == BIO_SYMBIOTES) { + switch (GET_BIOWARE_RATING(bio)) { + case 1: + gain *= 1.1; + break; + case 2: + gain *= 1.4; + break; + case 3: + gain *= 2; + break; + } + break; + } } + // Adept rapid healing increases recovery by +50% per rank + if (GET_TRADITION(ch) == TRAD_ADEPT && GET_POWER(ch, ADEPT_HEALING) > 0) + gain *= (((float) GET_POWER(ch, ADEPT_HEALING) / 2) + 1); + + // Lifestyle boost: The better-fed and better-rested you are, the more you heal. + gain *= 1 + MAX(0.0, 0.1 * (GET_BEST_LIFESTYLE(ch) - LIFESTYLE_SQUATTER)); + + // Room related bonuses if (find_workshop(ch, TYPE_MEDICAL)) gain *= 1.5; -#ifdef ENABLE_HUNGER - if ((GET_COND(ch, COND_FULL) == MIN_FULLNESS) || (GET_COND(ch, COND_THIRST) == MIN_QUENCHED)) - gain >>= 1; -#endif - if (char_is_in_social_room(ch)) gain *= 2; - else if (ch->in_room && ROOM_FLAGGED(ch->in_room, ROOM_STERILE)) - gain *= 1.5; - if (GET_TRADITION(ch) == TRAD_ADEPT && GET_POWER(ch, ADEPT_HEALING) > 0) - gain *= (((float) GET_POWER(ch, ADEPT_HEALING) / 2) + 1); + if (ch->in_room && ROOM_FLAGGED(ch->in_room, ROOM_STERILE)) + gain *= 1.5; - // Biosystem overstress reduces rate by 10% per point + // Penalties happen last, to avoid the possibility of truncating to zero too early + // Biosystem overstress reduces healing rate by 10% per point if (GET_BIOOVER(ch) > 0) gain *= MIN(1.0, MAX(0.1, 1 - (0.1 * GET_BIOOVER(ch)))); - // Lifestyle boost: The better-fed and better-rested you are, the more you heal. - gain += abs(GET_BEST_LIFESTYLE(ch)) - LIFESTYLE_SQUATTER; + // Drug multiplier is a float in range 0.1 ≤ X ≤ 1.0 + gain *= get_drug_heal_multiplier(ch); + +#ifdef ENABLE_HUNGER + if ((GET_COND(ch, COND_FULL) == MIN_FULLNESS) || (GET_COND(ch, COND_THIRST) == MIN_QUENCHED)) + gain >>= 1; +#endif // Prevent reaching 0 gain gain = MAX(1, gain); GET_MENTAL(ch) = MIN(GET_MAX_MENTAL(ch), GET_MENTAL(ch) + gain); - update_pos(ch); } @@ -129,6 +154,7 @@ void physical_gain(struct char_data * ch) if (IS_PROJECT(ch)) return; + // Base recovery switch (GET_POS(ch)) { case POS_STUNNED: @@ -152,50 +178,59 @@ void physical_gain(struct char_data * ch) break; } -#ifdef ENABLE_HUNGER - if ((GET_COND(ch, COND_FULL) == MIN_FULLNESS) || (GET_COND(ch, COND_THIRST) == MIN_QUENCHED)) - gain >>= 1; -#endif - - if (find_workshop(ch, TYPE_MEDICAL)) - gain *= 1.8; - - if (char_is_in_social_room(ch)) - gain *= 2; - else if (ch->in_room && ROOM_FLAGGED(ch->in_room, ROOM_STERILE)) - gain *= 1.8; - + // Character related bonuses + // NPCs recover faster if (IS_NPC(ch)) gain *= 2; - else - { - gain = MAX(1, gain); - for (bio = ch->bioware; bio; bio = bio->next_content) { - if (GET_BIOWARE_TYPE(bio) == BIO_SYMBIOTES) { - switch (GET_BIOWARE_RATING(bio)) { - case 1: - gain *= 1.1; - break; - case 2: - gain *= 1.4; - break; - case 3: - gain *= 2; - break; - } - break; + + // Augmentations + for (bio = ch->bioware; bio; bio = bio->next_content) { + if (GET_BIOWARE_TYPE(bio) == BIO_SYMBIOTES) { + switch (GET_BIOWARE_RATING(bio)) { + case 1: + gain *= 1.1; + break; + case 2: + gain *= 1.4; + break; + case 3: + gain *= 2; + break; } + break; } - - gain *= get_drug_heal_multiplier(ch); } + + // Adept rapid healing increases recovery by +50% per rank if (GET_TRADITION(ch) == TRAD_ADEPT && GET_POWER(ch, ADEPT_HEALING) > 0) gain *= (((float) GET_POWER(ch, ADEPT_HEALING) / 2) + 1); + // Lifestyle boost: The better-fed and better-rested you are, the more you heal. + gain *= 1 + MAX(0.0, 0.1 * (GET_BEST_LIFESTYLE(ch) - LIFESTYLE_SQUATTER)); + + // Room related bonuses + if (find_workshop(ch, TYPE_MEDICAL)) + gain *= 1.8; + + if (char_is_in_social_room(ch)) + gain *= 2; + + if (ch->in_room && ROOM_FLAGGED(ch->in_room, ROOM_STERILE)) + gain *= 1.8; + + // Penalties happen last, to avoid the possibility of truncating to zero too early // Biosystem overstress reduces healing rate by 10% per point if (GET_BIOOVER(ch) > 0) gain *= MIN(1.0, MAX(0.1, 1 - (0.1 * GET_BIOOVER(ch)))); + // Drug multiplier is a float in range 0.1 ≤ X ≤ 1.0 + gain *= get_drug_heal_multiplier(ch); + +#ifdef ENABLE_HUNGER + if ((GET_COND(ch, COND_FULL) == MIN_FULLNESS) || (GET_COND(ch, COND_THIRST) == MIN_QUENCHED)) + gain >>= 1; +#endif + // Prevent reaching 0 gain gain = MAX(1, gain); GET_PHYSICAL(ch) = MIN(GET_MAX_PHYSICAL(ch), GET_PHYSICAL(ch) + gain);