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

move two talk functions out of player #40220

Merged
merged 1 commit into from
May 6, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/character.h
Original file line number Diff line number Diff line change
Expand Up @@ -1481,6 +1481,10 @@ class Character : public Creature, public visitable<Character>
// 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 ---------------

Expand Down
34 changes: 0 additions & 34 deletions src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 0 additions & 6 deletions src/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,6 @@ class player : public Character
dealt_projectile_attack throw_item( const tripoint &target, const item &to_throw,
const cata::optional<tripoint> &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
*
Expand Down