未验证 提交 e741c45b 编写于 作者: V Venera3 提交者: GitHub

Add mending speed and healing rate to bodypart definitions, unhardcode Reptilian Healing (#54404)

上级 a7a6f6f1
......@@ -375,7 +375,9 @@
"heading": "DBG Tail",
"heading_multiple": "Tails",
"encumbrance_text": "Your debug tail feels heavy",
"hit_size": 1,
"hit_size": 100,
"heal_bonus": 15,
"mend_rate": 100,
"drench_capacity": 4,
"main_part": "debug_tail",
"hit_difficulty": 0.8,
......@@ -387,7 +389,7 @@
"accusative": { "ctxt": "bodypart_accusative", "str": "debug tail" },
"hp_bar_ui_text": "DBG TAIL",
"base_hp": 20,
"flags": [ "ALWAYS_BLOCK", "NONSTANDARD_BLOCK" ],
"flags": [ "ALWAYS_BLOCK", "NONSTANDARD_BLOCK", "MEND_LIMB" ],
"armor": { "bash": 10 },
"unarmed_damage": [ { "damage_type": "acid", "amount": 10 }, { "damage_type": "bullet", "amount": 5, "armor_penetration": 100 } ],
"techniques": [ "tec_dbg_sting" ],
......
......@@ -1859,7 +1859,8 @@
"prereqs": [ "FASTHEALER" ],
"threshreq": [ "THRESH_LIZARD" ],
"category": [ "LIZARD" ],
"mending_modifier": 20.0
"mending_modifier": 20.0,
"flags": [ "MEND_ALL" ]
},
{
"type": "mutation",
......
......@@ -341,7 +341,8 @@ Some armor flags, such as `WATCH` and `ALARMCLOCK` are compatible with other ite
-```ALWAYS_BLOCK``` This nonstandard bodypart is eligible to block in unarmed combat even if your martial arts don't allow such blocks. No effect without `NONSTANDARD_BLOCK`
-```IGNORE_TEMP``` This bodypart is ignored for temperature calculations
-```LIMB_LOWER``` This bodypart is close to the ground, and as such has a higher chance to be attacked by small monsters - hitsize is tripled for creatures that can't attack upper limbs.
-```LIMB_UPPER``` This bodypart is high off the ground, and as such can't be attacked by small monsters - unless they have the `FLIES` or have `ATTACK_UPPER` flags
-```LIMB_UPPER``` This bodypart is high off the ground, and as such can't be attacked by small monsters - unless they have the `FLIES` or have `ATTACK_UPPER` flags`
- ````MEND_LIMB``` This bodypart can heal from being broken without needing a splint.
-```NONSTANDARD_BLOCK``` This limb is different enough that martial arts' arm/leg blocks aren't applicable - blocking with this limb is unlocked by reaching the MA's `nonstandard_block` level, unless the limb also has `ALWAYS_BLOCK`
......@@ -1509,6 +1510,7 @@ Gun fault flags:
- ```HYPEROPIC``` You are far-sighted - close combat is hampered and reading is impossible without glasses.
- ```MYOPIC``` You are nearsighted - vision range is severely reduced without glasses.
- ```MYOPIC_IN_LIGHT``` You are nearsighted in light, but can see normally in low-light conditions.
- ````MEND_ALL``` You need no splint to heal broken bones.
- ```NIGHT_VISION``` You can see in the dark.
- ```INFRARED``` You can see infrared, aka heat vision.
- ```SEESLEEP``` You can see while sleeping, and aren't bothered by light when trying to fall asleep.
......
......@@ -643,6 +643,8 @@ For information about tools with option to export ASCII art in format ready to b
| `temp_mod` | (_optional array_) Intrinsic temperature modifier of the bodypart. The first value (in the same "temperature unit" as mutations' `bodytemp_modifier`) is always applied, the second value is apllied on top when the bodypart isn't overheated.
| `env_protection` | (_optional_) Innate environmental protection of this part. (default: `0`)
| `stat_hp_mods` | (_optional_) Values modifying hp_max of this part following this formula: `hp_max += int_mod*int_max + dex_mod*dex_max + str_mod*str_max + per_mod*per_max + health_mod*get_healthy()` with X_max being the unmodified value of the X stat and get_healthy() being the hidden health stat of the character.
| `heal_bonus` | (_optional_) Innate amount of HP the bodypart heals every healing roll ( 5 minutes, currently ).
| `mend_rate` | (_optional_) Innate mending rate of the limb, should it get broken. Default `1.0`, used as a multiplier on the healing factor after other factors are calculated.
| `bionic_slots` | (_optional_) How many bionic slots does this part have.
| `is_limb` | (_optional_) Is this bodypart a limb and capable of breaking. (default: `false`)
| `smash_message` | (_optional_) The message displayed when using that part to smash something.
......
......@@ -294,6 +294,8 @@ void body_part_type::load( const JsonObject &jo, const std::string & )
mandatory( jo, was_loaded, "base_hp", base_hp );
optional( jo, was_loaded, "stat_hp_mods", hp_mods );
optional( jo, was_loaded, "heal_bonus", heal_bonus, 0 );
optional( jo, was_loaded, "mend_rate", mend_rate, 1.0f );
mandatory( jo, was_loaded, "drench_capacity", drench_max );
......
......@@ -233,6 +233,9 @@ struct body_part_type {
int base_hp = 60;
stat_hp_mods hp_mods;
// Innate healing rate of the bodypart
int heal_bonus = 0;
float mend_rate = 1.0f;
// if a limb is vital and at 0 hp, you die.
bool is_vital = false;
......
......@@ -7511,7 +7511,8 @@ void Character::heal_bp( bodypart_id bp, int dam )
void Character::heal( const bodypart_id &healed, int dam )
{
if( !is_limb_broken( healed ) ) {
int effective_heal = std::min( dam, get_part_hp_max( healed ) - get_part_hp_cur( healed ) );
int effective_heal = std::min( dam + healed->heal_bonus,
get_part_hp_max( healed ) - get_part_hp_cur( healed ) ) ;
mod_part_hp_cur( healed, effective_heal );
get_event_bus().send<event_type::character_heals_damage>( getID(), effective_heal );
}
......
......@@ -113,6 +113,8 @@ static const itype_id itype_smoxygen_tank( "smoxygen_tank" );
static const json_character_flag json_flag_GILLS( "GILLS" );
static const json_character_flag json_flag_GLARE_RESIST( "GLARE_RESIST" );
static const json_character_flag json_flag_MEND_ALL( "MEND_ALL" );
static const json_character_flag json_flag_MEND_LIMB( "MEND_LIMB" );
static const json_character_flag json_flag_RAD_DETECT( "RAD_DETECT" );
static const mtype_id mon_zombie( "mon_zombie" );
......@@ -148,7 +150,6 @@ static const trait_id trait_RADIOACTIVE1( "RADIOACTIVE1" );
static const trait_id trait_RADIOACTIVE2( "RADIOACTIVE2" );
static const trait_id trait_RADIOACTIVE3( "RADIOACTIVE3" );
static const trait_id trait_RADIOGENIC( "RADIOGENIC" );
static const trait_id trait_REGEN_LIZ( "REGEN_LIZ" );
static const trait_id trait_SCHIZOPHRENIC( "SCHIZOPHRENIC" );
static const trait_id trait_SHARKTEETH( "SHARKTEETH" );
static const trait_id trait_SHELL2( "SHELL2" );
......@@ -1737,7 +1738,7 @@ void Character::mend( int rate_multiplier )
healing_factor *= mutation_value( "mending_modifier" );
if( has_trait( trait_REGEN_LIZ ) ) {
if( has_flag( json_flag_MEND_ALL ) ) {
needs_splint = false;
}
......@@ -1753,10 +1754,16 @@ void Character::mend( int rate_multiplier )
continue;
}
if( bp->has_flag( json_flag_MEND_LIMB ) ) {
needs_splint = false;
}
if( needs_splint && !worn_with_flag( flag_SPLINT, bp ) ) {
continue;
}
healing_factor *= bp->mend_rate;
const time_duration dur_inc = 1_turns * roll_remainder( rate_multiplier * healing_factor );
auto &eff = get_effect( effect_mending, bp );
if( eff.is_null() ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册