diff --git a/src/mattack_actors.cpp b/src/mattack_actors.cpp index b00d2a5c92cd5..4f7ea3ffba130 100644 --- a/src/mattack_actors.cpp +++ b/src/mattack_actors.cpp @@ -461,7 +461,7 @@ int melee_actor::do_grab( monster &z, Creature *target, bodypart_id bp_id ) cons game_message_type msg_type = target->is_avatar() ? m_warning : m_info; const std::string mon_name = get_player_character().sees( z.pos() ) ? z.disp_name( false, true ) : _( "Something" ); - Character *foe = dynamic_cast( target ); + Character *foe = target->as_character(); map &here = get_map(); int eff_grab_strength = grab_data.grab_strength == -1 ? z.get_grab_strength() : @@ -608,7 +608,7 @@ int melee_actor::do_grab( monster &z, Creature *target, bodypart_id bp_id ) cons std::advance( intersect_iter, rng( 0, intersect.size() - 1 ) ); tripoint target_square = random_entry>( intersect ); if( z.can_move_to( target_square ) ) { - monster *zz = dynamic_cast( target ); + monster *zz = target->as_monster(); tripoint zpt = z.pos(); z.move_to( target_square, false, false, grab_data.drag_movecost_mod ); if( !g->is_empty( zpt ) ) { //Cancel the grab if the space is occupied by something diff --git a/src/melee.cpp b/src/melee.cpp index 2e74ff06172cd..6d7e77e5205b0 100644 --- a/src/melee.cpp +++ b/src/melee.cpp @@ -1909,17 +1909,6 @@ void Character::perform_technique( const ma_technique &technique, Creature &t, } } } - // Remove our grab if we knocked back our grabber (if we can do so is handled by tech conditions) - if( has_flag( json_flag_GRAB ) && t.has_effect_with_flag( json_flag_GRAB_FILTER ) ) { - for( const effect &eff : get_effects_with_flag( json_flag_GRAB ) ) { - if( t.has_effect( eff.get_bp()->grabbing_effect ) ) { - t.remove_effect( eff.get_bp()->grabbing_effect ); - remove_effect( eff.get_id(), eff.get_bp() ); - add_msg_debug( debugmode::DF_MELEE, "Grabber %s knocked back, grab on %s removed", t.get_name(), - eff.get_bp()->name ); - } - } - } } Character *you = dynamic_cast( &t ); diff --git a/src/monattack.cpp b/src/monattack.cpp index f890f63877cd9..061e878227947 100644 --- a/src/monattack.cpp +++ b/src/monattack.cpp @@ -2967,7 +2967,7 @@ bool mattack::nurse_operate( monster *z ) } } } else { - z->type->special_attacks.at( "grab" ).operator * ().call( *z ); + z->type->special_attacks.at( "grab" )->call( *z ); // Check if we successfully grabbed the target if( target->has_effect( effect_grabbed ) ) { z->dragged_foe_id = target->getID(); @@ -4956,7 +4956,7 @@ bool mattack::flesh_tendril( monster *z ) if( ( distance_to_target == 2 || distance_to_target == 3 ) && one_in( 4 ) ) { //it pulls you towards itself and then knocks you away - bool pulled = z->type->special_attacks.at( "ranged_pull" ).operator * ().call( *z ); + bool pulled = z->type->special_attacks.at( "ranged_pull" )->call( *z ); if( pulled && one_in( 4 ) ) { sounds::sound( z->pos(), 60, sounds::sound_t::alarm, _( "a deafening roar!" ), false, "shout", "roar" ); @@ -4969,7 +4969,7 @@ bool mattack::flesh_tendril( monster *z ) g->fling_creature( target, coord_to_angle( z->pos(), target->pos() ), z->type->melee_sides * z->type->melee_dice * 3 ); } else { - z->type->special_attacks.at( "grab" ).operator * ().call( *z ); + z->type->special_attacks.at( "grab" )->call( *z ); } }