Skip to content

Commit

Permalink
Merge pull request #50926 from Menschheit/Issue-50900
Browse files Browse the repository at this point in the history
Apply temperature stats penalties after activating bionics
  • Loading branch information
Rivet-the-Zombie authored Aug 21, 2021
2 parents 9b8f196 + ab1f3a6 commit bd2ce6b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4882,7 +4882,13 @@ void Character::reset_stats()
void Character::reset()
{
// TODO: Move reset_stats here, remove it from Creature
Creature::reset();
reset_bonuses();
// Apply bonuses from hardcoded effects
mod_str_bonus( str_bonus_hardcoded );
mod_dex_bonus( dex_bonus_hardcoded );
mod_int_bonus( int_bonus_hardcoded );
mod_per_bonus( per_bonus_hardcoded );
reset_stats();
}

bool Character::has_nv()
Expand Down Expand Up @@ -13131,7 +13137,15 @@ void Character::process_one_effect( effect &it, bool is_new )
int val = 0;

// Still hardcoded stuff, do this first since some modify their other traits
int str = get_str_bonus();
int dex = get_dex_bonus();
int intl = get_int_bonus();
int per = get_per_bonus();
hardcoded_effects( it );
str_bonus_hardcoded += get_str_bonus() - str;
dex_bonus_hardcoded += get_dex_bonus() - dex;
int_bonus_hardcoded += get_int_bonus() - intl;
per_bonus_hardcoded += get_per_bonus() - per;

const auto get_effect = [&it, is_new]( const std::string & arg, bool reduced ) {
if( is_new ) {
Expand Down Expand Up @@ -13380,6 +13394,12 @@ void Character::process_effects()
remove_effect( effect_recover );
}

//Clear hardcoded bonuses from last turn
//Recalculated in process_one_effect
str_bonus_hardcoded = 0;
dex_bonus_hardcoded = 0;
int_bonus_hardcoded = 0;
per_bonus_hardcoded = 0;
//Human only effects
for( std::pair<const efftype_id, std::map<bodypart_id, effect>> &elem : *effects ) {
for( std::pair<const bodypart_id, effect> &_effect_it : elem.second ) {
Expand Down
5 changes: 5 additions & 0 deletions src/character.h
Original file line number Diff line number Diff line change
Expand Up @@ -3110,6 +3110,11 @@ class Character : public Creature, public visitable
int dex_bonus = 0;
int per_bonus = 0;
int int_bonus = 0;
/** Hardcoded stats bonus */
int str_bonus_hardcoded = 0;
int dex_bonus_hardcoded = 0;
int per_bonus_hardcoded = 0;
int int_bonus_hardcoded = 0;
// cached so the display knows how much your bonus is
int enchantment_speed_bonus = 0;

Expand Down

0 comments on commit bd2ce6b

Please sign in to comment.