Skip to content

Commit

Permalink
move pkill s/getters to character.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
KorGgenT committed Oct 22, 2019
1 parent 1ffbc34 commit 920844e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
26 changes: 26 additions & 0 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5376,3 +5376,29 @@ bool Character::has_fire( const int quantity ) const
}
return false;
}

void Character::mod_painkiller( int npkill )
{
set_painkiller( pkill + npkill );
}

void Character::set_painkiller( int npkill )
{
npkill = std::max( npkill, 0 );
if( pkill != npkill ) {
const int prev_pain = get_perceived_pain();
pkill = npkill;
on_stat_change( "pkill", pkill );
const int cur_pain = get_perceived_pain();

if( cur_pain != prev_pain ) {
react_to_felt_pain( cur_pain - prev_pain );
on_stat_change( "perceived_pain", cur_pain );
}
}
}

int Character::get_painkiller() const
{
return pkill;
}
26 changes: 0 additions & 26 deletions src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2934,32 +2934,6 @@ int player::get_perceived_pain() const
return std::max( get_pain() - get_painkiller(), 0 );
}

void Character::mod_painkiller( int npkill )
{
set_painkiller( pkill + npkill );
}

void Character::set_painkiller( int npkill )
{
npkill = std::max( npkill, 0 );
if( pkill != npkill ) {
const int prev_pain = get_perceived_pain();
pkill = npkill;
on_stat_change( "pkill", pkill );
const int cur_pain = get_perceived_pain();

if( cur_pain != prev_pain ) {
react_to_felt_pain( cur_pain - prev_pain );
on_stat_change( "perceived_pain", cur_pain );
}
}
}

int Character::get_painkiller() const
{
return pkill;
}

void Character::react_to_felt_pain( int intensity )
{
if( intensity <= 0 ) {
Expand Down

0 comments on commit 920844e

Please sign in to comment.