Moved handle_gun_damage to its own function, as requested.