Skip to content

Commit

Permalink
Add buff to deft
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeBandit committed Apr 12, 2020
1 parent 217f423 commit 4f46473
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion data/json/mutations/mutations.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@
"id": "DEFT",
"name": { "str": "Deft" },
"points": 1,
"description": "While you're not any better at melee combat, you are better at recovering from a miss, and will be able to attempt another strike faster.",
"description": "While you're not any better at melee combat, you are better at recovering from a miss, and will be able to attempt another strike faster. The effect of encumberance on your dodge skill is slightly reduced.",
"starting_trait": true,
"category": [ "BIRD", "BEAST", "RAPTOR", "MOUSE" ]
},
Expand Down
10 changes: 8 additions & 2 deletions src/avatar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ static const trait_id trait_THICK_SCALES( "THICK_SCALES" );
static const trait_id trait_WEBBED( "WEBBED" );
static const trait_id trait_WHISKERS( "WHISKERS" );
static const trait_id trait_WHISKERS_RAT( "WHISKERS_RAT" );
static const trait_id trait_DEFT( "DEFT" );

static const std::string flag_FIX_FARSIGHT( "FIX_FARSIGHT" );

Expand Down Expand Up @@ -1221,8 +1222,13 @@ void avatar::reset_stats()
}

// Dodge-related effects
mod_dodge_bonus( mabuff_dodge_bonus() -
( encumb( bp_leg_l ) + encumb( bp_leg_r ) ) / 20.0f - encumb( bp_torso ) / 10.0f );
if( has_trait( trait_DEFT ) ) {
mod_dodge_bonus( mabuff_dodge_bonus() -
( 3.0 / 4.0 ) * ( encumb( bp_leg_l ) + encumb( bp_leg_r ) ) / 20.0f - encumb( bp_torso ) / 10.0f );
} else {
mod_dodge_bonus( mabuff_dodge_bonus() -
( encumb( bp_leg_l ) + encumb( bp_leg_r ) ) / 20.0f - encumb( bp_torso ) / 10.0f );
}
// Whiskers don't work so well if they're covered
if( has_trait( trait_WHISKERS ) && !wearing_something_on( bp_mouth ) ) {
mod_dodge_bonus( 1 );
Expand Down
14 changes: 12 additions & 2 deletions src/player_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,13 @@ static std::string get_encumbrance_description( const player &p, body_part bp, b
case bp_torso: {
const int melee_roll_pen = std::max( -eff_encumbrance, -80 );
s += string_format( _( "Melee attack rolls: <color_white>%+d%%</color>\n" ), melee_roll_pen );
s += dodge_skill_text( -( eff_encumbrance / 10.0 ) );

if( p.has_trait( trait_id( "DEFT" ) ) ) {
s += dodge_skill_text( -( eff_encumbrance / 10.0 ) * ( 3.0 / 4.0 ) );
} else {
s += dodge_skill_text( -( eff_encumbrance / 10.0 ) );
}

s += swim_cost_text( ( eff_encumbrance / 10.0 ) * ( 80 - p.get_skill_level(
skill_swimming ) * 3 ) );
s += melee_cost_text( eff_encumbrance );
Expand Down Expand Up @@ -236,7 +242,11 @@ static std::string get_encumbrance_description( const player &p, body_part bp, b
s += run_cost_text( static_cast<int>( eff_encumbrance * 0.15 ) );
s += swim_cost_text( ( eff_encumbrance / 10 ) * ( 50 - p.get_skill_level(
skill_swimming ) * 2 ) / 2 );
s += dodge_skill_text( -eff_encumbrance / 10.0 / 4.0 );
if( p.has_trait( trait_id( "DEFT" ) ) ) {
s += dodge_skill_text( ( -eff_encumbrance / 10.0 / 4.0 ) * ( 3.0 / 4.0 ) );
} else {
s += dodge_skill_text( -eff_encumbrance / 10.0 / 4.0 );
}
break;
case bp_foot_l:
case bp_foot_r:
Expand Down

0 comments on commit 4f46473

Please sign in to comment.