Skip to content

Commit

Permalink
Use only Dex to avoid grabs and use only Str to break out of grabs (C…
Browse files Browse the repository at this point in the history
…leverRaven#39911)

* Remove strength from avoiding grabs
* Grab breaks rely on Str
* Fix wording for grabby zombies
  • Loading branch information
CodeBandit authored Apr 26, 2020
1 parent 9eb2ff5 commit 6381b01
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
19 changes: 7 additions & 12 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1510,12 +1510,9 @@ bool Character::move_effects( bool attacking )
add_msg_player_or_npc( m_good, _( "You find yourself no longer grabbed." ),
_( "<npcname> finds themselves no longer grabbed." ) );
remove_effect( effect_grabbed );
/** @EFFECT_DEX increases chance to escape grab, if >STR */

/** @EFFECT_STR increases chance to escape grab, if >DEX */
} else if( rng( 0, std::max( get_dex(), get_str() ) ) <
rng( get_effect_int( effect_grabbed, bp_torso ), 8 ) ) {
// Randomly compare higher of dex or str to grab intensity.
/** @EFFECT_STR increases chance to escape grab */
} else if( rng( 0, get_str() ) < rng( get_effect_int( effect_grabbed, bp_torso ), 8 ) ) {
add_msg_player_or_npc( m_bad, _( "You try break out of the grab, but fail!" ),
_( "<npcname> tries to break out of the grab, but fails!" ) );
return false;
Expand Down Expand Up @@ -8519,18 +8516,16 @@ dealt_damage_instance Character::deal_damage( Creature *source, body_part bp,
if( source != nullptr ) {
if( source->has_flag( MF_GRABS ) && !source->is_hallucination() &&
!source->has_effect( effect_grabbing ) ) {
/** @EFFECT_DEX increases chance to avoid being grabbed, if DEX>STR */
/** @EFFECT_DEX increases chance to avoid being grabbed */

/** @EFFECT_STR increases chance to avoid being grabbed, if STR>DEX */
if( has_grab_break_tec() && get_grab_resist() > 0 &&
( get_dex() > get_str() ? rng( 0, get_dex() ) : rng( 0, get_str() ) ) >
rng( 0, 10 ) ) {
( rng( 0, get_dex() ) > rng( 0, 10 ) ) ) {
if( has_effect( effect_grabbed ) ) {
add_msg_if_player( m_warning, _( "You are being grabbed by %s, but you bat it away!" ),
add_msg_if_player( m_warning, _( "The %s tries to grab you as well, but you bat it away!" ),
source->disp_name() );
} else {
add_msg_player_or_npc( m_info, _( "You are being grabbed by %s, but you break its grab!" ),
_( "<npcname> are being grabbed by %s, but they break its grab!" ),
add_msg_player_or_npc( m_info, _( "The %s tries to grab you, but you break its grab!" ),
_( "The %s tries to grab <npcname>, but they break its grab!" ),
source->disp_name() );
}
} else {
Expand Down
9 changes: 3 additions & 6 deletions src/monattack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2675,12 +2675,9 @@ bool mattack::grab( monster *z )
}

item &cur_weapon = pl->weapon;
///\EFFECT_DEX increases chance to avoid being grabbed if DEX>STR

///\EFFECT_STR increases chance to avoid being grabbed if STR>DEX
if( pl->can_grab_break( cur_weapon ) && pl->get_grab_resist() > 0 && pl->get_dex() > pl->get_str() ?
rng( 0, pl->get_dex() ) : rng( 0, pl->get_str() ) > rng( 0,
z->type->melee_sides + z->type->melee_dice ) ) {
///\EFFECT_DEX increases chance to avoid being grabbed
if( pl->can_grab_break( cur_weapon ) && pl->get_grab_resist() > 0 &&
rng( 0, pl->get_dex() ) > rng( 0, z->type->melee_sides + z->type->melee_dice ) ) {
if( target->has_effect( effect_grabbed ) ) {
target->add_msg_if_player( m_info, _( "The %s tries to grab you as well, but you bat it away!" ),
z->name() );
Expand Down

0 comments on commit 6381b01

Please sign in to comment.