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

feat(balance): uncanny dodge can now actually roll to dodge bullets #4125

Merged
merged 6 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 3 additions & 2 deletions data/json/bionics.json
Original file line number Diff line number Diff line change
Expand Up @@ -1081,13 +1081,14 @@
"id": "bio_uncanny_dodge",
"type": "bionic",
"name": { "str": "Uncanny Dodge" },
"description": "Your nervous system has been augmented with bionic processors, allowing you to dodge attacks beyond normal human capability, including bullets.",
"description": "Your nervous system has been augmented with bionic processors, increasing your ability to dodge while active. Your dodge skill will also grant a chance to evade attacks beyond normal human capability, such as bullets.",
"occupied_bodyparts": [ [ "torso", 12 ], [ "arm_l", 3 ], [ "arm_r", 3 ], [ "leg_l", 5 ], [ "leg_r", 5 ], [ "foot_l", 1 ], [ "foot_r", 1 ] ],
"flags": [ "BIONIC_TOGGLED" ],
"act_cost": "6 J",
"react_cost": "6 J",
"trigger_cost": "75 kJ",
"time": 1
"time": 1,
"enchantments": [ "ENCH_UNCANNY_DODGE" ]
},
{
"id": "bio_ups",
Expand Down
16 changes: 16 additions & 0 deletions data/json/enchantments.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,21 @@
{ "value": "ARMOR_STAB", "multiply": -0.08 },
{ "value": "ARMOR_BULLET", "multiply": -0.15 }
]
},
{
"type": "enchantment",
"id": "ENCH_UNCANNY_DODGE",
"condition": "ACTIVE",
"mutations": [ "ENCH_UNCANNY_DODGE_EFFECT" ]
},
{
"type": "mutation",
"id": "ENCH_UNCANNY_DODGE_EFFECT",
"name": { "str": "Uncanny Dodge" },
"points": 0,
"valid": false,
"description": "You're currently under the effects of the Uncanny Dodge CBM.",
"dodge_modifier": 2,
"player_display": false
}
]
2 changes: 1 addition & 1 deletion data/json/items/bionics.json
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@
"type": "BIONIC_ITEM",
"name": { "str": "Uncanny Dodge CBM" },
"looks_like": "bio_int_enhancer",
"description": "Bionic processors that augment the user's nervous system, allowing them to dodge attacks beyond normal human capability, including bullets.",
"description": "Bionic processors that augment the user's nervous system, increasing their ability to dodge while active. Dodge skill will also allow evading attacks beyond normal human capability, such as bullets.",
"price": "9500 USD",
"weight": "1000 g",
"difficulty": 11
Expand Down
6 changes: 3 additions & 3 deletions src/character_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ bool try_uncanny_dodge( Character &who )
bool is_u = who.is_avatar();
bool seen = is_u || get_player_character().sees( who );
std::optional<tripoint> adjacent = pick_safe_adjacent_tile( who );
if( adjacent ) {
if( adjacent && x_in_y( who.get_dodge(), 10 ) ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way you don't get to just dodge infinite bullets for free

I think it's a bit unfair, as

  • dodging consumes huge amount of electric charges
  • you may waste huge amount of electric charges and still fail
  • it introduces rng to uncanny dodge, which taints Creature::ranged_target_size. this might make debugging it harder.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As already written it was already set up so if you had no space to dodge it would automatically fail and waste charges, so only real break with consistency is it becoming based on your dodge skill.

if( is_u ) {
add_msg( _( "Time seems to slow down and you instinctively dodge!" ) );
} else if( seen ) {
Expand All @@ -611,9 +611,9 @@ bool try_uncanny_dodge( Character &who )
return true;
} else {
if( is_u ) {
add_msg( _( "You try to dodge but there's no room!" ) );
add_msg( _( "You try to dodge but fail!" ) );
} else if( seen ) {
add_msg( _( "%s tries to dodge but there's no room!" ), who.disp_name() );
add_msg( _( "%s tries to dodge but fails!" ), who.disp_name() );
}
return false;
}
Expand Down
3 changes: 3 additions & 0 deletions src/ranged.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,9 @@ static double occupied_tile_fraction( m_size target_size )

double Creature::ranged_target_size() const
{
if( const_cast<Creature &>( *this ).uncanny_dodge() ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we should avoid using const_cast because this breaks the promise that Creature::ranged_target_size() const will never modify itself (hence const).

we should probably separate uncanny_dodge into "check if it's possible to uncanny dodge" and "actually do uncanny dodge".

return 0.0;
}
if( has_flag( MF_HARDTOSHOOT ) ) {
switch( get_size() ) {
case MS_TINY:
Expand Down
Loading