From 3a3b91a214234105d12ef387feac9af62ebb2e85 Mon Sep 17 00:00:00 2001 From: KorGgenT Date: Tue, 5 May 2020 19:48:06 -0400 Subject: [PATCH] move two talk functions out of player --- src/character.cpp | 34 ++++++++++++++++++++++++++++++++++ src/character.h | 4 ++++ src/player.cpp | 34 ---------------------------------- src/player.h | 6 ------ 4 files changed, 38 insertions(+), 40 deletions(-) diff --git a/src/character.cpp b/src/character.cpp index 1488bc29326c5..aae81e439cb07 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -10798,6 +10798,40 @@ action_id Character::get_next_auto_move_direction() return get_movement_action_from_delta( dp, iso_rotate::yes ); } +int Character::talk_skill() const +{ + /** @EFFECT_INT slightly increases talking skill */ + + /** @EFFECT_PER slightly increases talking skill */ + + /** @EFFECT_SPEECH increases talking skill */ + int ret = get_int() + get_per() + get_skill_level( skill_id( "speech" ) ) * 3; + return ret; +} + +int Character::intimidation() const +{ + /** @EFFECT_STR increases intimidation factor */ + int ret = get_str() * 2; + if( weapon.is_gun() ) { + ret += 10; + } + if( weapon.damage_melee( DT_BASH ) >= 12 || + weapon.damage_melee( DT_CUT ) >= 12 || + weapon.damage_melee( DT_STAB ) >= 12 ) { + ret += 5; + } + + if( get_stim() > 20 ) { + ret += 2; + } + if( has_effect( effect_drunk ) ) { + ret -= 4; + } + + return ret; +} + bool Character::defer_move( const tripoint &next ) { // next must be adjacent to current pos diff --git a/src/character.h b/src/character.h index 94ccb7b1cb277..a91574370dfa4 100644 --- a/src/character.h +++ b/src/character.h @@ -1481,6 +1481,10 @@ class Character : public Creature, public visitable // 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 */ + int intimidation() const; // --------------- Other Stuff --------------- diff --git a/src/player.cpp b/src/player.cpp index b247541106a68..f25800119a13e 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -925,40 +925,6 @@ void player::search_surroundings() } } -int player::talk_skill() const -{ - /** @EFFECT_INT slightly increases talking skill */ - - /** @EFFECT_PER slightly increases talking skill */ - - /** @EFFECT_SPEECH increases talking skill */ - int ret = get_int() + get_per() + get_skill_level( skill_id( "speech" ) ) * 3; - return ret; -} - -int player::intimidation() const -{ - /** @EFFECT_STR increases intimidation factor */ - int ret = get_str() * 2; - if( weapon.is_gun() ) { - ret += 10; - } - if( weapon.damage_melee( DT_BASH ) >= 12 || - weapon.damage_melee( DT_CUT ) >= 12 || - weapon.damage_melee( DT_STAB ) >= 12 ) { - ret += 5; - } - - if( get_stim() > 20 ) { - ret += 2; - } - if( has_effect( effect_drunk ) ) { - ret -= 4; - } - - return ret; -} - bool player::is_dead_state() const { return hp_cur[hp_head] <= 0 || hp_cur[hp_torso] <= 0; diff --git a/src/player.h b/src/player.h index 143a209a693d8..cd8c4f19a8c7e 100644 --- a/src/player.h +++ b/src/player.h @@ -291,12 +291,6 @@ class player : public Character dealt_projectile_attack throw_item( const tripoint &target, const item &to_throw, const cata::optional &blind_throw_from_pos = cata::nullopt ); - // Mental skills and stats - /** 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 */ - int intimidation() const; - /** * Check if a given body part is immune to a given damage type *