Skip to content

Commit

Permalink
Display Correct read times at character creation (#37472)
Browse files Browse the repository at this point in the history
* Display Correct read times at character creation

* move read_speed() to character
  • Loading branch information
Fris0uman authored and ZhilkinSerg committed Jan 28, 2020
1 parent fb0e570 commit b8000b3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 22 deletions.
20 changes: 20 additions & 0 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2470,6 +2470,26 @@ int Character::rust_rate( bool return_stat_effect ) const
return ( return_stat_effect ? ret : ret / 10 );
}

int Character::read_speed( bool return_stat_effect ) const
{
// Stat window shows stat effects on based on current stat
const int intel = get_int();
/** @EFFECT_INT increases reading speed by 3s per level above 8*/
int ret = to_moves<int>( 1_minutes ) - to_moves<int>( 3_seconds ) * ( intel - 8 );

if( has_bionic( afs_bio_linguistic_coprocessor ) ) { // Aftershock
ret *= .85;
}

ret *= mutation_value( "reading_speed_multiplier" );

if( ret < to_moves<int>( 1_seconds ) ) {
ret = to_moves<int>( 1_seconds );
}
// return_stat_effect actually matters here
return return_stat_effect ? ret : ret * 100 / to_moves<int>( 1_minutes );
}

bool Character::meets_skill_requirements( const std::map<skill_id, int> &req,
const item &context ) const
{
Expand Down
4 changes: 4 additions & 0 deletions src/character.h
Original file line number Diff line number Diff line change
Expand Up @@ -1298,6 +1298,10 @@ class Character : public Creature, public visitable<Character>
/** Returns the player's skill rust rate */
int rust_rate( bool return_stat_effect = true ) const;

// Mental skills and stats
/** Returns the player's reading speed */
int read_speed( bool return_stat_effect = true ) const;

// --------------- Other Stuff ---------------

/** return the calendar::turn the character expired */
Expand Down
20 changes: 0 additions & 20 deletions src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1178,26 +1178,6 @@ void player::search_surroundings()
}
}

int player::read_speed( bool return_stat_effect ) const
{
// Stat window shows stat effects on based on current stat
const int intel = get_int();
/** @EFFECT_INT increases reading speed */
int ret = to_moves<int>( 1_minutes ) - to_moves<int>( 3_seconds ) * ( intel - 8 );

if( has_bionic( afs_bio_linguistic_coprocessor ) ) { // Aftershock
ret *= .85;
}

ret *= mutation_value( "reading_speed_multiplier" );

if( ret < to_moves<int>( 1_seconds ) ) {
ret = to_moves<int>( 1_seconds );
}
// return_stat_effect actually matters here
return return_stat_effect ? ret : ret / 10;
}

int player::talk_skill() const
{
/** @EFFECT_INT slightly increases talking skill */
Expand Down
2 changes: 0 additions & 2 deletions src/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,6 @@ class player : public Character
const cata::optional<tripoint> &blind_throw_from_pos = cata::nullopt );

// Mental skills and stats
/** Returns the player's reading speed */
int read_speed( bool return_stat_effect = true ) const;
/** Returns a value used when attempting to convince NPC's of something */
int talk_skill() const;
/** Returns a value used when attempting to intimidate NPC's */
Expand Down

0 comments on commit b8000b3

Please sign in to comment.