Skip to content
Permalink
Browse files

Replace instant healing with slow healing effects. (#23757)

* Add healing over time effects.
  • Loading branch information...
Vasyan2006 authored and kevingranade committed Jul 16, 2018
1 parent 64896c0 commit b622362d8336eee1309b2785b0d80faa551841e3
@@ -676,6 +676,46 @@
"sleep_chance": [101]
}
},
{
"type": "effect_type",
"id": "bandaged",
"name": ["Bandaged"],
"desc": ["Your wounds are bandaged."],
"main_parts_only": true,
"rating": "good",
"int_dur_factor": 3600,
"max_intensity": 16,
"max_effective_intensity": 8,
"max_duration": 57600,
"base_mods": {
"healing_rate": [2],
"healing_head_mult": [50],
"healing_torso_mult": [150]
},
"scaling_mods": {
"healing_rate": [2]
}
},
{
"type": "effect_type",
"id": "disinfected",
"name": ["Disinfected"],
"desc": ["Your wounds are disinfected."],
"main_parts_only": true,
"rating": "good",
"int_dur_factor": 3600,
"max_intensity": 16,
"max_effective_intensity": 8,
"max_duration": 57600,
"base_mods": {
"healing_rate": [2],
"healing_head": [50],
"healing_torso": [150]
},
"scaling_mods": {
"healing_rate": [2]
}
},
{
"type": "effect_type",
"id": "spores",
@@ -15,12 +15,10 @@
"color" : "red",
"use_action" : {
"type" : "heal",
"limb_power" : 14,
"head_power" : 10,
"torso_power" : 18,
"bandages_power" : 8,
"disinfectant_power" : 8,
"bleed" : 0.95,
"bite" : 0.99,
"infect" : 0.95,
"move_cost" : 6000,
"long_action" : true,
"effects" : [ { "id" : "pkill1", "duration" : 120 } ]
@@ -41,8 +39,8 @@
"color" : "dark_gray",
"use_action" : {
"type" : "heal",
"limb_power" : 8,
"limb_scaling" : 1,
"bandages_power" : 6,
"disinfectant_power" : 6,
"bleed" : 1.0,
"move_cost" : 50000,
"long_action" : true
@@ -172,13 +170,35 @@
"stack_size" : 9,
"use_action" : {
"type" : "heal",
"limb_power" : 3,
"head_power" : 1,
"torso_power" : 4,
"bandages_power" : 4,
"bleed" : 0.9,
"move_cost" : 300
}
},
{
"id": "bandages_makeshift",
"type": "COMESTIBLE",
"name": "makeshift bandage",
"copy-from": "bandages",
"description": "Simple cloth bandages. Better than nothing.",
"use_action": { "type": "heal", "bandages_power": 2, "bleed": 0.9, "move_cost": 300 }
},
{
"id": "bandages_makeshift_bleached",
"type": "COMESTIBLE",
"name": "bleached makeshift bandage",
"copy-from": "bandages",
"description": "Simple cloth bandages. It is white, as real bandages should be.",
"use_action": { "type": "heal", "bandages_power": 3, "bleed": 0.9, "move_cost": 300 }
},
{
"id": "bandages_makeshift_boiled",
"type": "COMESTIBLE",
"name": "boiled makeshift bandage",
"copy-from": "bandages",
"description": "Simple cloth bandages. It was boiled to make it more sterile.",
"use_action": { "type": "heal", "bandages_power": 3, "bleed": 0.9, "move_cost": 300 }
},
{
"id" : "bfipowder",
"type" : "COMESTIBLE",
@@ -197,9 +217,7 @@
"container" : "bottle_plastic_small",
"use_action" : {
"type" : "heal",
"limb_power" : 6,
"head_power" : 5,
"torso_power" : 9,
"disinfectant_power" : 2,
"bite" : 0.95,
"move_cost" : 100
}
@@ -280,9 +298,7 @@
"container" : "bottle_glass",
"use_action" : {
"type" : "heal",
"limb_power" : 6,
"head_power" : 5,
"torso_power" : 9,
"disinfectant_power" : 4,
"bite" : 0.95,
"move_cost" : 100
}
@@ -340,8 +356,7 @@
"symbol" : "!",
"color" : "red",
"use_action" : {
"type" : "heal",
"limb_power" : 1,
"type" : "consume_drug",
"move_cost" : 100,
"effects" : [
{
@@ -438,7 +453,7 @@
"container" : "bag_plastic",
"use_action" : {
"type" : "heal",
"limb_power" : 0,
"bandages_power" : 2,
"bleed" : 0.9,
"move_cost" : 300
}
@@ -508,9 +523,7 @@
"container" : "bottle_plastic",
"use_action" : {
"type" : "heal",
"limb_power" : 6,
"head_power" : 5,
"torso_power" : 9,
"disinfectant_power" : 4,
"bite" : 0.95,
"move_cost" : 100
}
@@ -729,7 +742,7 @@
"color" : "white",
"use_action" : {
"type" : "heal",
"limb_power" : 0,
"bandages_power" : 2,
"bleed" : 0.5,
"move_cost" : 200
}
@@ -1006,9 +1019,7 @@
"container" : "bag_plastic",
"use_action" : {
"type" : "heal",
"limb_power" : 3,
"head_power" : 1,
"torso_power" : 4,
"disinfectant_power" : 2,
"bleed" : 90,
"move_cost" : 100
}
@@ -1062,9 +1073,7 @@
"spoils_in" : 672,
"use_action" : {
"type" : "heal",
"limb_power" : 6,
"head_power" : 5,
"torso_power" : 9,
"disinfectant_power" : 2,
"bite" : 0.95,
"move_cost" : 100
}
@@ -1306,9 +1315,7 @@
"color": "white",
"use_action" : {
"type" : "heal",
"limb_power" : 1,
"head_power" : 1,
"torso_power" : 1,
"disinfectant_power" : 2,
"bite" : 0.75,
"move_cost" : 200,
"used_up_item" : { "id": "rag", "quantity": 1, "flags": [ "FILTHY" ] }
@@ -1325,9 +1332,7 @@
"price" : 1000,
"use_action" : {
"type" : "heal",
"head_power" : 1,
"torso_power" : 1,
"limb_power" : 1,
"disinfectant_power" : 2,
"bite" : 0.95,
"move_cost" : 300,
"used_up_item" : { "id": "cotton_ball", "quantity": 1, "charges": 1, "flags": [ "FILTHY" ] }
@@ -52,6 +52,42 @@
[ [ "disinfectant", 1 ], [ "thyme_oil", 1 ], [ "chem_ethanol", 250 ], [ "denat_alcohol", 250 ] ]
]
},
{
"result": "bandages_makeshift",
"type": "recipe",
"category": "CC_OTHER",
"subcategory": "CSC_OTHER_MEDICAL",
"skill_used": "tailor",
"time": 500,
"autolearn": true,
"components": [ [ [ "rag", 3 ] ] ]
},
{
"result": "bandages_makeshift_bleached",
"type": "recipe",
"category": "CC_OTHER",
"subcategory": "CSC_OTHER_MEDICAL",
"skill_used": "cooking",
"difficulty": 1,
"time": 5000,
"batch_time_factors": [ 95, 4 ],
"autolearn": true,
"components": [ [ [ "bandages_makeshift", 3 ] ], [ [ "bleach", 1 ] ], [ [ "water_clean", 3 ], [ "water", 3 ] ] ]
},
{
"result": "bandages_makeshift_boiled",
"type": "recipe",
"category": "CC_OTHER",
"subcategory": "CSC_OTHER_MEDICAL",
"skill_used": "cooking",
"difficulty": 1,
"time": 5000,
"batch_time_factors": [ 95, 4 ],
"autolearn": true,
"qualities": [ { "id": "BOIL", "level": 1 } ],
"tools": [ [ [ "water_boiling_heat", 9, "LIST" ] ] ],
"components": [ [ [ "bandages_makeshift", 3 ] ], [ [ "water_clean", 3 ], [ "water", 3 ] ] ]
},
{
"result": "disinfectant",
"type": "recipe",
@@ -79,6 +79,8 @@ all of the listed effects to the player. The effects are added one after another
### Max intensity
```C++
"max_intensity": 3 - Used for many later fields, defaults to 1
"max_effective_intensity" - How many intensity levels will apply effects.
Other intensity levels will only increase duration.
```

### Name
@@ -405,6 +407,11 @@ Valid arguments:
"vomit_chance"
"vomit_chance_bot"
"vomit_tick"
"healing_rate" - Healed rate per day
"healing_head" - Percentage of healing value for head
"healing_torso" - Percentage of healing value for torso
```
Basic definitions:
```C++
@@ -30,6 +30,7 @@
#include <sstream>
#include <numeric>

const efftype_id effect_bandaged( "bandaged" );
const efftype_id effect_beartrap( "beartrap" );
const efftype_id effect_bite( "bite" );
const efftype_id effect_bleed( "bleed" );
@@ -38,6 +39,7 @@ const efftype_id effect_boomered( "boomered" );
const efftype_id effect_contacts( "contacts" );
const efftype_id effect_crushed( "crushed" );
const efftype_id effect_darkness( "darkness" );
const efftype_id effect_disinfected( "disinfected" );
const efftype_id effect_downed( "downed" );
const efftype_id effect_grabbed( "grabbed" );
const efftype_id effect_heavysnare( "heavysnare" );
@@ -1951,13 +1953,13 @@ float Character::get_hit_base() const

hp_part Character::body_window( bool precise ) const
{
return body_window( disp_name(), true, precise, 0, 0, 0, 0, 0, 0 );
return body_window( disp_name(), true, precise, 0, 0, 0, 0, 0, 0, 0, 0 );
}

hp_part Character::body_window( const std::string &menu_header,
bool show_all, bool precise,
int normal_bonus, int head_bonus, int torso_bonus,
bool bleed, bool bite, bool infect ) const
bool bleed, bool bite, bool infect, bool is_bandage, bool is_disinfectant ) const
{
catacurses::window hp_window = catacurses::newwin( 10, 31, ( TERMY - 10 ) / 2, ( TERMX - 31 ) / 2 );
draw_border(hp_window);
@@ -2011,7 +2013,7 @@ hp_part Character::body_window( const std::string &menu_header,
e.allowed = true;
} else if( limb_is_broken ) {
continue;
} else if( current_hp < maximal_hp && e.bonus != 0 ) {
} else if( current_hp < maximal_hp && ( e.bonus != 0 || is_bandage || is_disinfectant ) ) {
e.allowed = true;
} else {
continue;
@@ -2645,3 +2647,54 @@ float Character::healing_rate( float at_rest_quality ) const

return final_rate;
}

float Character::healing_rate_medicine( float at_rest_quality, const body_part bp ) const
{
float rate_medicine = 0.0f;
float bandaged_rate = 0.0f;
float disinfected_rate = 0.0f;

const effect &e_bandaged = get_effect( effect_bandaged, bp );
const effect &e_disinfected = get_effect( effect_disinfected, bp );

if( !e_bandaged.is_null() ) {
bandaged_rate += e_bandaged.get_amount( "HEAL_RATE", 0 ) / HOURS( 24 );
if( bp == bp_head ) {
bandaged_rate *= e_bandaged.get_amount( "HEAL_HEAD_MULT", 0 ) / 100.0f;
}
if( bp == bp_torso ) {
bandaged_rate *= e_bandaged.get_amount( "HEAL_TORSO_MULT", 0 ) / 100.0f;
}
}

if( !e_disinfected.is_null() ) {
disinfected_rate += e_disinfected.get_amount( "HEAL_RATE", 0 ) / HOURS( 24 );
if( bp == bp_head ) {
disinfected_rate *= e_disinfected.get_amount( "HEAL_HEAD", 0 ) / 100.0f;
}
if( bp == bp_torso ) {
disinfected_rate *= e_disinfected.get_amount( "HEAL_TORSO", 0 ) / 100.0f;
}
}

rate_medicine += bandaged_rate + disinfected_rate;
rate_medicine *= 1.0f + mutation_value( "healing_resting" );
rate_medicine *= 1.0f + at_rest_quality;

// increase healing if character has both effects
if( !e_bandaged.is_null() && !e_disinfected.is_null() ){
rate_medicine *= 2;
}

if( get_healthy() > 0.0f ) {
rate_medicine *= 1.0f + get_healthy() / 200.0f;
} else {
rate_medicine *= 1.0f + get_healthy() / 400.0f;
}
float primary_hp_mod = mutation_value( "hp_modifier" );
if( primary_hp_mod < 0.0f ) {
// HP mod can't get below -1.0
rate_medicine *= 1.0f + primary_hp_mod;
}
return rate_medicine;
}

0 comments on commit b622362

Please sign in to comment.
You can’t perform that action at this time.