Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display Correct read times at character creation #37472

Merged
merged 2 commits into from
Jan 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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